Skip to content

Commit

Permalink
Remove legacy special return mechanism
Browse files Browse the repository at this point in the history
In turn making the new one temporarily public, since a Rakudo extop
relies upon it.
  • Loading branch information
jnthn committed Nov 3, 2021
1 parent 6fcedf7 commit c1971ad
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 65 deletions.
2 changes: 1 addition & 1 deletion src/core/callstack.h
Expand Up @@ -380,7 +380,7 @@ MVMCallStackHeapFrame * MVM_callstack_allocate_heap_frame(MVMThreadContext *tc,
MVMuint32 work_size);
MVMint32 MVM_callstack_ensure_work_and_env_space(MVMThreadContext *tc, MVMuint32 needed_work,
MVMuint32 needed_env);
void * MVM_callstack_allocate_special_return(MVMThreadContext *tc,
MVM_PUBLIC void * MVM_callstack_allocate_special_return(MVMThreadContext *tc,
MVMSpecialReturn special_return, MVMSpecialReturn special_unwind,
MVMSpecialReturnMark mark_data, size_t data_size);
MVMCallStackDispatchRecord * MVM_callstack_allocate_dispatch_record(MVMThreadContext *tc);
Expand Down
39 changes: 0 additions & 39 deletions src/core/frame.c
Expand Up @@ -903,32 +903,6 @@ static MVMuint64 remove_one_frame(MVMThreadContext *tc, MVMuint8 unwind) {

/* Switch back to the caller frame if there is one. */
if (caller && (returner != tc->thread_entry_frame || tc->nested_interpreter)) {
/* Handle any special return hooks. */
if (caller->extra) {
MVMFrameExtra *e = caller->extra;
if (e->special_return || e->special_unwind) {
MVMSpecialReturn sr = e->special_return;
MVMSpecialReturn su = e->special_unwind;
void *srd = e->special_return_data;
e->special_return = NULL;
e->special_unwind = NULL;
e->special_return_data = NULL;
e->mark_special_return_data = NULL;
if (unwind && su)
su(tc, srd);
else if (!unwind && sr)
sr(tc, srd);
/* The special_return or special_unwind handler may schedule a
finalizer call for the current runloop. If we are already in
the top most call frame of the runloop, we need to replace
the thread_entry_frame with the finalizer call. Otherwise we
won't run the special code for ending the runloop when the
finalizer returns. */
if (returner == tc->thread_entry_frame && tc->cur_frame != caller)
tc->thread_entry_frame = tc->cur_frame;
}
}

if (returner == tc->thread_entry_frame && tc->cur_frame == caller) {
tc->cur_frame = NULL;
return 0;
Expand Down Expand Up @@ -1757,19 +1731,6 @@ MVMFrameExtra * MVM_frame_extra(MVMThreadContext *tc, MVMFrame *f) {
return f->extra;
}

/* Set up special return data on a frame. */
void MVM_frame_special_return(MVMThreadContext *tc, MVMFrame *f,
MVMSpecialReturn special_return,
MVMSpecialReturn special_unwind,
void *special_return_data,
MVMSpecialReturnDataMark mark_special_return_data) {
MVMFrameExtra *e = MVM_frame_extra(tc, f);
e->special_return = special_return;
e->special_unwind = special_unwind;
e->special_return_data = special_return_data;
e->mark_special_return_data = mark_special_return_data;
}

/* Gets the code object of the caller, provided there is one. Works even in
* the face that the caller was an inline (however, the current frame that is
* using the op must not be itself inlined). */
Expand Down
19 changes: 0 additions & 19 deletions src/core/frame.h
Expand Up @@ -13,8 +13,6 @@
typedef void (* MVMSpecialReturn)(MVMThreadContext *tc, void *data);

/* Function pointer for marking the special return handler data. */
typedef void (* MVMSpecialReturnDataMark)(MVMThreadContext *tc, MVMFrame *frame,
MVMGCWorklist *worklist); /* XXX Legacy */
typedef void (* MVMSpecialReturnMark)(MVMThreadContext *tc, void *data,
MVMGCWorklist *worklist);

Expand Down Expand Up @@ -96,20 +94,6 @@ struct MVMFrame {
/* Extra data that a handful of call frames optionally need. It is needed
* only while the frame is in dynamic scope; after that it can go away. */
struct MVMFrameExtra {
/* If we want to invoke a special handler upon a return to this
* frame, this function pointer is set. */
MVMSpecialReturn special_return;

/* If we want to invoke a special handler upon unwinding past a
* frame, this function pointer is set. */
MVMSpecialReturn special_unwind;

/* Data slot for the special return handler function. */
void *special_return_data;

/* Flag for if special_return_data need to be GC marked. */
MVMSpecialReturnDataMark mark_special_return_data;

/* Cache for dynlex lookup; if the name is non-null, the cache is valid
* and the register can be accessed directly to find the contextual. */
MVMString *dynlex_cache_name;
Expand Down Expand Up @@ -199,7 +183,4 @@ 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);
MVMFrameExtra * MVM_frame_extra(MVMThreadContext *tc, MVMFrame *f);
MVM_PUBLIC void MVM_frame_special_return(MVMThreadContext *tc, MVMFrame *f,
MVMSpecialReturn special_return, MVMSpecialReturn special_unwind,
void *special_return_data, MVMSpecialReturnDataMark mark_special_return_data);
MVMObject * MVM_frame_caller_code(MVMThreadContext *tc);
2 changes: 0 additions & 2 deletions src/gc/roots.c
Expand Up @@ -420,8 +420,6 @@ void MVM_gc_root_add_frame_roots_to_worklist(MVMThreadContext *tc, MVMGCWorklist
/* Mark frame extras if needed. */
if (cur_frame->extra) {
MVMFrameExtra *e = cur_frame->extra;
if (e->special_return_data && e->mark_special_return_data)
e->mark_special_return_data(tc, cur_frame, worklist);
if (e->dynlex_cache_name)
MVM_gc_worklist_add(tc, worklist, &e->dynlex_cache_name);
MVM_gc_worklist_add(tc, worklist, &e->exit_handler_result);
Expand Down
4 changes: 0 additions & 4 deletions src/profiler/heapsnapshot.c
Expand Up @@ -614,10 +614,6 @@ static void process_workitems(MVMThreadContext *tc, MVMHeapSnapshotState *ss) {

if (frame->extra) {
MVMFrameExtra *e = frame->extra;
if (e->special_return_data && e->mark_special_return_data) {
e->mark_special_return_data(tc, frame, ss->gcwl);
process_gc_worklist(tc, ss, "Special return data");
}
MVM_profile_heap_add_collectable_rel_const_cstr(tc, ss,
(MVMCollectable *)e->dynlex_cache_name,
"Dynamic lexical cache name");
Expand Down

0 comments on commit c1971ad

Please sign in to comment.