Skip to content

Commit

Permalink
Cleanup of using stack attention
Browse files Browse the repository at this point in the history
The previous change still had the stack check at the beginning of a
compiled code which caused the problems with the debugger. This change
properly removes all these checks.
  • Loading branch information
dbussink committed Jan 23, 2013
1 parent 47e70d1 commit 5aedf3b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 28 deletions.
4 changes: 1 addition & 3 deletions vm/builtin/block_environment.cpp
Expand Up @@ -319,9 +319,7 @@ namespace rubinius {

GCTokenImpl gct;

if(state->detect_stack_condition(frame)) {
if(!state->check_interrupts(gct, frame, frame)) return NULL;
}
if(!state->check_interrupts(gct, frame, frame)) return NULL;

state->checkpoint(gct, frame);

Expand Down
2 changes: 1 addition & 1 deletion vm/helpers.cpp
Expand Up @@ -354,7 +354,7 @@ namespace rubinius {

// Process a few commands...
if(ret == state->symbol("step")) {
state->vm()->get_attention();
state->vm()->set_check_local_interrupts();
state->vm()->set_thread_step();
}

Expand Down
8 changes: 2 additions & 6 deletions vm/machine_code.cpp
Expand Up @@ -617,9 +617,7 @@ namespace rubinius {

// Check the stack and interrupts here rather than in the interpreter
// loop itself.
if(state->detect_stack_condition(frame)) {
if(!state->check_interrupts(gct, frame, frame)) return NULL;
}
if(!state->check_interrupts(gct, frame, frame)) return NULL;

state->checkpoint(gct, frame);

Expand Down Expand Up @@ -675,9 +673,7 @@ namespace rubinius {

GCTokenImpl gct;

if(state->detect_stack_condition(frame)) {
if(!state->check_interrupts(gct, frame, frame)) return NULL;
}
if(!state->check_interrupts(gct, frame, frame)) return NULL;

state->checkpoint(gct, frame);

Expand Down
1 change: 0 additions & 1 deletion vm/signal.cpp
Expand Up @@ -171,7 +171,6 @@ namespace rubinius {

{
target_->set_check_local_interrupts();
target_->get_attention();
target_->wakeup(state, gct);
}
}
Expand Down
10 changes: 3 additions & 7 deletions vm/state.hpp
Expand Up @@ -102,13 +102,9 @@ namespace rubinius {

bool check_stack(CallFrame* call_frame, void* end) {
// @TODO assumes stack growth direction
if(vm_->at_stack_limit()) {
vm_->reset_stack_limit();
} else {
if(unlikely(vm_->detect_stack_condition(end))) {
raise_stack_error(call_frame);
return false;
}
if(unlikely(vm_->detect_stack_condition(end))) {
raise_stack_error(call_frame);
return false;
}
return true;
}
Expand Down
2 changes: 0 additions & 2 deletions vm/vm.cpp
Expand Up @@ -425,14 +425,12 @@ namespace rubinius {
SYNC(state);
interrupted_exception_.set(exc);
set_check_local_interrupts();
get_attention();
}

void VM::register_kill(STATE) {
SYNC(state);
set_interrupt_by_kill();
set_check_local_interrupts();
get_attention();
}

void VM::set_current_fiber(Fiber* fib) {
Expand Down
8 changes: 0 additions & 8 deletions vm/vm.hpp
Expand Up @@ -202,14 +202,6 @@ namespace rubinius {
set_stack_bounds(root_stack_start_, root_stack_size_);
}

void get_attention() {
vm_jit_.stack_limit_ = vm_jit_.stack_start_;
}

bool at_stack_limit() {
return vm_jit_.stack_limit_ == vm_jit_.stack_start_;
}

bool detect_stack_condition(void* end) {
// @TODO assumes stack growth direction
return reinterpret_cast<uintptr_t>(end) < vm_jit_.stack_limit_;
Expand Down

0 comments on commit 5aedf3b

Please sign in to comment.