From 0ccbca25c4e883721bf57315e74d9994bfca0195 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Wed, 16 Oct 2019 00:18:00 +0200 Subject: [PATCH] :art: Make sure NoOp does nothing It was already the case, setting all bits to 0 making a RegSetImm op. --- include/instr.h | 1 - include/opcode.h | 2 ++ opcode.txt | 1 + src/vm/vm.c | 3 ++- src/vm/vm_code.c | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) 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; } -- 2.43.0