Avoiding function lookup for compiled functions. Still need caching.
This commit is contained in:
parent
ef5f59ed0b
commit
0d88e83daa
|
@ -576,8 +576,10 @@ int Translate_TRAP_TRUE(TranslationContext& ctx, Instr* i) {
|
|||
|
||||
uint32_t IntCode_CALL_XX(IntCodeState& ics, const IntCode* i, uint32_t reg) {
|
||||
FunctionInfo* symbol_info = (FunctionInfo*)ics.rf[reg].u64;
|
||||
Function* fn = NULL;
|
||||
ics.thread_state->runtime()->ResolveFunction(symbol_info->address(), &fn);
|
||||
Function* fn = symbol_info->function();
|
||||
if (!fn) {
|
||||
ics.thread_state->runtime()->ResolveFunction(symbol_info->address(), &fn);
|
||||
}
|
||||
XEASSERTNOTNULL(fn);
|
||||
// TODO(benvanik): proper tail call support, somehow.
|
||||
uint64_t return_address =
|
||||
|
|
|
@ -233,11 +233,15 @@ void TransitionToHost(X64Emitter& e) {
|
|||
e.call(e.rax);
|
||||
}
|
||||
void IssueCall(X64Emitter& e, FunctionInfo* symbol_info, uint32_t flags) {
|
||||
auto fn = symbol_info->function();
|
||||
auto fn = (X64Function*)symbol_info->function();
|
||||
// Resolve address to the function to call and store in rax.
|
||||
// TODO(benvanik): caching/etc. For now this makes debugging easier.
|
||||
e.mov(e.rdx, (uint64_t)symbol_info);
|
||||
CallNative(e, ResolveFunctionSymbol);
|
||||
if (fn) {
|
||||
e.mov(e.rax, (uint64_t)fn->machine_code());
|
||||
} else {
|
||||
e.mov(e.rdx, (uint64_t)symbol_info);
|
||||
CallNative(e, ResolveFunctionSymbol);
|
||||
}
|
||||
|
||||
// Actually jump/call to rax.
|
||||
if (flags & CALL_TAIL) {
|
||||
|
|
Loading…
Reference in New Issue