]> Nishi Git Mirror - gwion.git/commitdiff
:art: Add eoc opcode
authorfennecdjay <astor.jeremie@wanadoo.fr>
Sat, 11 May 2019 17:44:23 +0000 (19:44 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Sat, 11 May 2019 17:44:23 +0000 (19:44 +0200)
include/opcode.h
opcode.txt
src/lib/instr.c
src/vm/vm.c

index 99b164ce9fd0bc90fd8c6df4e5bc85ebcccb19ec..aa3061430e533e26b59ef5e1d647a54a41d72568 100644 (file)
@@ -172,6 +172,7 @@ enum {
   eGack,
   eDotTmplVal,
   eOP_MAX,
+  eEOC,
 };
 
 #define  RegSetImm           (f_instr)eRegSetImm
@@ -345,4 +346,5 @@ enum {
 #define  Gack                (f_instr)eGack
 #define  DotTmplVal          (f_instr)eDotTmplVal
 #define  OP_MAX              (f_instr)eOP_MAX
+#define  EOC                 (f_instr)eEOC
 #endif
index efb45eee1e5ab5b4d4354b350613d65580026170..b090ee1fa0ed8a56d9a60cf867663a8cbcc55e1a 100644 (file)
@@ -168,4 +168,5 @@ GcAdd
 GcEnd
 Gack
 DotTmplVal
-OP_MAX
\ No newline at end of file
+OP_MAX
+EOC
index 5dd90db1632fcce1b4ca53140721721fbd2093f5..3037f769a87da914d303d6ac7a2ee2a2047f699a 100644 (file)
 #include "array.h"
 #include "nspc.h"
 #include "shreduler_private.h"
-
+/*
 INSTR(EOC) {
   vm_shred_exit(shred);
 }
-
+*/
 INSTR(DTOR_EOC) {
   const M_Object o = *(M_Object*)MEM(0);
   o->type_ref = o->type_ref->parent;
index fd4fc4c63e58159f596898fbac165a91c6767af5..8723a8bd20328e941b0f62c10e9cb891c50f68af 100644 (file)
@@ -281,7 +281,7 @@ ANN void vm_run(const VM* vm) { // lgtm [cpp/use-of-goto]
     &&staticint, &&staticfloat, &&staticother,
     &&dotfunc, &&dotstaticfunc, &&staticcode, &&pushstr,
     &&gcini, &&gcadd, &&gcend,
-    &&gack, &&regpushimm, &&other
+    &&gack, &&regpushimm, &&other, &&eoc
   };
   const Shreduler s = vm->shreduler;
   register VM_Shred shred;
@@ -799,12 +799,16 @@ shred->mem = mem;
 shred->pc = pc;
       instr->execute(shred, instr);
 if(!s->curr)break;
-code = shred->code;
-ip = shred->code->instr->ptr + OFFSET;
-reg = shred->reg;
-mem = shred->mem;
-pc = shred->pc;
-DISPATCH()
+  code = shred->code;
+  ip = shred->code->instr->ptr + OFFSET;
+  reg = shred->reg;
+  mem = shred->mem;
+  pc = shred->pc;
+  DISPATCH()
+eoc:
+  shred->code = code;
+  shred->mem = mem;
+  vm_shred_exit(shred);
     } while(s->curr);
   MUTEX_UNLOCK(s->mutex);
   }