Skip to content

Commit

Permalink
Checkpoint for GC *after* saving object reference.
Browse files Browse the repository at this point in the history
It turns out, surprisingly enough, it's much easier to see the object we
are trying to trace if we put it where we can see it first.
  • Loading branch information
brixen committed Jan 26, 2020
1 parent 9473859 commit 02f6c52
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion machine/instructions/r_ret.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace rubinius {
call_frame->scope->flush_to_heap(state);
}

Object* obj = call_frame->return_value = RVAL(r0);
Object* obj = RVAL(r0);

if(obj->nil_p()) {
if(NIL_TAG_ID(obj) == 0) {
Expand All @@ -16,6 +16,8 @@ namespace rubinius {
}
}

call_frame->return_value = obj;

return reinterpret_cast<intptr_t>(obj);
}
}
Expand Down
4 changes: 3 additions & 1 deletion machine/instructions/ret.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace rubinius {
call_frame->scope->flush_to_heap(state);
}

Object* obj = call_frame->return_value = stack_top();
Object* obj = stack_top();

if(obj->nil_p()) {
if(NIL_TAG_ID(obj) == 0) {
Expand All @@ -16,6 +16,8 @@ namespace rubinius {
}
}

call_frame->return_value = obj;

return reinterpret_cast<intptr_t>(obj);
}
}
Expand Down
4 changes: 3 additions & 1 deletion machine/interpreter/r_ret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
namespace rubinius {
namespace interpreter {
intptr_t r_ret(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t value = instructions::r_ret(state, call_frame, argument(0));

state->vm()->checkpoint(state);

return instructions::r_ret(state, call_frame, argument(0));
return value;
}
}
}
4 changes: 3 additions & 1 deletion machine/interpreter/ret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
namespace rubinius {
namespace interpreter {
intptr_t ret(STATE, CallFrame* call_frame, intptr_t const opcodes[]) {
intptr_t value = instructions::ret(state, call_frame);

state->vm()->checkpoint(state);

return instructions::ret(state, call_frame);
return value;
}
}
}

0 comments on commit 02f6c52

Please sign in to comment.