From: fennecdjay Date: Sat, 11 May 2019 17:44:23 +0000 (+0200) Subject: :art: Add eoc opcode X-Git-Tag: nightly~2494 X-Git-Url: http://10.11.0.4:5575/?a=commitdiff_plain;h=057cea4ed874b53aa7958bfb9e6ff90f1d8113eb;p=gwion.git :art: Add eoc opcode --- diff --git a/include/opcode.h b/include/opcode.h index 99b164ce..aa306143 100644 --- a/include/opcode.h +++ b/include/opcode.h @@ -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 diff --git a/opcode.txt b/opcode.txt index efb45eee..b090ee1f 100644 --- a/opcode.txt +++ b/opcode.txt @@ -168,4 +168,5 @@ GcAdd GcEnd Gack DotTmplVal -OP_MAX \ No newline at end of file +OP_MAX +EOC diff --git a/src/lib/instr.c b/src/lib/instr.c index 5dd90db1..3037f769 100644 --- a/src/lib/instr.c +++ b/src/lib/instr.c @@ -13,11 +13,11 @@ #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; diff --git a/src/vm/vm.c b/src/vm/vm.c index fd4fc4c6..8723a8bd 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -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, &®pushimm, &&other + &&gack, &®pushimm, &&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); }