mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
Fix out of bounds crash and missing comments
This commit is contained in:
parent
de78134e58
commit
4ff426f722
2 changed files with 14 additions and 11 deletions
|
@ -23,7 +23,7 @@ JitFuncPtr JitCompile(VMScriptFunction* sfunc)
|
|||
JitCompiler compiler(&context, sfunc);
|
||||
IRFunction* func = compiler.Codegen();
|
||||
jit->add(&context);
|
||||
//std::string text = context->getFunctionAssembly(func);
|
||||
std::string text = context.getFunctionAssembly(func);
|
||||
return reinterpret_cast<JitFuncPtr>(jit->getPointerToFunction(func->name));
|
||||
}
|
||||
catch (...)
|
||||
|
@ -123,6 +123,8 @@ IRFunction* JitCompiler::Codegen()
|
|||
EmitOpcode();
|
||||
|
||||
// Add line info to first instruction emitted for the opcode
|
||||
if (labels[i].block->code.size() != labels[i].index)
|
||||
{
|
||||
IRInst* inst = labels[i].block->code[labels[i].index];
|
||||
inst->fileIndex = 0;
|
||||
inst->lineNumber = curLine;
|
||||
|
@ -130,6 +132,7 @@ IRFunction* JitCompiler::Codegen()
|
|||
inst->comment = lineinfo.GetChars();
|
||||
else
|
||||
inst->comment = lineinfo.GetChars() + ("; " + inst->comment);
|
||||
}
|
||||
|
||||
pc++;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ void JitCompiler::EmitVMCall(IRValue* vmfunc, VMFunction* target)
|
|||
IRValue* scriptcall = Load(ToInt8PtrPtr(vmfunc, myoffsetof(VMScriptFunction, ScriptCall)));
|
||||
|
||||
IRInst* call = cc.CreateCall(cc.CreateBitCast(scriptcall, GetFunctionType5<int, VMFunction*, VMValue*, int, VMReturn*, int>()), { vmfunc, paramsptr, ConstValueD(B), GetCallReturns(), ConstValueD(C) });
|
||||
call->comment = target ? target->PrintableName.GetChars() : "VMCall";
|
||||
call->comment = std::string("call ") + (target ? target->PrintableName.GetChars() : "VMCall");
|
||||
|
||||
LoadInOuts();
|
||||
LoadReturns(pc + 1, C);
|
||||
|
@ -448,8 +448,8 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target)
|
|||
}
|
||||
}
|
||||
|
||||
IRValue* result = cc.CreateCall(cc.CreateBitCast(ConstValueA(target->DirectNativeCall), GetFuncSignature()), args);
|
||||
//result->setComment(target->PrintableName.GetChars());
|
||||
IRInst* result = cc.CreateCall(cc.CreateBitCast(ConstValueA(target->DirectNativeCall), GetFuncSignature()), args);
|
||||
result->comment = std::string("call ") + target->PrintableName.GetChars();
|
||||
|
||||
if (startret == 1 && numret > 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue