#define INTERP_PRINTF(fmt, ...) { \
m_str ret = *(m_str*)(VALUE - SZ_INT);\
- gw_asprintf(shred->info->vm->gwion->mp, &ret, fmt, ##__VA_ARGS__); \
+ gw_asprintf(shred->info->mp, &ret, fmt, ##__VA_ARGS__); \
*(m_str*)(VALUE - SZ_INT) = ret;\
}
-Subproject commit b932136274811c52694dc7f2d3c9de0832e6b64b
+Subproject commit 62ce17641d575fb1c0a16194234be257b4a6b85f
if(is_obj && (is_array || !is_ref))
CHECK_BB(emit_instantiate_decl(emit, type, decl->td, array, is_ref));
f_instr *exec = (f_instr*)allocmember;
+ if(!emit->env->scope->depth)
+ emit_debug(emit, v);
if(!vflag(v, vflag_member)) {
v->from->offset = emit_local(emit, type);
- emit_debug(emit, v);
exec = (f_instr*)(allocword);
if(GET_FLAG(v, late)) { // ref or emit_var ?
const Instr clean = emit_add_instr(emit, MemSetImm);
return ret;
}
-#define SPORK_FUNC_PREFIX "spork~func:%i"
-#define FORK_FUNC_PREFIX "fork~func:%i"
-#define SPORK_CODE_PREFIX "spork~code:%i"
-#define FORK_CODE_PREFIX "fork~code:%i"
+#define SPORK_FUNC_PREFIX "spork~func:%u"
+#define FORK_FUNC_PREFIX "fork~func:%u"
+#define SPORK_CODE_PREFIX "spork~code:%u"
+#define FORK_CODE_PREFIX "fork~code:%u"
static void push_spork_code(const Emitter emit, const m_str prefix, const loc_t pos) {
char c[strlen(SPORK_FUNC_PREFIX) + num_digit(pos.first.line) + 1];
INSTR(MemoizeStore) {
const Memoize m = shred->code->memoize;
- m_bit* data = get_data(shred->info->vm->gwion->mp, m);
+ m_bit* data = get_data(shred->info->mp, m);
memcpy(data, shred->mem, m->arg_sz);
memcpy(data + m->arg_sz, shred->reg - m->ret_sz, m->ret_sz);
}
handle(shred, "OutOfBoundsArraySliceException");
return;
}
- const M_Object out = new_array(shred->info->vm->gwion->mp, array->type_ref, sz);
+ const M_Object out = new_array(shred->info->mp, array->type_ref, sz);
for(m_int i = start, j = 0; i != end; i += op, ++j) {
m_bit buf[ARRAY_SIZE(in)];
m_vector_get(in, i, &buf);
static MFUN(vm_vector_map) {
const m_uint offset = *(m_uint*)REG(SZ_INT*3);
- const M_Object ret = new_array(shred->info->vm->gwion->mp, o->type_ref, ARRAY_LEN(ARRAY(o)));
+ const M_Object ret = new_array(shred->info->mp, o->type_ref, ARRAY_LEN(ARRAY(o)));
vector_add(&shred->gc, (m_uint)ret);
if(ARRAY_LEN(ARRAY(o))) {
_init(shred, &map_run_code, offset, SZ_INT);
static MFUN(vm_vector_compactmap) {
const VM_Code code = *(VM_Code*)REG(SZ_INT*2);
const m_uint offset = *(m_uint*)REG(SZ_INT*3);
- const M_Object ret = new_array(shred->info->vm->gwion->mp,
+ const M_Object ret = new_array(shred->info->mp,
code->ret_type, 0);
vector_add(&shred->gc, (m_uint)ret);
if(ARRAY_LEN(ARRAY(o))) {
static MFUN(vm_vector_filter) {
const m_uint offset = *(m_uint*)REG(SZ_INT*3);
- const M_Object ret = new_array(shred->info->vm->gwion->mp, o->type_ref, 0);
+ const M_Object ret = new_array(shred->info->mp, o->type_ref, 0);
vector_add(&shred->gc, (m_uint)ret);
if(ARRAY_LEN(ARRAY(o))) {
_init(shred, &filter_run_code, offset, SZ_INT);
}
static CTOR(usrugen_ctor) {
- struct UUGen_* uu = mp_calloc(shred->info->vm->gwion->mp, UUGen);
+ struct UUGen_* uu = mp_calloc(shred->info->mp, UUGen);
uu->self = o;
ugen_ini(shred->info->vm->gwion, UGEN(o), 1, 1);
ugen_gen(shred->info->vm->gwion, UGEN(o), id_tick, uu, 0);
struct UUGen_ *uu = UGEN(o)->module.gen.data;
if(uu->shred)
free_vm_shred(uu->shred);
- mp_free(shred->info->vm->gwion->mp, UUGen, UGEN(o)->module.gen.data);
+ mp_free(shred->info->mp, UUGen, UGEN(o)->module.gen.data);
}
static OP_CHECK(opck_usrugen) {
handle(shred, "NullTickException");
return;
}
- uu->shred = new_vm_shred(shred->info->vm->gwion->mp, *(VM_Code*)(shred->reg-offset));
+ uu->shred = new_vm_shred(shred->info->mp, *(VM_Code*)(shred->reg-offset));
vmcode_addref(*(VM_Code*)(shred->reg - offset));
uu->shred->info->vm = shred->info->vm;
- code_prepare(vmcode_callback(shred->info->vm->gwion->mp, uu->shred->code));
+ code_prepare(vmcode_callback(shred->info->mp, uu->shred->code));
shreduler_ini(uu->shred->info->vm->shreduler, uu->shred);
uu->prep = instr->m_val ? member_prep : global_prep;
*(M_Object*)(shred->reg - SZ_INT) = o;
const m_int end = *(m_int*)REG(0);
const m_int op = start < end ? 1 : -1;
const m_uint sz = op > 0 ? end - start : start - end;
- const M_Object array = new_array(shred->info->vm->gwion->mp, (Type)instr->m_val, sz);
+ const M_Object array = new_array(shred->info->mp, (Type)instr->m_val, sz);
for(m_int i = start, j = 0; i != end; i += op, ++j)
m_vector_set(ARRAY(array), j, &i);
*(M_Object*)REG(-SZ_INT) = array;
opck_str(neq, strcmp(bin->lhs->d.prim.d.str, bin->rhs->d.prim.d.str))
static CTOR(string_ctor) {
- STRING(o) = _mp_calloc(shred->info->vm->gwion->mp, 1);
+ STRING(o) = _mp_calloc(shred->info->mp, 1);
}
static DTOR(string_dtor) {
- free_mstr(shred->info->vm->gwion->mp, STRING(o));
+ free_mstr(shred->info->mp, STRING(o));
}
ID_CHECK(check_funcpp) {
for(m_int i = start, j = 0; i != end; i += op, ++j)
c[j] = str[i];
c[sz] = '\0';
- *(M_Object*)REG(-SZ_INT) = new_string(shred->info->vm->gwion->mp, shred, c);
+ *(M_Object*)REG(-SZ_INT) = new_string(shred->info->mp, shred, c);
}
static MFUN(string_len) {
for(m_uint i = 0; i < strlen(c); i++)
if(c[i] >= 'a' && c[i] <= 'z')
c[i] += 'A' - 'a';
- *(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);
+ *(M_Object*)RETURN = new_string(shred->info->mp, shred, c);
}
static MFUN(string_lower) {
for(m_uint i = 0; i < strlen(c); i++)
if(c[i] >= 'A' && c[i] <= 'Z')
c[i] -= 'A' - 'a';
- *(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);
+ *(M_Object*)RETURN = new_string(shred->info->mp, shred, c);
}
static MFUN(string_ltrim) {
i++;
char c[strlen(str) - i + 1];
strcpy(c, STRING(o) + i);
- *(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);
+ *(M_Object*)RETURN = new_string(shred->info->mp, shred, c);
}
static MFUN(string_rtrim) {
char c[len + 2];
strncpy(c, str, len + 1);
c[len + 1] = '\0';
- *(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);
+ *(M_Object*)RETURN = new_string(shred->info->mp, shred, c);
} else {
++o->ref;
*(M_Object*)RETURN = o;
for(i = start; i < len - end; i++)
c[i - start] = str[i];
c[len - start - end ] = '\0';
- *(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);
+ *(M_Object*)RETURN = new_string(shred->info->mp, shred, c);
}
static MFUN(string_charAt) {
for(i = index; i < (m_int)len; i++)
c[i + len_insert] = str[i];
c[len + len_insert] = '\0';
- *(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);;
+ *(M_Object*)RETURN = new_string(shred->info->mp, shred, c);;
}
static MFUN(string_replace) {
for(i = 0; i < len_insert; i++)
c[i + index] = insert[i];
c[index + len_insert] = '\0';
- *(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);;
+ *(M_Object*)RETURN = new_string(shred->info->mp, shred, c);;
}
static MFUN(string_replaceN) {
for(i = index + _len; i < (m_int)len; i++)
c[i] = str[i];
c[len + _len - 1] = '\0';
- *(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);;
+ *(M_Object*)RETURN = new_string(shred->info->mp, shred, c);;
}
static MFUN(string_find) {
static DTOR(ugen_dtor) {
const UGen ug = UGEN(o);
- MemPool p = shred->info->vm->gwion->mp;
+ MemPool p = shred->info->mp;
vector_rem2(&shred->info->vm->ugen, (vtype)ug);
if(!ug->multi)
release_mono(p, ug);
POP_REG(shred, instr->m_val2);
POP_REG(shred, SZ_INT);
const m_uint index = *(m_uint*)REG(-SZ_INT);
- const M_Object o = *(M_Object*)REG(-SZ_INT) = new_object(shred->info->vm->gwion->mp, NULL, (Type)instr->m_val);
+ const M_Object o = *(M_Object*)REG(-SZ_INT) = new_object(shred->info->mp, NULL, (Type)instr->m_val);
*(m_uint*)o->data = index;// + 1;
memcpy(o->data + SZ_INT, REG(0), instr->m_val2);
}
offset += t->size;
}
}
- free_vararg(shred->info->vm->gwion->mp, arg);
+ free_vararg(shred->info->mp, arg);
}
static MFUN(mfun_vararg_cpy) {
VM_Code code = mp_calloc(p, VM_Code);
code->name = mstrdup(p, name);
if(instr) {
-// code->instr = vector_copy(p, instr);
vector_init(&code->instr);
vector_copy2(instr, &code->instr);
code->bytecode = tobytecode(p, code);
return str;
}
-m_str code_name(const m_str name, const m_bool b) {
+m_str code_name(const m_str name, const bool b) {
const m_str str = strchr(name, '$');
return (b && str) ? (str + 1) : name;
}