]> Nishi Git Mirror - gwion.git/commitdiff
:art: Add dotstaticfunc
authorfennecdjay <astor.jeremie@wanadoo.fr>
Sun, 10 Mar 2019 11:01:51 +0000 (12:01 +0100)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Sun, 10 Mar 2019 11:01:51 +0000 (12:01 +0100)
include/opcode.h
opcode.txt
src/emit/emit.c
src/vm/vm.c

index 93547db2e34391dd8b90b63aba0f91636b0e9376..1e2579c3a846f3a88cae26d82dbe6b4b68bafff2 100644 (file)
@@ -148,6 +148,7 @@ enum {
   DotStatic2,
   DotStatic3,
   DotFunc,
+  DotStaticFunc,
   PushStaticCode,
   RegPushStr,
   GcIni,
@@ -304,6 +305,7 @@ enum {
 #define  DotStatic2          (f_instr)DotStatic2
 #define  DotStatic3          (f_instr)DotStatic3
 #define  DotFunc             (f_instr)DotFunc
+#define  DotStaticFunc       (f_instr)DotStaticFunc
 #define  PushStaticCode      (f_instr)PushStaticCode
 #define  RegPushStr          (f_instr)RegPushStr
 #define  GcIni               (f_instr)GcIni
index 217f8ee063f4661fc8d46f1ca403c0e417cc2c57..1764f4046cbe7d5d821af0fe8b5f799af5aee371 100644 (file)
@@ -145,6 +145,7 @@ DotStatic
 DotStatic2
 DotStatic3
 DotFunc
+DotStaticFunc
 PushStaticCode
 RegPushStr
 GcIni
index 1167759918ae7300e9f5863587419a582cafd649..ddbc5dcd04a5c373930033f0154bebbd1546d113 100644 (file)
@@ -763,7 +763,7 @@ ANN m_bool emit_exp_call1(const Emitter emit, const Func f) { GWDEBUG_EXE
     push_func_code(emit, f);
   else {
     const Instr back = (Instr)vector_back(&emit->code->instr);
-    if((f_instr)(m_uint)back->opcode == DotFunc)
+    if((f_instr)(m_uint)back->opcode == DotFunc || (f_instr)(m_uint)back->opcode == DotStaticFunc)
       back->m_val = f->vt_index;
   }
   if(GET_FLAG(f, member) && isa(actual_type(f->value_ref->type), t_fptr) > 0) {
@@ -1475,7 +1475,7 @@ ANN static m_bool emit_member_func(const Emitter emit, const Exp_Dot* member, co
     return GW_OK;
   }
   if(!func->def->tmpl) {
-    const Instr func_i = emit_add_instr(emit, DotFunc);
+    const Instr func_i = emit_add_instr(emit, GET_FLAG(func, member) ? DotFunc : DotStaticFunc);
     func_i->m_val = func->vt_index;
     return GW_OK;
   }
index 94d2ed56fe27f7fbe0b440fb1a88e87d4ac3bac1..a0897ebef78ffc2f6f1cecf7e7cad1f63a24e061 100644 (file)
@@ -268,7 +268,7 @@ ANN void vm_run(const VM* vm) { /* lgtm [cpp/use-of-goto] */
     &&addref, &&assign, &&remref,
     &&except, &&allocmemberaddr, &&dotmember, &&dotfloat, &&dotother, &&dotaddr,
     &&staticint, &&staticfloat, &&staticother,
-    &&dotfunc,&&staticcode, &&pushstr,
+    &&dotfunc, &&dotstaticfunc, &&staticcode, &&pushstr,
     &&gcini, &&gcadd, &&gcend,
     &&gack, &&other
   };
@@ -761,8 +761,9 @@ staticother:
   DISPATCH()
 dotfunc:
   assert(a.obj);
-  *(VM_Code*)(reg) = ((Func)vector_at(a.obj->vtable, instr->m_val))->code;
   reg += SZ_INT;
+dotstaticfunc:
+  *(VM_Code*)(reg-SZ_INT) = ((Func)vector_at(a.obj->vtable, instr->m_val))->code;
   DISPATCH()
 staticcode:
   (*(VM_Code*)reg = ((Func)instr->m_val)->code);