Removing SET_RETURN_ADDRESS - hopefully it'll never be needed again.
This commit is contained in:
@@ -580,9 +580,7 @@ uint32_t IntCode_CALL_XX(IntCodeState& ics, const IntCode* i, uint32_t reg) {
|
||||
ics.thread_state->runtime()->ResolveFunction(symbol_info->address(), &fn);
|
||||
XEASSERTNOTNULL(fn);
|
||||
// TODO(benvanik): proper tail call support, somehow.
|
||||
uint64_t return_address =
|
||||
(i->flags & CALL_TAIL) ? ics.return_address : ics.call_return_address;
|
||||
fn->Call(ics.thread_state, return_address);
|
||||
fn->Call(ics.thread_state);
|
||||
if (i->flags & CALL_TAIL) {
|
||||
return IA_RETURN;
|
||||
}
|
||||
@@ -647,19 +645,12 @@ int Translate_CALL_TRUE(TranslationContext& ctx, Instr* i) {
|
||||
uint32_t IntCode_CALL_INDIRECT_XX(IntCodeState& ics, const IntCode* i, uint32_t reg) {
|
||||
uint64_t target = ics.rf[reg].u32;
|
||||
|
||||
// Check if return address - if so, return.
|
||||
if (target == ics.return_address) {
|
||||
return IA_RETURN;
|
||||
}
|
||||
|
||||
// Real call.
|
||||
Function* fn = NULL;
|
||||
ics.thread_state->runtime()->ResolveFunction(target, &fn);
|
||||
XEASSERTNOTNULL(fn);
|
||||
// TODO(benvanik): proper tail call support, somehow.
|
||||
uint64_t return_address =
|
||||
(i->flags & CALL_TAIL) ? ics.return_address : ics.call_return_address;
|
||||
fn->Call(ics.thread_state, return_address);
|
||||
fn->Call(ics.thread_state);
|
||||
if (i->flags & CALL_TAIL) {
|
||||
return IA_RETURN;
|
||||
}
|
||||
@@ -777,14 +768,6 @@ int Translate_RETURN_TRUE(TranslationContext& ctx, Instr* i) {
|
||||
return DispatchToC(ctx, i, fns[i->src1.value->type]);
|
||||
}
|
||||
|
||||
uint32_t IntCode_SET_RETURN_ADDRESS(IntCodeState& ics, const IntCode* i) {
|
||||
ics.call_return_address = ics.rf[i->src1_reg].u32;
|
||||
return IA_NEXT;
|
||||
}
|
||||
int Translate_SET_RETURN_ADDRESS(TranslationContext& ctx, Instr* i) {
|
||||
return DispatchToC(ctx, i, IntCode_SET_RETURN_ADDRESS);
|
||||
}
|
||||
|
||||
uint32_t IntCode_BRANCH_XX(IntCodeState& ics, const IntCode* i, uint32_t reg) {
|
||||
return ics.rf[reg].u32;
|
||||
}
|
||||
@@ -4028,7 +4011,6 @@ static const TranslateFn dispatch_table[] = {
|
||||
Translate_CALL_INDIRECT_TRUE,
|
||||
Translate_RETURN,
|
||||
Translate_RETURN_TRUE,
|
||||
Translate_SET_RETURN_ADDRESS,
|
||||
|
||||
Translate_BRANCH,
|
||||
Translate_BRANCH_TRUE,
|
||||
|
||||
Reference in New Issue
Block a user