Skip to content

Commit

Permalink
Further cleanup of legacy invocation handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jul 21, 2021
1 parent e0dc371 commit bfe32ed
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 59 deletions.
24 changes: 0 additions & 24 deletions src/core/frame.c
Expand Up @@ -371,14 +371,6 @@ void MVM_frame_setup_deopt(MVMThreadContext *tc, MVMFrame *frame, MVMStaticFrame
}
}

/* This exists to reduce the amount of pointer-fiddling that has to be
* done by the JIT */
void MVM_frame_invoke_code(MVMThreadContext *tc, MVMCode *code,
MVMCallsite *callsite, MVMint32 spesh_cand) {
MVM_frame_invoke(tc, code->body.sf, callsite, tc->cur_frame->args,
code->body.outer, (MVMObject*)code, spesh_cand);
}

/* Sets up storage for state variables. We do this after tc->cur_frame became
* the current frame, to make sure these new objects will certainly get marked
* if GC is triggered along the way. */
Expand Down Expand Up @@ -2028,22 +2020,6 @@ MVMObject * MVM_frame_find_invokee(MVMThreadContext *tc, MVMObject *code, MVMCal
return code;
}

MVM_USED_BY_JIT
MVMObject * MVM_frame_find_invokee_multi_ok(MVMThreadContext *tc, MVMObject *code,
MVMCallsite **tweak_cs, MVMRegister *args,
MVMuint16 *was_multi) {
if (!code)
MVM_exception_throw_adhoc(tc, "Cannot invoke null object");
if (STABLE(code)->invoke == MVM_6model_invoke_default) {
MVMInvocationSpec *is = STABLE(code)->invocation_spec;
if (!is) {
MVM_exception_throw_adhoc(tc, "Cannot invoke this object (REPR: %s; %s)", REPR(code)->name, MVM_6model_get_debug_name(tc, code));
}
code = find_invokee_internal(tc, code, tweak_cs, is);
}
return code;
}

/* Rapid resolution of an invokee. Used by the specialized resolve code op. */
MVMObject * MVM_frame_resolve_invokee_spesh(MVMThreadContext *tc, MVMObject *invokee) {
if (REPR(invokee)->ID == MVM_REPR_ID_MVMCode) {
Expand Down
3 changes: 0 additions & 3 deletions src/core/frame.h
Expand Up @@ -186,8 +186,6 @@ MVMFrame * MVM_frame_debugserver_move_to_heap(MVMThreadContext *tc, MVMThreadCon

MVMRegister * MVM_frame_initial_work(MVMThreadContext *tc, MVMuint16 *local_types,
MVMuint16 num_locals);
void MVM_frame_invoke_code(MVMThreadContext *tc, MVMCode *code,
MVMCallsite *callsite, MVMint32 spesh_cand);
void MVM_frame_invoke(MVMThreadContext *tc, MVMStaticFrame *static_frame,
MVMCallsite *callsite, MVMRegister *args,
MVMFrame *outer, MVMObject *code_ref, MVMint32 spesh_cand);
Expand Down Expand Up @@ -226,7 +224,6 @@ MVM_PUBLIC MVMRegister * MVM_frame_try_get_lexical(MVMThreadContext *tc, MVMFram
MVMuint16 MVM_frame_translate_to_primspec(MVMThreadContext *tc, MVMuint16 kind);
MVMuint16 MVM_frame_lexical_primspec(MVMThreadContext *tc, MVMFrame *f, MVMString *name);
MVM_PUBLIC MVMObject * MVM_frame_find_invokee(MVMThreadContext *tc, MVMObject *code, MVMCallsite **tweak_cs);
MVMObject * MVM_frame_find_invokee_multi_ok(MVMThreadContext *tc, MVMObject *code, MVMCallsite **tweak_cs, MVMRegister *args, MVMuint16 *was_multi);
MVMObject * MVM_frame_resolve_invokee_spesh(MVMThreadContext *tc, MVMObject *invokee);
MVMFrameExtra * MVM_frame_extra(MVMThreadContext *tc, MVMFrame *f);
MVM_PUBLIC void MVM_frame_special_return(MVMThreadContext *tc, MVMFrame *f,
Expand Down
32 changes: 1 addition & 31 deletions src/jit/x64/emit.dasc
Expand Up @@ -3161,37 +3161,7 @@ void MVM_jit_emit_invoke(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJitG
}
}

if (invoke->is_fast) {
/* call MVM_frame_invoke_code */
| mov ARG1, TC;
| mov ARG2, WORK[invoke->code_register_or_name];
| mov ARG3, TMP6; // this is the callsite object
| mov ARG4, invoke->spesh_cand_or_sf_slot;
| callp &MVM_frame_invoke_code;
} else {
/* first, save callsite and args */
| mov qword [rbp-0x28], TMP5; // args
| mov qword [rbp-0x30], TMP6; // callsite
/* setup call MVM_frame_multi_ok(tc, code, &cur_callsite, args); */
| mov ARG1, TC;
| mov ARG2, WORK[invoke->code_register_or_name]; // code object
| lea ARG3, [rbp-0x30]; // &cur_callsite
| mov ARG4, TMP5; // args
| mov ARG5, 0; // NULL to &was_multi
| callp &MVM_frame_find_invokee_multi_ok;
/* restore callsite, args, RV now holds code object */
| mov TMP6, [rbp-0x30]; // callsite
| mov TMP5, [rbp-0x28]; // args
/* setup args for call to invoke(tc, code, cur_callsite, args) */
| mov ARG1, TC;
| mov ARG2, RV; // code object
| mov ARG3, TMP6; // callsite
| mov ARG4, TMP5; // args
/* get the actual function */
| mov FUNCTION, OBJECT:RV->st;
| mov FUNCTION, STABLE:FUNCTION->invoke;
| call FUNCTION;
}
MVM_panic(1, "JIT needs updating for new-disp");
}

void MVM_jit_emit_jumplist(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJitGraph *jg,
Expand Down
1 change: 0 additions & 1 deletion tools/check-roots.py
Expand Up @@ -121,7 +121,6 @@
'MVM_frame_getdynlex',
'MVM_frame_getdynlex_with_frame_walker',
'MVM_frame_invoke',
'MVM_frame_invoke_code',
'MVM_frame_lexical_lookup_using_frame_walker',
'MVM_frame_move_to_heap',
'MVM_frame_takeclosure',
Expand Down

0 comments on commit bfe32ed

Please sign in to comment.