From d5edd3db360c122fab91e20573f6b77902cae9da Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 10 Apr 2017 22:18:43 +0300 Subject: [PATCH] Commented out remains of VM exception handling opcodes This fixes build with GCC/Clang --- src/scripting/backend/codegen.cpp | 2 +- src/scripting/backend/vmdisasm.cpp | 4 ++-- src/scripting/vm/vmops.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index ba1c72c28a..07f1ba287f 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -6534,7 +6534,7 @@ ExpEmit FxSelf::Emit(VMFunctionBuilder *build) { build->Emit(OP_EQA_R, 1, 0, 1); build->Emit(OP_JMP, 1); - build->Emit(OP_THROW, 2, X_BAD_SELF); + //build->Emit(OP_THROW, 2, X_BAD_SELF); } // self is always the first pointer passed to the function return ExpEmit(0, REGT_POINTER, false, true); diff --git a/src/scripting/backend/vmdisasm.cpp b/src/scripting/backend/vmdisasm.cpp index f0d687b675..3a37da8e3b 100644 --- a/src/scripting/backend/vmdisasm.cpp +++ b/src/scripting/backend/vmdisasm.cpp @@ -320,7 +320,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction switch (code[i].op) { case OP_JMP: - case OP_TRY: + //case OP_TRY: col = printf_wrapper(out, "%08x", (i + 1 + code[i].i24) << 2); break; @@ -498,7 +498,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction col = 30; } printf_wrapper(out, "%*c", 30 - col, ';'); - if (!cmp && (code[i].op == OP_JMP || code[i].op == OP_TRY || code[i].op == OP_PARAMI)) + if (!cmp && (code[i].op == OP_JMP || /*code[i].op == OP_TRY ||*/ code[i].op == OP_PARAMI)) { printf_wrapper(out, "%d\n", code[i].i24); } diff --git a/src/scripting/vm/vmops.h b/src/scripting/vm/vmops.h index 18a444677b..cf49d98342 100644 --- a/src/scripting/vm/vmops.h +++ b/src/scripting/vm/vmops.h @@ -114,12 +114,12 @@ xx(RET, ret, I8BCP, NOP, 0, 0), // Copy value from register encoded in BC to xx(RETI, reti, I8I16, NOP, 0, 0), // Copy immediate from BC to return value A, possibly returning xx(NEW, new, RPRPI8, NOP, 0, 0), xx(NEW_K, new, RPKP, NOP, 0, 0), -xx(TRY, try, I24, NOP, 0, 0), // When an exception is thrown, start searching for a handler at pc + ABC -xx(UNTRY, untry, I8, NOP, 0, 0), // Pop A entries off the exception stack -xx(THROW, throw, THROW, NOP, 0, 0), // A == 0: Throw exception object pB +//xx(TRY, try, I24, NOP, 0, 0), // When an exception is thrown, start searching for a handler at pc + ABC +//xx(UNTRY, untry, I8, NOP, 0, 0), // Pop A entries off the exception stack +//xx(THROW, throw, THROW, NOP, 0, 0), // A == 0: Throw exception object pB // A == 1: Throw exception object pkB // A >= 2: Throw VM exception of type BC -xx(CATCH, catch, CATCH, NOP, 0, 0), // A == 0: continue search on next try +//xx(CATCH, catch, CATCH, NOP, 0, 0), // A == 0: continue search on next try // A == 1: continue execution at instruction immediately following CATCH (catches any exception) // A == 2: (pB == ) then pc++ ; next instruction must JMP to another CATCH // A == 3: (pkB == ) then pc++ ; next instruction must JMP to another CATCH