Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created May 5, 2016 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/38fbd0a7628465f79c3ea3386fce8fec to your computer and use it in GitHub Desktop.
Save jnthn/38fbd0a7628465f79c3ea3386fce8fec to your computer and use it in GitHub Desktop.
diff --git a/src/core/frame.c b/src/core/frame.c
index 162e8c0..763d473 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -946,6 +946,8 @@ void MVM_frame_unwind_to(MVMThreadContext *tc, MVMFrame *frame, MVMuint8 *abs_ad
cur_frame->mark_special_return_data = mark_unwind_data;
{
MVMUnwindData *ud = MVM_malloc(sizeof(MVMUnwindData));
+if (MVM_FRAME_IS_ON_CALLSTACK(tc, frame))
+ MVM_panic(1, "Stacked frame!!");
ud->frame = frame;
ud->abs_addr = abs_addr;
ud->rel_addr = rel_addr;
diff --git a/src/gc/wb.h b/src/gc/wb.h
index 92a3c24..9a0616d 100644
--- a/src/gc/wb.h
+++ b/src/gc/wb.h
@@ -16,6 +16,8 @@ MVM_STATIC_INLINE void MVM_gc_write_barrier(MVMThreadContext *tc, MVMCollectable
#define MVM_ASSIGN_REF(tc, update_root, update_addr, referenced) \
{ \
void *_r = referenced; \
+ if (_r && ((MVMCollectable *)_r)->owner == 0) \
+ MVM_panic(1, "Invalid assignment (maybe of heap frame to stack frame?)"); \
MVM_gc_write_barrier(tc, update_root, (MVMCollectable *)_r); \
update_addr = _r; \
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment