Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

94 lines (75 sloc) 2.761 kb
#include "vm.hpp"
#include "builtin/exception.hpp"
#include "builtin/location.hpp"
#include "builtin/array.hpp"
#include "signal.hpp"
#include "call_frame.hpp"
#include "helpers.hpp"
#include "park.hpp"
namespace rubinius {
void State::raise_stack_error(CallFrame* call_frame) {
Class* stack_error = globals().stack_error.get();
Exception* exc = new_object<Exception>(stack_error);
exc->locations(this, Location::from_call_stack(this, call_frame));
bool State::process_async(CallFrame* call_frame) {
vm_->check_local_interrupts = false;
if(vm_->run_signals_) {
if(!vm_->shared.signal_handler()->deliver_signals(this, call_frame)) {
return false;
Exception* exc = vm_->interrupted_exception_.get();
if(!exc->nil_p()) {
// Only write the locations if there are none.
if(exc->locations()->nil_p() || exc->locations()->size() == 0) {
exc->locations(this, Location::from_call_stack(this, call_frame));
return false;
if(vm_->interrupt_by_kill_) {
vm_->interrupt_by_kill_ = false;
return false;
return true;
void State::check_exception(CallFrame* call_frame) {
if(vm_->thread_state()->raise_reason() == cNone) {
std::cout << "Exception propagating, but none registered!\n";
bool State::check_interrupts(GCToken gct, CallFrame* call_frame, void* end) {
// First, we might be here because someone reset the stack_limit_ so that
// we'd fall into here to check interrupts even if the stack is fine,
// So fix up the stack_limit_ if thats the case first.
// If this is true, stack_limit_ was just changed to get our attention, reset
// it now.
if(vm_->stack_limit_ == vm_->stack_start_) {
} else {
if(!check_stack(call_frame, end)) return false;
if(unlikely(vm_->check_local_interrupts)) {
if(!process_async(call_frame)) return false;
// If the current thread is trying to step, debugger wise, then assist!
if(vm_->thread_step()) {
if(!Helpers::yield_debugger(this, gct, call_frame, cNil)) return false;
return true;
Object* State::park(GCToken gct, CallFrame* call_frame) {
return vm_->park_->park(this, call_frame);
Object* State::park_timed(GCToken gct, CallFrame* call_frame, struct timespec* ts) {
return vm_->park_->park_timed(this, call_frame, ts);
Jump to Line
Something went wrong with that request. Please try again.