From 71193c67b2d9d8a7794fb9bc906f66029b459764 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 15 Jul 2014 09:35:16 -0700 Subject: [PATCH] Revert "Merge pull request #94 from alliedmodders/debug-jit" This reverts commit cc1493aa662752e2c044dd7d16c2c368aa60842f, reversing changes made to 5776909b13f916a69a59efca8722a3c2a2e0a1e2. --- sourcepawn/jit/engine2.cpp | 13 ------------- sourcepawn/jit/engine2.h | 2 -- sourcepawn/jit/interpreter.cpp | 33 +-------------------------------- sourcepawn/jit/x86/jit_x86.cpp | 19 ------------------- 4 files changed, 1 insertion(+), 66 deletions(-) diff --git a/sourcepawn/jit/engine2.cpp b/sourcepawn/jit/engine2.cpp index 62a5294b..09023cbd 100644 --- a/sourcepawn/jit/engine2.cpp +++ b/sourcepawn/jit/engine2.cpp @@ -1,6 +1,5 @@ // vim: set ts=4 sw=4 tw=99 noet: #include -#include #include #include #include "engine2.h" @@ -221,15 +220,3 @@ bool SourcePawnEngine2::InstallWatchdogTimer(size_t timeout_ms) return g_WatchdogTimer.Initialize(timeout_ms); } -void LogFatalPCodeError(const char *fmt, ...) -{ - FILE *fp = fopen("spjit-fatal-log.txt", "at"); - if (!fp) - return; - va_list ap; - va_start(ap, fmt); - vfprintf(fp, fmt, ap); - fprintf(fp, "\n"); - va_end(ap); - fclose(fp); -} diff --git a/sourcepawn/jit/engine2.h b/sourcepawn/jit/engine2.h index be0bdfe7..e9cb980e 100644 --- a/sourcepawn/jit/engine2.h +++ b/sourcepawn/jit/engine2.h @@ -45,8 +45,6 @@ namespace SourcePawn }; } -extern void LogFatalPCodeError(const char *fmt, ...); - extern SourcePawn::SourcePawnEngine2 g_engine2; #endif //_INCLUDE_SOURCEPAWN_ENGINE_2_H_ diff --git a/sourcepawn/jit/interpreter.cpp b/sourcepawn/jit/interpreter.cpp index 89fca60a..257e9414 100644 --- a/sourcepawn/jit/interpreter.cpp +++ b/sourcepawn/jit/interpreter.cpp @@ -19,7 +19,6 @@ #include "interpreter.h" #include "opcodes.h" #include "watchdog_timer.h" -#include "engine2.h" #define STACK_MARGIN 64 @@ -47,10 +46,6 @@ static inline cell_t * Jump(const sp_plugin_t *plugin, sp_context_t *ctx, cell_t target) { if (!IsValidOffset(target) || uint32_t(target) >= plugin->pcode_size) { - LogFatalPCodeError("[i] invalid jump (name=%s) (target=%d)", - plugin->name, - target - ); ctx->err = SP_ERROR_INVALID_INSTRUCTION; return NULL; } @@ -66,11 +61,6 @@ JumpTarget(const sp_plugin_t *plugin, sp_context_t *ctx, cell_t *cip, bool cond) cell_t target = *cip; if (!IsValidOffset(target) || uint32_t(target) >= plugin->pcode_size) { - LogFatalPCodeError("[i] invalid jump (name=%s) (cip=%d) (target=%d)", - plugin->name, - cell_t((uint8_t *)cip - plugin->pcode), - target - ); ctx->err = SP_ERROR_INVALID_INSTRUCTION; return NULL; } @@ -241,14 +231,8 @@ Interpret(BaseRuntime *rt, uint32_t aCodeStart, cell_t *rval) cell_t *code = reinterpret_cast(plugin->pcode); cell_t *codeend = reinterpret_cast(plugin->pcode + plugin->pcode_size); - if (!IsValidOffset(aCodeStart) || aCodeStart > plugin->pcode_size) { - LogFatalPCodeError("[i] invalid cs (name=%s) (cs=%d) (size=%d)", - rt->plugin()->name, - aCodeStart, - plugin->pcode_size - ); + if (!IsValidOffset(aCodeStart) || aCodeStart > plugin->pcode_size) return SP_ERROR_INVALID_INSTRUCTION; - } sp_context_t *ctx = rt->GetBaseContext()->GetCtx(); ctx->err = SP_ERROR_NONE; @@ -264,11 +248,6 @@ Interpret(BaseRuntime *rt, uint32_t aCodeStart, cell_t *rval) for (;;) { if (cip >= codeend) { - LogFatalPCodeError("[i] cip overrun (name=%s) (cs=%d) (cip=%d)", - rt->plugin()->name, - aCodeStart, - cell_t(cip - code) - ); ctx->err = SP_ERROR_INVALID_INSTRUCTION; goto error; } @@ -785,11 +764,6 @@ Interpret(BaseRuntime *rt, uint32_t aCodeStart, cell_t *rval) { cell_t amount = *cip++; if (!IsValidOffset(amount)) { - LogFatalPCodeError("[i] invalid stack offset (name=%s) (cs=%d) (cip=%d)", - rt->plugin()->name, - aCodeStart, - cell_t(cip - code) - ); ctx->err = SP_ERROR_INVALID_INSTRUCTION; goto error; } @@ -996,11 +970,6 @@ Interpret(BaseRuntime *rt, uint32_t aCodeStart, cell_t *rval) default: { - LogFatalPCodeError("[i] unknown instruction (name=%s) (cs=%d) (cip=%d)", - rt->plugin()->name, - aCodeStart, - cell_t(cip - code) - ); ctx->err = SP_ERROR_INVALID_INSTRUCTION; goto error; } diff --git a/sourcepawn/jit/x86/jit_x86.cpp b/sourcepawn/jit/x86/jit_x86.cpp index 2f218930..df68bd57 100644 --- a/sourcepawn/jit/x86/jit_x86.cpp +++ b/sourcepawn/jit/x86/jit_x86.cpp @@ -323,12 +323,6 @@ JitFunction * Compiler::emit(int *errp) { if (cip_ >= code_end_ || *cip_ != OP_PROC) { - LogFatalPCodeError("[j] emit() overran cip (name=%s) (cs=%d) (ce=%d) (cip=%d)", - plugin_->name, - pcode_start_, - cell_t((uint8_t *)cip_ - plugin_->pcode), - cell_t((uint8_t *)code_end_ - plugin_->pcode) - ); *errp = SP_ERROR_INVALID_INSTRUCTION; return NULL; } @@ -1351,13 +1345,6 @@ Compiler::emitOp(OPCODE op) break; default: - LogFatalPCodeError("[j] unknown opcode (name=%s) (cs=%d) (ce=%d) (cip=%d) (op=%d)", - plugin_->name, - pcode_start_, - cell_t((uint8_t *)cip_ - plugin_->pcode), - cell_t((uint8_t *)code_end_ - plugin_->pcode), - op - ); error_ = SP_ERROR_INVALID_INSTRUCTION; return false; } @@ -1557,12 +1544,6 @@ cell_t Compiler::readCell() { if (cip_ >= code_end_) { - LogFatalPCodeError("[j] readCell() overran (name=%s) (cs=%d) (ce=%d) (cip=%d)", - plugin_->name, - pcode_start_, - cell_t((uint8_t *)cip_ - plugin_->pcode), - cell_t((uint8_t *)code_end_ - plugin_->pcode) - ); error_= SP_ERROR_INVALID_INSTRUCTION; return 0; }