]> Nishi Git Mirror - gwion.git/commitdiff
:art: clean vm
authorfennecdjay <fennecdjay@gmail.com>
Fri, 28 Oct 2022 03:10:34 +0000 (05:10 +0200)
committerfennecdjay <fennecdjay@gmail.com>
Fri, 28 Oct 2022 03:10:34 +0000 (05:10 +0200)
include/instr.h
include/opcode.h
opcode.txt
src/emit/emit.c
src/vm/vm.c
src/vm/vm_code.c

index d85e59627c705e110585219b10dd5a664bd6865b..4217a4b611ab360ff836e9402f3d3356fa75d948 100644 (file)
@@ -73,4 +73,6 @@ INSTR(SetCtor);
 
 INSTR(dict_ctor_alt);
 INSTR(dict_lit_ctor);
+
+INSTR(DotTmplVal);
 #endif
index 69679ea3681e61342611b653a08a6a4c897cdf93..e34d38209722de302620cec5fa55000a12854696 100644 (file)
@@ -212,9 +212,8 @@ enum {
   eDebugPush,
   eDebugPop,
   eEOC,
-  eUnroll2,
+  eVM_IN,
   eOP_MAX,
-  eDotTmplVal,
 };
 
 #define  RegSetImm            (f_instr)eRegSetImm
@@ -428,9 +427,8 @@ enum {
 #define  DebugPush            (f_instr)eDebugPush
 #define  DebugPop             (f_instr)eDebugPop
 #define  EOC                  (f_instr)eEOC
-#define  Unroll2              (f_instr)eUnroll2
+#define  VM_IN                (f_instr)eVM_IN
 #define  OP_MAX               (f_instr)eOP_MAX
-#define  DotTmplVal           (f_instr)eDotTmplVal
 #ifndef __cplusplus
 ANN static inline void dump_opcodes(const VM_Code code) {
   gw_out("{Y}┏━━━━┓{0}{-Y} {+}%s{0}\n{Y}┃{0}\n", code->name);
@@ -1414,17 +1412,12 @@ ANN static inline void dump_opcodes(const VM_Code code) {
         gw_out("{Y}┃{0}{-}% 4lu{0}: EOC         ", j);
         gw_out("\n");
         break;
-      case eUnroll2:
-        gw_out("{Y}┃{0}{-}% 4lu{0}: Unroll2     ", j);
+      case eVM_IN:
+        gw_out("{Y}┃{0}{-}% 4lu{0}: VM_IN       ", j);
         gw_out("\n");
         break;
       case eOP_MAX:
         gw_out("{Y}┃{0}{-}% 4lu{0}: OP_MAX      ", j);
-        gw_out(" {-R}%-14p{0}", instr->m_val);
-        gw_out("\n");
-        break;
-      case eDotTmplVal:
-        gw_out("{Y}┃{0}{-}% 4lu{0}: DotTmplVal  ", j);
         gw_out("\n");
         break;
     }
index ddd0ebe80ec3e4b96400fc810809e8a17f7d6c8c..34b74530d4a62538d99218f6527fe01f28ece315 100644 (file)
@@ -209,6 +209,5 @@ DebugValue
 DebugPush
 DebugPop
 EOC
-Unroll2
-OP_MAX~p
-DotTmplVal
+VM_IN
+OP_MAX
index faff630ebcf61c5219cd0d73d22afe8dc7a11266..ae359900b85a882f6a1e413c2cecdcac22bceb54 100644 (file)
@@ -2245,7 +2245,7 @@ ANN static m_bool _unroll(const Emitter emit, Looper *loop) {
   const m_uint end = emit_code_size(emit);
   for (m_uint i = 1; i < loop->n; ++i) CHECK_BB(unroll_run(emit, loop));
   unroll->m_val2      = end - start;
-  const Instr unroll2 = emit_add_instr(emit, Unroll2);
+  const Instr unroll2 = emit_add_instr(emit, VM_IN);
   unroll2->m_val      = (m_uint)unroll;
   scoped_end(emit);
   return GW_OK;
index 446e47725d2d60471fd9c4fc6118e07453e55301..fe130f5b0aecb67179e9885433262513dfdaf4df 100644 (file)
@@ -466,8 +466,8 @@ vm_prepare(const VM *vm, m_bit *prepare_code) { // lgtm [cpp/use-of-goto]
       &&unionother, &&unionaddr, &&staticint, &&staticfloat, &&staticother,
       &&dotfunc, &&gacktype, &&gackend, &&gack, &&try_ini,
       &&try_end, &&handleeffect, &&performeffect, &&noop, &&debugline,
-      &&debugvalue, &&debugpush, &&debugpop, &&eoc, &&unroll2, &&other,
-      &&regpushimm};
+      &&debugvalue, &&debugpush, &&debugpop, &&eoc, &&vmin, &&other};
+//      &&regpushimm};
 
   if(!prepare_code) {
     PRAGMA_PUSH()
@@ -1206,7 +1206,7 @@ vm_prepare(const VM *vm, m_bit *prepare_code) { // lgtm [cpp/use-of-goto]
     gack:
       VM_OUT
       gack(shred, VAL);
-      goto in;
+      goto vmin;
     try_ini:
       if (!shred->info->frame.ptr) // ???
         vector_init(&shred->info->frame);
@@ -1229,8 +1229,7 @@ vm_prepare(const VM *vm, m_bit *prepare_code) { // lgtm [cpp/use-of-goto]
       DISPATCH();
     other:
       VM_OUT((f_instr)VAL2)(shred, (Instr)VAL);
-    unroll2:
-    in:
+    vmin:
       if (!s->curr) break;
       bytecode = (code = shred->code)->bytecode;
       reg      = shred->reg;
@@ -1311,8 +1310,7 @@ static void *_dispatch[] = {
       &&_unionother, &&_unionaddr, &&_staticint, &&_staticfloat, &&_staticother,
       &&_dotfunc, &&_gacktype, &&_gackend, &&_gack, &&_try_ini,
       &&_try_end, &&_handleeffect, &&_performeffect, &&_noop, &&_debugline,
-      &&_debugvalue, &&_debugpush, &&_debugpop, &&_eoc, &&_unroll2, &&_other,
-      &&_regpushimm};
+      &&_debugvalue, &&_debugpush, &&_debugpop, &&_eoc, &&_vmin, &&_other};
 
 #define PREPARE(a) \
 _##a: \
@@ -1566,7 +1564,7 @@ _other:
   prepare_code += BYTECODE_SZ;\
   goto *_dispatch[*(m_bit*)prepare_code];
 }
-    PREPARE(unroll2);
+    PREPARE(vmin);
     PREPARE(debugline);
     PREPARE(debugvalue);
     PREPARE(debugpush);
index c619f1b2cd642accf57b1a1b68c3a848592cfba5..a6895f379702b6e71fa9d5d9c7d4756fd43dc348 100644 (file)
@@ -103,7 +103,7 @@ ANN static m_bit *tobytecode(MemPool p, const VM_Code code) {
           instr->m_val = next->m_val;
           next->opcode = eNoOp;
         }
-      } else if (instr->opcode == eUnroll2) {
+      } else if (instr->opcode == eVM_IN) {
         const Instr  unroll     = (Instr)instr->m_val;
         const m_uint pc         = vector_find(v, (m_uint)unroll);
         m_uint       reduce_pre = 0, reduce = 0;