From: fennecdjay Date: Mon, 24 Jun 2019 22:11:37 +0000 (+0200) Subject: :art! Few fixes X-Git-Tag: nightly~2386 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=a023ff1defdf5e3f8254dc57cf0590d096868dd6;p=gwion.git :art! Few fixes --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 31059000..929e1c64 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -560,13 +560,16 @@ ANN static m_bool emit_exp_decl_non_static(const Emitter emit, const Var_Decl va if(!GET_FLAG(v, member)) { v->offset = emit_local(emit, v->type->size, is_obj); exec = (f_instr*)(allocword); + if(GET_FLAG(var_decl->value, ref)) { + const Instr clean = emit_add_instr(emit, MemSetImm); + clean->m_val = v->offset; + } } const Instr instr = emit_kind(emit, v->type->size, emit_addr, exec); instr->m_val = v->offset; instr->m_val2 = v->type->size; if(is_obj && (is_array || !is_ref)) { - const Instr assign = emit_add_instr(emit, Assign); - assign->m_val = emit_var; + emit_add_instr(emit, Assign); const size_t missing_depth = type->array_depth - (array ? array->depth : 0); if(missing_depth) { const Instr push = emit_add_instr(emit, Reg2Reg); diff --git a/src/oo/type.c b/src/oo/type.c index f8bc74af..ca36381c 100644 --- a/src/oo/type.c +++ b/src/oo/type.c @@ -66,7 +66,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) { \ if(type->nspc) { \ - const t val = nspc_lookup_##name##0(type->nspc, xid); \ + const t val = nspc_lookup_##name##1(type->nspc, xid); \ if(val) \ return val; \ } \ diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 5ad18b66..8730b02a 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -33,7 +33,8 @@ ANN static inline void type_contains(const Type base, const Type t) { vector_init(v); if(vector_find(v, (vtype)t) == GW_ERROR) { vector_add(v, (vtype)t); - ADD_REF(t); + if(base != t) + ADD_REF(t); } } diff --git a/src/vm/vm.c b/src/vm/vm.c index 0433aec9..c56ed17a 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -339,7 +339,7 @@ regpushmemother: reg += VAL2; DISPATCH(); regpushmemaddr: - *(m_bit**)reg = mem + VAL; + *(m_bit**)reg = &*(m_bit*)(mem + VAL); reg += SZ_INT; DISPATCH() pushnow: