From: fennecdjay Date: Tue, 9 Apr 2019 19:17:22 +0000 (+0200) Subject: :bug: Various bugfixes (thanks to AFL) X-Git-Tag: nightly~2540 X-Git-Url: http://10.11.0.4:5575/?a=commitdiff_plain;h=57104651c2d332f6535ecfca6b843745e2ab9d3c;p=gwion.git :bug: Various bugfixes (thanks to AFL) --- diff --git a/ast b/ast index 853459cb..86c07142 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 853459cbbf4693c87febaa4be332818cf191a03b +Subproject commit 86c07142d6942990d228ed1cd4d584e898cfe90f diff --git a/include/env.h b/include/env.h index 714b6cd8..cc5d0932 100644 --- a/include/env.h +++ b/include/env.h @@ -58,5 +58,5 @@ ANN m_bool already_defined(const Env env, const Symbol s, const uint pos); ANN m_bool type_engine_check_prog(const Env, const Ast); ANN Func get_func(const Env, const Func_Def); ANN m_bool traverse_func_template(const Env env, const Func_Def def, const Type_List types); -ANN ID_List str2list(SymTable *st, const m_str path, m_uint* array_depth); +ANN ID_List str2list(const Env, const m_str path, m_uint* array_depth); #endif diff --git a/include/import.h b/include/import.h index 13221f65..b9765198 100644 --- a/include/import.h +++ b/include/import.h @@ -64,6 +64,7 @@ ANN Type_Decl* str2decl(const Env, const m_str, m_uint* depth); OP_CHECK(opck_const_rhs); OP_CHECK(opck_unary_meta); +OP_CHECK(opck_unary_meta2); OP_CHECK(opck_unary); OP_CHECK(opck_post); OP_CHECK(opck_rassign); diff --git a/include/memoize.h b/include/memoize.h index 907c06fe..72c9ed88 100644 --- a/include/memoize.h +++ b/include/memoize.h @@ -2,7 +2,7 @@ #define __MEMOIZE typedef struct Memoize_ * Memoize; -Memoize memoize_ini(MemPool, const Func, const enum Kind); +Memoize memoize_ini(const Emitter, const Func, const enum Kind); void memoize_end(MemPool, Memoize); INSTR(MemoizeCall); INSTR(MemoizeStore); diff --git a/include/nspc.h b/include/nspc.h index 90bb7e40..b8466599 100644 --- a/include/nspc.h +++ b/include/nspc.h @@ -47,7 +47,7 @@ static inline ANN void nspc_add_##b(const Nspc n, const Symbol s, const A a) { \ scope_add(&n->info->b, (vtype)s, (vtype)a); \ } \ ANN static inline void nspc_push_##b(MemPool p, const Nspc n) { scope_push(p, &n->info->b); }\ -ANN inline static void nspc_pop_##b (MemPool p, const Nspc n) { scope_pop (p, &n->info->b); }\ +ANN static inline void nspc_pop_##b (MemPool p, const Nspc n) { scope_pop (p, &n->info->b); }\ describe_lookups(A, b) describe_nspc_func(Value, value) diff --git a/include/opcode.h b/include/opcode.h index 2b7db10b..99b164ce 100644 --- a/include/opcode.h +++ b/include/opcode.h @@ -170,6 +170,7 @@ enum { eGcAdd, eGcEnd, eGack, + eDotTmplVal, eOP_MAX, }; @@ -342,5 +343,6 @@ enum { #define GcAdd (f_instr)eGcAdd #define GcEnd (f_instr)eGcEnd #define Gack (f_instr)eGack +#define DotTmplVal (f_instr)eDotTmplVal #define OP_MAX (f_instr)eOP_MAX #endif diff --git a/opcode.txt b/opcode.txt index 825cac4e..efb45eee 100644 --- a/opcode.txt +++ b/opcode.txt @@ -167,4 +167,5 @@ GcIni GcAdd GcEnd Gack -OP_MAX +DotTmplVal +OP_MAX \ No newline at end of file diff --git a/src/emit/emit.c b/src/emit/emit.c index e913b22b..9acef143 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -515,7 +515,7 @@ ANN static m_bool emit_dot_static_data(const Emitter emit, const Value v, const const m_uint size = v->type->size; if(isa(v->type, t_class) < 0) { const Instr instr = emit_kind(emit, size, emit_var, dotstatic); - instr->m_val = (m_uint)(v->owner_class->nspc->info->class_data + v->offset); + instr->m_val = (m_uint)(v->owner->info->class_data + v->offset); instr->m_val2 = size; } else { const Instr instr = emit_add_instr(emit, RegPushImm); @@ -769,7 +769,8 @@ ANN m_bool traverse_dot_tmpl(const Emitter emit, const struct dottmpl_ *dt) { static inline m_bool push_func_code(const Emitter emit, const Func f) { if(GET_FLAG(f, template) && f->value_ref->owner_class) { const Instr instr = (Instr)vector_back(&emit->code->instr); - assert(instr->execute == DotTmpl); +// assert(instr->execute == DotTmplVal); + assert(instr->opcode == DotTmplVal); size_t len = strlen(f->name); size_t sz = len - strlen(f->value_ref->owner_class->name); char c[sz + 1]; @@ -780,8 +781,10 @@ static inline m_bool push_func_code(const Emitter emit, const Func f) { dt->overload = f->def->tmpl->base; dt->tl = tmpl_tl(emit->env, c); dt->base = f->def; + instr->opcode = OP_MAX; instr->m_val = (m_uint)dt; instr->m_val2 = strlen(c); + instr->execute = DotTmpl; return GW_OK; } if(vector_size(&emit->code->instr)) { @@ -970,9 +973,8 @@ ANN static m_bool emit_implicit_cast(const Emitter emit, ANN static Instr emit_flow(const Emitter emit, const Type type, const f_instr f1, const f_instr f2) { GWDEBUG_EXE - if(isa(type, t_float) > 0) { + if(isa(type, t_float) > 0 || isa(type, t_dur) > 0 || isa(type, t_time) > 0) return emit_add_instr(emit, f2); - } return emit_add_instr(emit, f1); } @@ -1570,8 +1572,17 @@ ANN static m_bool emit_member_func(const Emitter emit, const Exp_Dot* member, co func_i->m_val = (m_uint)(func->code ?: (VM_Code)func); return GW_OK; } - const Instr instr = emit_add_instr(emit, !func->def->tmpl ? GET_FLAG(func, member) ? DotFunc : DotStaticFunc : DotTmpl); - instr->m_val = func->vt_index; + if(func->def->tmpl) { +//const Instr push = emit_add_instr(emit, RegPushImm); +//push->m_val = func; + const Instr instr = emit_add_instr(emit, DotTmplVal); +//printf("func %p\n", func); +// instr->m_val = func; +// instr->m_val2 = SZ_INT; + } else { + const Instr instr = emit_add_instr(emit, GET_FLAG(func, member) ? DotFunc : DotStaticFunc); + instr->m_val = func->vt_index; + } return GW_OK; } @@ -1693,7 +1704,7 @@ ANN static m_bool emit_func_def(const Emitter emit, const Func_Def func_def) { G if(!emit->env->class_def && !GET_FLAG(func_def, global) && !func_def->tmpl) emit_func_def_global(emit, func->value_ref); if(emit->memoize && GET_FLAG(func, pure)) - func->code->memoize = memoize_ini(emit->gwion->p, func, + func->code->memoize = memoize_ini(emit, func, kindof(func->def->base->ret_type->size, !func->def->base->ret_type->size)); return GW_OK; } diff --git a/src/emit/memoize.c b/src/emit/memoize.c index 5948d406..82b7840d 100644 --- a/src/emit/memoize.c +++ b/src/emit/memoize.c @@ -4,8 +4,10 @@ #include "oo.h" #include "env.h" #include "vm.h" -#include "type.h" #include "instr.h" +#include "emit.h" +#include "gwion.h" +#include "type.h" #include "func.h" #include "memoize.h" @@ -14,6 +16,8 @@ struct Memoize_ { m_uint arg_sz; m_uint ret_sz; struct pool *p; + size_t limit; + size_t curr; m_bool member; enum Kind kind; }; @@ -40,8 +44,8 @@ static inline void memoize_return4(m_bit* tgt NUSED, static void(*mreturn[])(m_bit*, const m_bit*, const m_uint) = { memoize_return1, memoize_return2, memoize_return3, memoize_return4}; -Memoize memoize_ini(MemPool p, const Func f, const enum Kind kind) { - Memoize m = mp_alloc(p, Memoize); +Memoize memoize_ini(const Emitter emit, const Func f, const enum Kind kind) { + Memoize m = mp_alloc(emit->gwion->p, Memoize); vector_init(&m->v); m->ret_sz = f->def->base->ret_type->size; m->kind = kind; @@ -51,6 +55,7 @@ Memoize memoize_ini(MemPool p, const Func f, const enum Kind kind) { m->member = SZ_INT; m->arg_sz = f->def->stack_depth - SZ_INT; } + m->limit = emit->memoize; m->p = new_pool((uint32_t)(m->arg_sz + m->ret_sz)); return m; } @@ -65,7 +70,10 @@ void memoize_end(MemPool p, Memoize m) { static inline void memoize_set(Memoize m, const m_bit* arg) { m_bit* data = _mp_alloc2(m->p); memcpy(data, arg, m->arg_sz); - vector_add(&m->v, (vtype)data); + if(vector_size(&m->v) < m->limit) + vector_add(&m->v, (vtype)data); + else + vector_set(&m->v, m->curr++ % m->limit, (vtype)data); } m_bool memoize_get(VM_Shred shred) { diff --git a/src/lib/import.c b/src/lib/import.c index b37b151b..a40bb9bd 100644 --- a/src/lib/import.c +++ b/src/lib/import.c @@ -83,7 +83,7 @@ ANN static m_bool check_illegal(char* curr, const char c, const m_uint i) { return GW_OK; } -ANN static m_bool name_valid(const m_str a) { +ANN static m_bool name_valid(Env env, const m_str a) { const m_uint len = strlen(a); m_uint lvl = 0; for(m_uint i = 0; i < len; i++) { @@ -96,17 +96,22 @@ ANN static m_bool name_valid(const m_str a) { continue; } if(c == ',') { - if(!lvl) - ERR_B(0, "illegal use of ',' outside of templating in name '%s'.", a) + if(!lvl) { + gwion_err(env->gwion, 0, "illegal use of ',' outside of templating in name '%s'.", a); + return GW_ERROR; + } continue; } if(c == '>') { - if(!lvl) - ERR_B(0, "illegal templating in name '%s'.", a) + if(!lvl) { + gwion_err(env->gwion, 0, "illegal templating in name '%s'.", a); + return GW_ERROR; + } lvl--; continue; } - ERR_B(0, "illegal character '%c' in name '%s'.", c, a) + gwion_err(env->gwion, 0, "illegal character '%c' in name '%s'.", c, a); + return GW_ERROR; } return !lvl ? 1 : -1; } @@ -120,27 +125,31 @@ ANN static void path_valid_inner(const m_str curr) { } } -ANN static m_bool path_valid(SymTable *st,ID_List* list, const struct Path* p) { +ANN static m_bool path_valid(const Env env,ID_List* list, const struct Path* p) { char last = '\0'; for(m_uint i = p->len + 1; --i;) { const char c = p->path[i - 1]; - if(c != '.' && check_illegal(p->curr, c, i) < 0) - ERR_B(0, "illegal character '%c' in path '%s'.", c, p->path) + if(c != '.' && check_illegal(p->curr, c, i) < 0) { + gwion_err(env->gwion, 0, "illegal character '%c' in path '%s'.", c, p->path); + return GW_ERROR; + } if(c == '.' || i == 1) { if((i != 1 && last != '.' && last != '\0') || (i == 1 && c != '.')) { path_valid_inner(p->curr); - *list = prepend_id_list(st->p, insert_symbol(st, p->curr), *list, 0); + *list = prepend_id_list(env->gwion->st->p, insert_symbol(env->gwion->st, p->curr), *list, 0); memset(p->curr, 0, p->len + 1); - } else - ERR_B(0, "path '%s' must not ini or end with '.'.", p->path) + } else { + gwion_err(env->gwion, 0, "path '%s' must not ini or end with '.'.", p->path); + return GW_ERROR; + } } last = c; } return GW_OK; } -ANN /* static */ ID_List str2list(SymTable *st, const m_str path, m_uint* array_depth) { +ANN /* static */ ID_List str2list(const Env env, const m_str path, m_uint* array_depth) { const m_uint len = strlen(path); ID_List list = NULL; m_uint depth = 0; @@ -153,14 +162,14 @@ ANN /* static */ ID_List str2list(SymTable *st, const m_str path, m_uint* array_ p.len -= 2; } *array_depth = depth; - if(path_valid(st, &list, &p) < 0) { + if(path_valid(env, &list, &p) < 0) { if(list) - free_id_list(st->p, list); + free_id_list(env->gwion->p, list); return NULL; } CHECK_OO(list) strncpy(curr, path, p.len); - list->xid = insert_symbol(st, curr); + list->xid = insert_symbol(env->gwion->st, curr); return list; } @@ -181,7 +190,7 @@ ANN2(1,2) Type gwi_mk_type(const Gwi gwi NUSED, const m_str name, const m_uint s ANN m_int gwi_add_type(const Gwi gwi, const Type type) { if(type->name[0] != '@') - CHECK_BB(name_valid(type->name)); + CHECK_BB(name_valid(gwi->gwion->env, type->name)); env_add_type(gwi->gwion->env, type); return (m_int)type->xid; } @@ -300,7 +309,7 @@ ANN static void dl_var_release(MemPool p, const DL_Var* v) { ANN m_int gwi_item_ini(const Gwi gwi, const restrict m_str type, const restrict m_str name) { DL_Var* v = &gwi->var; memset(v, 0, sizeof(DL_Var)); - if(!(v->t.xid = str2list(gwi->gwion->st, type, &v->array_depth))) + if(!(v->t.xid = str2list(gwi->gwion->env, type, &v->array_depth))) ERR_B(0, "\t...\tduring var import '%s.%s'.", gwi->gwion->env->class_def->name, name) v->var.xid = insert_symbol(gwi->gwion->st, name); @@ -362,7 +371,7 @@ ANN Type_Decl* str2decl(const Env env, const m_str s, m_uint *depth) { m_uint i = 0; m_str type_name = get_type_name(env, s, i++); CHECK_OO(type_name) - ID_List id = str2list(env->gwion->st, type_name, depth); + ID_List id = str2list(env, type_name, depth); CHECK_OO(id) Type_Decl* td = new_type_decl(env->gwion->p, id, 0); Type_List tmp = NULL; @@ -398,7 +407,7 @@ ANN static Arg_List make_dll_arg_list(const Env env, DL_Func * dl_fun) { free_arg_list(env->gwion->p, arg_list); ERR_O(0, "\t...\tat argument '%i'", i + 1) } - if((type_path2 = str2list(env->gwion->st, arg->name, &array_depth2))) + if((type_path2 = str2list(env, arg->name, &array_depth2))) free_id_list(env->gwion->p, type_path2); if(array_depth && array_depth2) { free_type_decl(env->gwion->p, type_decl); @@ -422,7 +431,7 @@ ANN static Func_Def make_dll_as_fun(const Env env, DL_Func * dl_fun, ae_flag fla m_uint i, array_depth = 0; flag |= ae_flag_builtin; - if(!(type_path = str2list(env->gwion->st, dl_fun->type, &array_depth)) || + if(!(type_path = str2list(env, dl_fun->type, &array_depth)) || !(type_decl = new_type_decl(env->gwion->p, type_path, 0))) ERR_O(0, "\t...\tduring @ function import '%s' (type).", dl_fun->name) if(array_depth) { @@ -439,7 +448,7 @@ ANN static Func_Def make_dll_as_fun(const Env env, DL_Func * dl_fun, ae_flag fla } ANN static Func_Def import_fun(const Env env, DL_Func * mfun, const ae_flag flag) { - CHECK_BO(name_valid(mfun->name)); + CHECK_BO(name_valid(env, mfun->name)); return make_dll_as_fun(env, mfun, flag); } @@ -467,7 +476,7 @@ ANN m_int gwi_func_end(const Gwi gwi, const ae_flag flag) { static Type get_type(const Env env, const m_str str) { m_uint depth = 0; - const ID_List list = (str && str != (m_str)OP_ANY_TYPE) ? str2list(env->gwion->st, str, &depth) : NULL; + const ID_List list = (str && str != (m_str)OP_ANY_TYPE) ? str2list(env, str, &depth) : NULL; const Type t = (str == (m_str) OP_ANY_TYPE) ? OP_ANY_TYPE : list ? find_type(env, list) : NULL; if(list) free_id_list(env->gwion->p, list); @@ -527,7 +536,7 @@ ANN static Stmt import_fptr(const Env env, DL_Func* dl_fun, ae_flag flag) { Type_Decl* type_decl = NULL; const Arg_List args = make_dll_arg_list(env, dl_fun); flag |= ae_flag_builtin; - if(!(type_path = str2list(env->gwion->st, dl_fun->type, &array_depth)) || + if(!(type_path = str2list(env, dl_fun->type, &array_depth)) || !(type_decl = new_type_decl(env->gwion->p, type_path, 0))) ERR_O(0, "\t...\tduring fptr import '%s' (type).", dl_fun->name) @@ -548,20 +557,21 @@ ANN Type gwi_fptr_end(const Gwi gwi, const ae_flag flag) { return t; } -ANN static Exp make_exp(SymTable *st, const m_str type, const m_str name) { +ANN static Exp make_exp(const Env env, const m_str type, const m_str name) { Type_Decl *type_decl; ID_List id_list; m_uint array_depth; Array_Sub array = NULL; - CHECK_OO((id_list = str2list(st, type, &array_depth))) + CHECK_OO((id_list = str2list(env, type, &array_depth))) if(array_depth) { - array = new_array_sub(st->p, NULL); + array = new_array_sub(env->gwion->p, NULL); array->depth = array_depth; } - type_decl = new_type_decl(st->p, id_list, 0); - const Var_Decl var_decl = new_var_decl(st->p, insert_symbol(st, name), array, 0); - const Var_Decl_List var_decl_list = new_var_decl_list(st->p, var_decl, NULL); - return new_exp_decl(st->p, type_decl, var_decl_list); + type_decl = new_type_decl(env->gwion->p, id_list, 0); + const Var_Decl var_decl = new_var_decl(env->gwion->p, + insert_symbol(env->gwion->st, name), array, 0); + const Var_Decl_List var_decl_list = new_var_decl_list(env->gwion->p, var_decl, NULL); + return new_exp_decl(env->gwion->p, type_decl, var_decl_list); } ANN2(1) m_int gwi_union_ini(const Gwi gwi, const m_str name) { @@ -571,7 +581,7 @@ ANN2(1) m_int gwi_union_ini(const Gwi gwi, const m_str name) { } ANN m_int gwi_union_add(const Gwi gwi, const restrict m_str type, const restrict m_str name) { - const Exp exp = make_exp(gwi->gwion->st, type, name); + const Exp exp = make_exp(gwi->gwion->env, type, name); CHECK_OB(exp); const Type t = type_decl_resolve(gwi->gwion->env, exp->d.exp_decl.td); if(!t) diff --git a/src/lib/object.c b/src/lib/object.c index ccfb0e02..8d971c50 100644 --- a/src/lib/object.c +++ b/src/lib/object.c @@ -174,7 +174,7 @@ GWION_IMPORT(object) { CHECK_BB(gwi_oper_end(gwi, op_eq, EqObject)) CHECK_BB(gwi_oper_end(gwi, op_ne, NeqObject)) CHECK_BB(gwi_oper_ini(gwi, NULL, "Object", "int")) - CHECK_BB(gwi_oper_add(gwi, opck_unary_meta)) + CHECK_BB(gwi_oper_add(gwi, opck_unary_meta2)) CHECK_BB(gwi_oper_end(gwi, op_not, IntNot)) gwi_item_ini(gwi, "@null", "null"); gwi_item_end(gwi, 0, NULL); diff --git a/src/lib/opfunc.c b/src/lib/opfunc.c index 6637ce2d..8d0dc292 100644 --- a/src/lib/opfunc.c +++ b/src/lib/opfunc.c @@ -53,6 +53,12 @@ OP_CHECK(opck_unary_meta) { return unary->exp->type; } +OP_CHECK(opck_unary_meta2) { + const Exp_Unary* unary = (Exp_Unary*)data; + exp_self(unary)->meta = ae_meta_value; + return t_int; +} + OP_CHECK(opck_unary) { const Exp_Unary* unary = (Exp_Unary*)data; if(unary->exp->meta != ae_meta_var) diff --git a/src/lib/prim.c b/src/lib/prim.c index d82d7dc0..eb28ceee 100644 --- a/src/lib/prim.c +++ b/src/lib/prim.c @@ -59,7 +59,7 @@ static GWION_IMPORT(int_unary) { CHECK_BB(gwi_oper_ini(gwi, NULL, "int", "int")) CHECK_BB(gwi_oper_add(gwi, opck_unary_meta)) CHECK_BB(gwi_oper_end(gwi, op_sub, int_negate)) - CHECK_BB(gwi_oper_add(gwi, opck_unary_meta)) + CHECK_BB(gwi_oper_add(gwi, opck_unary_meta2)) CHECK_BB(gwi_oper_end(gwi, op_not, IntNot)) CHECK_OP(inc, unary, pre_inc) CHECK_OP(dec, unary, pre_dec) @@ -89,12 +89,6 @@ static GWION_IMPORT(int) { return import_int_values(gwi); } -OP_CHECK(opck_unary_meta2) { - const Exp_Unary* unary = (Exp_Unary*)data; - exp_self(unary)->meta = ae_meta_value; - return t_int; -} - static GWION_IMPORT(values) { VM* vm = gwi_vm(gwi); ALLOC_PTR(gwi->gwion->p, d_zero, m_float, 0.0); diff --git a/src/oo/nspc.c b/src/oo/nspc.c index 15402d3a..c20ffce7 100644 --- a/src/oo/nspc.c +++ b/src/oo/nspc.c @@ -31,9 +31,9 @@ ANN static void free_nspc_value(const Nspc a, Gwion gwion) { struct scope_iter iter = { &a->info->value, 0, 0 }; Value v; while(scope_iter(&iter, &v) > 0) { - if(isa(v->type, t_object) > 0 || + if(v->type && (isa(v->type, t_object) > 0 || (isa(v->type, t_union) > 0 && - (GET_FLAG(v, static) || GET_FLAG(v, global)))) { + (GET_FLAG(v, static) || GET_FLAG(v, global))))) { nspc_release_object(a, v, gwion); } REM_REF(v, gwion); diff --git a/src/oo/type.c b/src/oo/type.c index 26c8c609..dc9efe32 100644 --- a/src/oo/type.c +++ b/src/oo/type.c @@ -49,7 +49,7 @@ ANN Type find_common_anc(const restrict Type lhs, const restrict Type rhs) { #define describe_find(name, t) \ ANN t find_##name(const Type type, const Symbol xid) { \ - const t val = nspc_lookup_##name##1(type->nspc, xid); \ + const t val = nspc_lookup_##name##0(type->nspc, xid); \ if(val) \ return val; \ return type->parent ? find_##name(type->parent, xid) : NULL; \ diff --git a/src/parse/check.c b/src/parse/check.c index c06ba982..fd569458 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -77,7 +77,7 @@ ANN Type check_td(const Env env, Type_Decl *td) { ERR_O(td->exp->pos, "Expression must be of type '%s', not '%s'\n" "maybe you meant typeof(Expression)", t_class->name, td->exp->type->name); m_uint depth; - td->xid = str2list(env->gwion->st, t->name, &depth); + td->xid = str2list(env, t->name, &depth); if(depth) { Exp base = new_exp_prim_int(env->gwion->p, 0, 0), e = base; diff --git a/src/parse/scan1.c b/src/parse/scan1.c index e5efda19..7c2d40c4 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -70,8 +70,12 @@ ANN m_bool scan1_exp_decl(const Env env, Exp_Decl* decl) { GWDEBUG_EXE ERR_B(var->pos, "variable %s has already been defined in the same scope...", s_name(var->xid)) if(var->array && decl->type != t_undefined) { - if(var->array->exp) + if(var->array->exp) { + if(GET_FLAG(decl->td, ref)) + ERR_B(td_pos(decl->td), "ref array must not have array expression.\n" + "e.g: int @my_array[];\nnot: int my_array[2];") CHECK_BB(scan1_exp(env, var->array->exp)) + } t = array_type(env, decl->type, var->array->depth); } const Value v = var->value = former ? former : new_value(env->gwion->p, t, s_name(var->xid)); diff --git a/src/vm/vm.c b/src/vm/vm.c index 7901271c..b1753ef1 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -284,7 +284,7 @@ static const void* dispatch[] = { &&staticint, &&staticfloat, &&staticother, &&dotfunc, &&dotstaticfunc, &&staticcode, &&pushstr, &&gcini, &&gcadd, &&gcend, - &&gack, &&other + &&gack, &®pushimm, &&other }; const Shreduler s = vm->shreduler; register VM_Shred shred; @@ -657,7 +657,7 @@ autoloop: autoloopptr: *(m_bit**)(*(M_Object*)(mem + instr->m_val + SZ_INT))->data = m_vector_addr(ARRAY(a.obj), *(m_uint*)(mem + instr->m_val)); autoloopcount: - *(m_uint*)reg = m_vector_size(ARRAY(a.obj)) - ++*(m_uint*)(mem + instr->m_val); + *(m_uint*)reg = m_vector_size(ARRAY(a.obj)) - (*(m_uint*)(mem + instr->m_val))++; reg += SZ_INT; DISPATCH() arraytop: diff --git a/util b/util index cb9e371b..adc983be 160000 --- a/util +++ b/util @@ -1 +1 @@ -Subproject commit cb9e371b894ede91c4c0830e1ee494dd50483c02 +Subproject commit adc983bec96f51536b394816048fa7bfe3ccd7c7