Revert "Merge pull request #94 from alliedmodders/debug-jit"
This reverts commitcc1493aa66
, reversing changes made to5776909b13
.
This commit is contained in:
parent
cc1493aa66
commit
71193c67b2
@ -1,6 +1,5 @@
|
|||||||
// vim: set ts=4 sw=4 tw=99 noet:
|
// vim: set ts=4 sw=4 tw=99 noet:
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "engine2.h"
|
#include "engine2.h"
|
||||||
@ -221,15 +220,3 @@ bool SourcePawnEngine2::InstallWatchdogTimer(size_t timeout_ms)
|
|||||||
return g_WatchdogTimer.Initialize(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);
|
|
||||||
}
|
|
||||||
|
@ -45,8 +45,6 @@ namespace SourcePawn
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void LogFatalPCodeError(const char *fmt, ...);
|
|
||||||
|
|
||||||
extern SourcePawn::SourcePawnEngine2 g_engine2;
|
extern SourcePawn::SourcePawnEngine2 g_engine2;
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEPAWN_ENGINE_2_H_
|
#endif //_INCLUDE_SOURCEPAWN_ENGINE_2_H_
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "interpreter.h"
|
#include "interpreter.h"
|
||||||
#include "opcodes.h"
|
#include "opcodes.h"
|
||||||
#include "watchdog_timer.h"
|
#include "watchdog_timer.h"
|
||||||
#include "engine2.h"
|
|
||||||
|
|
||||||
#define STACK_MARGIN 64
|
#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)
|
Jump(const sp_plugin_t *plugin, sp_context_t *ctx, cell_t target)
|
||||||
{
|
{
|
||||||
if (!IsValidOffset(target) || uint32_t(target) >= plugin->pcode_size) {
|
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;
|
ctx->err = SP_ERROR_INVALID_INSTRUCTION;
|
||||||
return NULL;
|
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;
|
cell_t target = *cip;
|
||||||
if (!IsValidOffset(target) || uint32_t(target) >= plugin->pcode_size) {
|
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;
|
ctx->err = SP_ERROR_INVALID_INSTRUCTION;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -241,14 +231,8 @@ Interpret(BaseRuntime *rt, uint32_t aCodeStart, cell_t *rval)
|
|||||||
cell_t *code = reinterpret_cast<cell_t *>(plugin->pcode);
|
cell_t *code = reinterpret_cast<cell_t *>(plugin->pcode);
|
||||||
cell_t *codeend = reinterpret_cast<cell_t *>(plugin->pcode + plugin->pcode_size);
|
cell_t *codeend = reinterpret_cast<cell_t *>(plugin->pcode + plugin->pcode_size);
|
||||||
|
|
||||||
if (!IsValidOffset(aCodeStart) || aCodeStart > 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
|
|
||||||
);
|
|
||||||
return SP_ERROR_INVALID_INSTRUCTION;
|
return SP_ERROR_INVALID_INSTRUCTION;
|
||||||
}
|
|
||||||
|
|
||||||
sp_context_t *ctx = rt->GetBaseContext()->GetCtx();
|
sp_context_t *ctx = rt->GetBaseContext()->GetCtx();
|
||||||
ctx->err = SP_ERROR_NONE;
|
ctx->err = SP_ERROR_NONE;
|
||||||
@ -264,11 +248,6 @@ Interpret(BaseRuntime *rt, uint32_t aCodeStart, cell_t *rval)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (cip >= codeend) {
|
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;
|
ctx->err = SP_ERROR_INVALID_INSTRUCTION;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -785,11 +764,6 @@ Interpret(BaseRuntime *rt, uint32_t aCodeStart, cell_t *rval)
|
|||||||
{
|
{
|
||||||
cell_t amount = *cip++;
|
cell_t amount = *cip++;
|
||||||
if (!IsValidOffset(amount)) {
|
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;
|
ctx->err = SP_ERROR_INVALID_INSTRUCTION;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -996,11 +970,6 @@ Interpret(BaseRuntime *rt, uint32_t aCodeStart, cell_t *rval)
|
|||||||
|
|
||||||
default:
|
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;
|
ctx->err = SP_ERROR_INVALID_INSTRUCTION;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -323,12 +323,6 @@ JitFunction *
|
|||||||
Compiler::emit(int *errp)
|
Compiler::emit(int *errp)
|
||||||
{
|
{
|
||||||
if (cip_ >= code_end_ || *cip_ != OP_PROC) {
|
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;
|
*errp = SP_ERROR_INVALID_INSTRUCTION;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1351,13 +1345,6 @@ Compiler::emitOp(OPCODE op)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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;
|
error_ = SP_ERROR_INVALID_INSTRUCTION;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1557,12 +1544,6 @@ cell_t
|
|||||||
Compiler::readCell()
|
Compiler::readCell()
|
||||||
{
|
{
|
||||||
if (cip_ >= code_end_) {
|
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;
|
error_= SP_ERROR_INVALID_INSTRUCTION;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user