blueloveTH hace 2 años
padre
commit
e097313c8f
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      src/vm.cpp

+ 5 - 0
src/vm.cpp

@@ -543,6 +543,11 @@ Str VM::disassemble(CodeObject_ co){
         if(byte.op == OP_JUMP_ABSOLUTE || byte.op == OP_POP_JUMP_IF_FALSE || byte.op == OP_SHORTCUT_IF_FALSE_OR_POP){
         if(byte.op == OP_JUMP_ABSOLUTE || byte.op == OP_POP_JUMP_IF_FALSE || byte.op == OP_SHORTCUT_IF_FALSE_OR_POP){
             jumpTargets.push_back(byte.arg);
             jumpTargets.push_back(byte.arg);
         }
         }
+        if(byte.op == OP_GOTO){
+            // TODO: pre-compute jump targets for OP_GOTO
+            int* target = co->labels.try_get_2(StrName(byte.arg));
+            if(target != nullptr) jumpTargets.push_back(*target);
+        }
     }
     }
     std::stringstream ss;
     std::stringstream ss;
     int prev_line = -1;
     int prev_line = -1;