From: fennecdjay Date: Tue, 15 Oct 2019 22:18:00 +0000 (+0200) Subject: :art: Make sure NoOp does nothing X-Git-Tag: nightly~2129 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=0ccbca25c4e883721bf57315e74d9994bfca0195;p=gwion.git :art: Make sure NoOp does nothing It was already the case, setting all bits to 0 making a RegSetImm op. --- diff --git a/include/instr.h b/include/instr.h index 6ad3d4ed..9a545cbe 100644 --- a/include/instr.h +++ b/include/instr.h @@ -58,7 +58,6 @@ INSTR(PopArrayClass); INSTR(DotTmpl); INSTR(GTmpl); -#define NoOp (f_instr)256 struct dottmpl_ { size_t len; diff --git a/include/opcode.h b/include/opcode.h index 3d25e1ea..55eac482 100644 --- a/include/opcode.h +++ b/include/opcode.h @@ -171,6 +171,7 @@ enum { eGcEnd, eGack, eGack3, + eNoOp, eDotTmplVal, eOP_MAX, eEOC, @@ -346,6 +347,7 @@ enum { #define GcEnd (f_instr)eGcEnd #define Gack (f_instr)eGack #define Gack3 (f_instr)eGack3 +#define NoOp (f_instr)eNoOp #define DotTmplVal (f_instr)eDotTmplVal #define OP_MAX (f_instr)eOP_MAX #define EOC (f_instr)eEOC diff --git a/opcode.txt b/opcode.txt index ceef501c..3924a322 100644 --- a/opcode.txt +++ b/opcode.txt @@ -168,6 +168,7 @@ GcAdd GcEnd Gack Gack3 +NoOp DotTmplVal OP_MAX EOC diff --git a/src/vm/vm.c b/src/vm/vm.c index 5de6ce2b..a4fc9d52 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -312,7 +312,7 @@ ANN void vm_run(const VM* vm) { // lgtm [cpp/use-of-goto] &&staticint, &&staticfloat, &&staticother, &&dotfunc, &&dotstaticfunc, &&pushstaticcode, &&gcini, &&gcadd, &&gcend, - &&gack, &&gack3, &®pushimm, &&other, &&eoc + &&gack, &&gack3, &&noop, &®pushimm, &&other, &&eoc }; const Shreduler s = vm->shreduler; register VM_Shred shred; @@ -817,6 +817,7 @@ gack: goto in; gack3: gw_out("\n"); +noop: DISPATCH(); other: VM_OUT diff --git a/src/vm/vm_code.c b/src/vm/vm_code.c index 0fb3546d..24829335 100644 --- a/src/vm/vm_code.c +++ b/src/vm/vm_code.c @@ -56,7 +56,7 @@ ANN static m_bit* tobytecode(MemPool p, const VM_Code code) { if(instr->opcode < eGack) memcpy(ptr + i*BYTECODE_SZ, instr, BYTECODE_SZ); else { - if(instr->execute == NoOp) { + if(instr->execute == NoOp) { // RegSetImm memset(ptr + i*BYTECODE_SZ, 0, BYTECODE_SZ); continue; }