Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 29 lines (23 sloc) 0.697 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#include <setjmp.h>

#include "config.h"
#include "exception_point.hpp"
#include "builtin/native_method.hpp"
#include "windows_compat.h"

namespace rubinius {
  ExceptionPoint::ExceptionPoint(NativeMethodEnvironment* env)
    : jumped_to_(false)
    , previous_(env->current_ep())
  {
    env->set_current_ep(this);
  }

  void ExceptionPoint::return_to(NativeMethodEnvironment* env) {
    jumped_to_ = true;
    env->set_current_ep(this);
    long_jump(__jump_buffer, 1);

    // If control reaches here, longjmp failed, i.e. disaster.
    rubinius::bug("ExceptionPoint return_to failed");
  }

  void ExceptionPoint::pop(NativeMethodEnvironment* env) {
    env->set_current_ep(previous_);
  }
}
Something went wrong with that request. Please try again.