Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 938a43458dc4
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 76f20920ab37
Choose a head ref
  • 8 commits
  • 20 files changed
  • 2 contributors

Commits on Apr 28, 2016

  1. Copy the full SHA
    5740c64 View commit details

Commits on Apr 29, 2016

  1. Copy the full SHA
    8ca90dd View commit details

Commits on Apr 30, 2016

  1. Copy the full SHA
    f039d0a View commit details
  2. Merge branch 'block_nested_arg' of https://github.com/rideliner/rubinius

     into rideliner-block_nested_arg
    brixen committed Apr 30, 2016
    Copy the full SHA
    55eb5d7 View commit details
  3. Copy the full SHA
    6cc1a5a View commit details
  4. Merge branch 'block_arg_overlooked' of https://github.com/rideliner/r…

    …ubinius into rideliner-block_arg_overlooked
    brixen committed Apr 30, 2016
    Copy the full SHA
    1fb794a View commit details
  5. Copy the full SHA
    2c31002 View commit details
  6. Updated rubinius-ast version.

    brixen committed Apr 30, 2016
    Copy the full SHA
    76f2092 View commit details
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ GEM
daedalus-core (0.5.0)
rake (10.5.0)
redcard (1.1.0)
rubinius-ast (3.4)
rubinius-ast (3.5)
rubinius-bridge (2.2)
redcard (~> 1.0)
rubinius-code (3.0)
2 changes: 1 addition & 1 deletion gems_list.txt
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ rake-10.5.0.gem
rb-readline-0.5.3.gem
rdoc-4.2.2.gem
redcard-1.1.0.gem
rubinius-ast-3.4.gem
rubinius-ast-3.5.gem
rubinius-bridge-2.2.gem
rubinius-code-3.0.gem
rubinius-compiler-3.3.gem
4 changes: 3 additions & 1 deletion machine/builtin/block_environment.cpp
Original file line number Diff line number Diff line change
@@ -445,7 +445,9 @@ namespace rubinius {
call_frame->flags = invocation.flags | CallFrame::cMultipleScopes
| CallFrame::cBlock;

state->vm()->push_call_frame(call_frame, previous_frame);
if(!state->vm()->push_call_frame(state, call_frame, previous_frame)) {
return NULL;
}

Object* value = NULL;

2 changes: 1 addition & 1 deletion machine/builtin/fiber.cpp
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ namespace rubinius {

// TODO: CallFrame: return from this function

assert(0 && "fatal start_on_stack error");
rubinius::bug("returning from Fiber::start_on_stack");
#else
rubinius::bug("Fibers not supported on this platform");
#endif
8 changes: 2 additions & 6 deletions machine/builtin/fiber.hpp
Original file line number Diff line number Diff line change
@@ -69,16 +69,12 @@ namespace rubinius {
return data()->machine();
}

void* stack_region() const {
return data()->stack_address();
}

void* stack_end() const {
void* stack_address() const {
return data()->stack_address();
}

void* stack_start() const {
return (void*)((uintptr_t)stack_region() + stack_size());
return (void*)((uintptr_t)stack_address() + stack_size());
}

int stack_size() const {
10 changes: 1 addition & 9 deletions machine/builtin/native_function.cpp
Original file line number Diff line number Diff line change
@@ -326,8 +326,6 @@ namespace rubinius {
FFIData* stub = reinterpret_cast<FFIData*>(user_data);

bool destroy_vm = false;
int stack_address = 0;

if(!env) {
// TODO: fix this, the threads should *always* be set up correctly
// Apparently we're running in a new thread here, setup
@@ -336,13 +334,7 @@ namespace rubinius {

VM* vm = stub->shared->thread_nexus()->new_vm(stub->shared, "ruby.ffi");

// Detect the stack size and set it up in the VM object
size_t stack_size;
pthread_attr_t attrs;
pthread_attr_init(&attrs);
pthread_attr_getstacksize (&attrs, &stack_size);
pthread_attr_destroy(&attrs);
vm->set_root_stack(reinterpret_cast<uintptr_t>(&stack_address), stack_size);
vm->set_stack_bounds(THREAD_STACK_SIZE);

// Setup nativemethod handles into thread local
State state(vm);
4 changes: 3 additions & 1 deletion machine/builtin/native_method.cpp
Original file line number Diff line number Diff line change
@@ -676,7 +676,9 @@ namespace rubinius {
env->set_current_native_frame(&nmf);

// Register the CallFrame, because we might GC below this.
state->vm()->push_call_frame(call_frame, previous_frame);
if(!state->vm()->push_call_frame(state, call_frame, previous_frame)) {
return NULL;
}

// Be sure to do this after installing nmf as the current
// native frame.
4 changes: 1 addition & 3 deletions machine/builtin/thread.cpp
Original file line number Diff line number Diff line change
@@ -358,6 +358,7 @@ namespace rubinius {
VM* vm = reinterpret_cast<VM*>(ptr);
State state_obj(vm), *state = &state_obj;

vm->set_stack_bounds(THREAD_STACK_SIZE);
vm->set_current_thread();

RUBINIUS_THREAD_START(
@@ -369,9 +370,6 @@ namespace rubinius {
vm->name().c_str(), vm->thread->pid()->to_native(),
(unsigned int)thread_debug_self());

int stack_address = 0;
vm->set_root_stack(reinterpret_cast<uintptr_t>(&stack_address), THREAD_STACK_SIZE);

NativeMethod::init_thread(state);

state->vm()->become_managed();
15 changes: 7 additions & 8 deletions machine/capi/capi.cpp
Original file line number Diff line number Diff line change
@@ -51,8 +51,10 @@ namespace rubinius {
return map[type];
}

bool capi_check_interrupts(STATE, void* stack_marker) {
if(!state->check_stack(state, stack_marker)) {
bool capi_check_interrupts(STATE) {
void* stack_address;

if(!state->vm()->check_stack(state, &stack_address)) {
return false;
}

@@ -115,8 +117,7 @@ namespace rubinius {
Object** args, Object* block,
bool allow_private)
{
int stack_marker = 0;
if(!capi_check_interrupts(env->state(), &stack_marker)) {
if(!capi_check_interrupts(env->state())) {
env->current_ep()->return_to(env);
}

@@ -208,8 +209,7 @@ namespace rubinius {
Object* blk,
size_t arg_count, Object** arg_vals)
{
int stack_marker = 0;
if(!capi_check_interrupts(env->state(), &stack_marker)) {
if(!capi_check_interrupts(env->state())) {
env->current_ep()->return_to(env);
}

@@ -258,8 +258,7 @@ namespace rubinius {
VALUE capi_call_super_native(NativeMethodEnvironment* env,
size_t arg_count, Object** args)
{
int stack_marker = 0;
if(!capi_check_interrupts(env->state(), &stack_marker)) {
if(!capi_check_interrupts(env->state())) {
env->current_ep()->return_to(env);
}

16 changes: 10 additions & 6 deletions machine/environment.cpp
Original file line number Diff line number Diff line change
@@ -95,8 +95,6 @@ namespace rubinius {

String::init_hash();

VM::init_stack_size();

copy_argv(argc, argv);
ruby_init_setproctitle(argc, argv);

@@ -110,9 +108,14 @@ namespace rubinius {
root_vm->set_main_thread();
shared->set_root_vm(root_vm);

int stack_address = 0;
root_vm->set_root_stack(
reinterpret_cast<uintptr_t>(&stack_address), VM::cStackDepthMax);
size_t stack_size = THREAD_STACK_SIZE;
struct rlimit rlim;

if(getrlimit(RLIMIT_STACK, &rlim) == 0) {
stack_size = rlim.rlim_cur;
}

root_vm->set_stack_bounds(stack_size);
root_vm->set_current_thread();

state = new State(root_vm);
@@ -822,8 +825,9 @@ namespace rubinius {

// Start signal handling. We don't return until the process is exiting.
VM* vm = SignalThread::new_vm(state);
State main_state(vm);
vm->set_stack_bounds(state->vm()->stack_size());

State main_state(vm);
state->shared().start_signals(&main_state);
}
}
3 changes: 1 addition & 2 deletions machine/internal_threads.cpp
Original file line number Diff line number Diff line change
@@ -33,8 +33,7 @@ namespace rubinius {
RUBINIUS_THREAD_START(
const_cast<RBX_DTRACE_CHAR_P>(vm->name().c_str()), vm->thread_id(), 1);

int stack_address = 0;
vm->set_root_stack(reinterpret_cast<uintptr_t>(&stack_address), thread->stack_size_);
vm->set_stack_bounds(thread->stack_size_);

NativeMethod::init_thread(state);

8 changes: 4 additions & 4 deletions machine/jit/llvm/util.cpp
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ extern "C" {
entry->~MethodEntry();
}

void rbx_method_frame_initialize(STATE, CallFrame* call_frame,
bool rbx_method_frame_initialize(STATE, CallFrame* call_frame,
StackVariables* scope, Executable* exec, Module* mod, Arguments* args)
{
CompiledCode* code = as<CompiledCode>(exec);
@@ -135,10 +135,10 @@ extern "C" {
call_frame->arguments = args;

CallFrame* previous;
state->vm()->push_call_frame(call_frame, previous);
return state->vm()->push_call_frame(state, call_frame, previous);
}

void rbx_block_frame_initialize(STATE,
bool rbx_block_frame_initialize(STATE,
CallFrame* call_frame, StackVariables* scope,
BlockEnvironment* env, Arguments* args, BlockInvocation* invocation)
{
@@ -175,7 +175,7 @@ extern "C" {
| CallFrame::cJITed;

CallFrame* previous;
state->vm()->push_call_frame(call_frame, previous);
return state->vm()->push_call_frame(state, call_frame, previous);
}

void rbx_pop_call_frame(STATE) {
8 changes: 6 additions & 2 deletions machine/machine_code.cpp
Original file line number Diff line number Diff line change
@@ -767,7 +767,9 @@ namespace rubinius {
call_frame->scope = scope;
call_frame->arguments = &args;

state->vm()->push_call_frame(call_frame, previous_frame);
if(!state->vm()->push_call_frame(state, call_frame, previous_frame)) {
return NULL;
}

#ifdef ENABLE_LLVM
// A negative call_count means we've disabled usage based JIT
@@ -851,7 +853,9 @@ namespace rubinius {
call_frame->scope = scope;
call_frame->arguments = &args;

state->vm()->push_call_frame(call_frame, previous_frame);
if(!state->vm()->push_call_frame(state, call_frame, previous_frame)) {
return NULL;
}

// Do NOT check if we should JIT this. We NEVER want to jit a script.

24 changes: 13 additions & 11 deletions machine/memory/finalizer.cpp
Original file line number Diff line number Diff line change
@@ -213,22 +213,24 @@ namespace memory {
env->set_current_native_frame(&nmf);

// Register the CallFrame, because we might GC below this.
state->vm()->push_call_frame(call_frame, previous_frame);
if(state->vm()->push_call_frame(state, call_frame, previous_frame)) {
nmf.setup(Qnil, Qnil, Qnil, Qnil);

nmf.setup(Qnil, Qnil, Qnil, Qnil);
PLACE_EXCEPTION_POINT(ep);

PLACE_EXCEPTION_POINT(ep);
if(unlikely(ep.jumped_to())) {
logger::warn(
"finalizer: an exception occurred running a NativeMethod finalizer");
} else {
(*process_item_->finalizer)(state, process_item_->object);
}

if(unlikely(ep.jumped_to())) {
logger::warn(
"finalizer: an exception occurred running a NativeMethod finalizer");
state->vm()->pop_call_frame(previous_frame);
env->set_current_call_frame(0);
env->set_current_native_frame(0);
} else {
(*process_item_->finalizer)(state, process_item_->object);
logger::warn("finalizer: stack error");
}

state->vm()->pop_call_frame(previous_frame);
env->set_current_call_frame(0);
env->set_current_native_frame(0);
}
}
process_item_->status = FinalizeObject::eNativeFinalized;
5 changes: 1 addition & 4 deletions machine/signal.cpp
Original file line number Diff line number Diff line change
@@ -165,15 +165,12 @@ namespace rubinius {

State state_obj(vm), *state = &state_obj;

vm->set_stack_bounds(THREAD_STACK_SIZE);
vm->set_current_thread();

RUBINIUS_THREAD_START(
const_cast<RBX_DTRACE_CHAR_P>(vm->name().c_str()), vm->thread_id(), 1);

int stack_address = 0;
vm->set_root_stack(
reinterpret_cast<uintptr_t>(&stack_address), SignalThread::stack_size);

NativeMethod::init_thread(state);

thread->run(state);
10 changes: 0 additions & 10 deletions machine/state.cpp
Original file line number Diff line number Diff line change
@@ -51,16 +51,6 @@ namespace rubinius {
}

bool State::check_interrupts(STATE) {
// 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.
int stack_marker = 0;
if(!check_stack(state, &stack_marker)) return false;

if(unlikely(check_local_interrupts())) {
if(!process_async(state)) return false;
}
13 changes: 0 additions & 13 deletions machine/state.hpp
Original file line number Diff line number Diff line change
@@ -93,10 +93,6 @@ namespace rubinius {
return shared_;
}

bool detect_stack_condition(void* end) const {
return vm_->detect_stack_condition(end);
}

bool check_local_interrupts() const {
return vm_jit_->check_local_interrupts_;
}
@@ -110,15 +106,6 @@ namespace rubinius {

void raise_stack_error(STATE);

bool check_stack(STATE, void* end) {
// @TODO assumes stack growth direction
if(unlikely(vm_->detect_stack_condition(end))) {
raise_stack_error(state);
return false;
}
return true;
}

bool process_async(STATE);
bool check_interrupts(STATE);

Loading