]> Nishi Git Mirror - gwion.git/commitdiff
:art! Few fixes
authorfennecdjay <astor.jeremie@wanadoo.fr>
Mon, 24 Jun 2019 22:11:37 +0000 (00:11 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Mon, 24 Jun 2019 22:11:37 +0000 (00:11 +0200)
src/emit/emit.c
src/oo/type.c
src/parse/scan1.c
src/vm/vm.c

index 3105900074237ed02165b00f909e089b57d02c15..929e1c64e95f69bf3aed8a80a3738e02054396ef 100644 (file)
@@ -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);
index f8bc74afbea71cc4ac36a31a45baff365e95c6a5..ca36381c377f9ce76ced2be377502c1b2a3b8840 100644 (file)
@@ -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;                                                      \
   }                                                                  \
index 5ad18b66da8d96eed47642a7550aeb30dadc9120..8730b02a205c8c2fca87645e85196d5758670e2e 100644 (file)
@@ -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);
   }
 }
 
index 0433aec9ae295780afb47b5ab31409e3afb24667..c56ed17aef09aac749b5771f259b0d5dcb576dec 100644 (file)
@@ -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: