Add instrumentation to JIT invalid instruction errors.

This commit is contained in:
David Anderson
2014-07-14 09:19:44 -07:00
parent 5776909b13
commit 43946e6b6f
4 changed files with 66 additions and 1 deletions
+19
View File
@@ -323,6 +323,12 @@ 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;
}
@@ -1345,6 +1351,13 @@ 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;
}
@@ -1544,6 +1557,12 @@ 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;
}