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: 09a0ed376c2c
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 69dd9ad2cf11
Choose a head ref
  • 3 commits
  • 7 files changed
  • 1 contributor

Commits on Mar 13, 2016

  1. More fixes for Fiber.

    brixen committed Mar 13, 2016
    Copy the full SHA
    9bd89f3 View commit details
  2. Copy the full SHA
    74aa26c View commit details
  3. Copy the full SHA
    69dd9ad View commit details
13 changes: 5 additions & 8 deletions machine/builtin/fiber.cpp
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@ namespace rubinius {
fib->status_ = Fiber::eRunning;

fib->data_ = state->vm()->new_fiber_data(true);
fib->data_->set_call_frame(state->vm()->call_frame());

state->memory()->needs_finalization(fib,
(memory::FinalizerFunction)&Fiber::finalize,
@@ -69,7 +70,7 @@ namespace rubinius {
fib = Fiber::current(state);
fib->status_ = Fiber::eDead;
fib->dead_ = cTrue;
fib->set_call_frame(0);
fib->set_call_frame(state, 0);

Fiber* dest = fib->prev();

@@ -107,7 +108,6 @@ namespace rubinius {
#ifdef RBX_FIBER_ENABLED
Fiber* fib = state->memory()->new_object<Fiber>(state, as<Class>(self));
fib->starter(state, callable);
fib->status_ = Fiber::eSleeping;

state->memory()->needs_finalization(fib,
(memory::FinalizerFunction)&Fiber::finalize,
@@ -143,7 +143,7 @@ namespace rubinius {
Fiber* cur = Fiber::current(state);
prev(state, cur);

cur->sleep(state->vm()->call_frame());
cur->sleep(state);

run(state);

@@ -154,7 +154,6 @@ namespace rubinius {
// can't be accessed.

cur = Fiber::current(state);
state->vm()->set_call_frame(cur->call_frame());

if(!cur->exception()->nil_p()) {
state->raise_exception(cur->exception());
@@ -199,7 +198,7 @@ namespace rubinius {

prev(state, root);

cur->sleep(state->vm()->call_frame());
cur->sleep(state);

run(state);

@@ -210,7 +209,6 @@ namespace rubinius {
// can't be accessed.

cur = Fiber::current(state);
state->vm()->set_call_frame(cur->call_frame());

if(!cur->exception()->nil_p()) {
state->raise_exception(cur->exception());
@@ -248,7 +246,7 @@ namespace rubinius {
Array* val = args.as_array(state);
dest_fib->value(state, val);

cur->sleep(state->vm()->call_frame());
cur->sleep(state);

dest_fib->run(state);

@@ -259,7 +257,6 @@ namespace rubinius {
// can't be accessed.

cur = Fiber::current(state);
state->vm()->set_call_frame(cur->call_frame());

Array* ret = cur->value();

27 changes: 15 additions & 12 deletions machine/builtin/fiber.hpp
Original file line number Diff line number Diff line change
@@ -45,28 +45,31 @@ namespace rubinius {
return root_;
}

CallFrame* call_frame() const {
if(!data_) return 0;
CallFrame* call_frame(STATE) const {
if(!data_) Exception::raise_fiber_error(state, "corrupt Fiber");

return data_->call_frame();
}

void set_call_frame(CallFrame* call_frame) {
if(data_) {
data_->set_call_frame(call_frame);
}
}
void set_call_frame(STATE, CallFrame* call_frame) {
if(!data_) Exception::raise_fiber_error(state, "corrupt Fiber");

void sleep(CallFrame* call_frame) {
if(call_frame && !data_) rubinius::bug("bad fiber");
data_->set_call_frame(call_frame);
}

void sleep(STATE) {
if(!data_) Exception::raise_fiber_error(state, "corrupt Fiber");

data_->set_call_frame(state->vm()->call_frame());
status_ = eSleeping;
}

void run(STATE) {
if(!data_) Exception::raise_fiber_error(state, "corrupt Fiber");

state->vm()->set_current_fiber(this);
if(data_) {
state->vm()->set_call_frame(data_->call_frame());
}
state->vm()->set_call_frame(data_->call_frame());
data_->set_call_frame(0);
status_ = eRunning;
}

4 changes: 2 additions & 2 deletions machine/builtin/location.cpp
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ namespace rubinius {
return loc;
}

Array* Location::from_call_stack(STATE, bool include_vars, bool on_ip, size_t up) {
Array* Location::from_call_stack(STATE, bool include_vars, bool on_ip, ssize_t up) {
CallFrame* frame = state->vm()->call_frame();

while(frame && up-- > 0) {
@@ -131,7 +131,7 @@ namespace rubinius {
return array;
}

Array* Location::mri_backtrace(STATE, size_t up) {
Array* Location::mri_backtrace(STATE, ssize_t up) {
CallFrame* frame = state->vm()->call_frame();

while(frame && up-- > 0) {
4 changes: 2 additions & 2 deletions machine/builtin/location.hpp
Original file line number Diff line number Diff line change
@@ -72,8 +72,8 @@ namespace rubinius {
static Location* of_closest_ruby_method(STATE);

static Array* from_call_stack(STATE,
bool include_vars=false, bool on_ip=false, size_t up=1);
static Array* mri_backtrace(STATE, size_t up=1);
bool include_vars=false, bool on_ip=false, ssize_t up=1);
static Array* mri_backtrace(STATE, ssize_t up=1);

class Info : public TypeInfo {
public:
6 changes: 1 addition & 5 deletions mspec/lib/mspec/helpers/ruby_exe.rb
Original file line number Diff line number Diff line change
@@ -77,11 +77,7 @@ def ruby_exe_options(option)
when :engine
case RUBY_NAME
when 'rbx'
if SpecGuard.ruby_version < "1.9"
"bin/rbx"
else
"bin/rbx -X19"
end
"bin/rbx"
when 'jruby'
"bin/jruby"
when 'maglev'
8 changes: 0 additions & 8 deletions mspec/lib/mspec/utils/options.rb
Original file line number Diff line number Diff line change
@@ -211,16 +211,8 @@ def targets
case t
when 'r', 'ruby'
config[:target] = 'ruby'
when 'r19', 'ruby19'
config[:target] = 'ruby1.9'
when 'x', 'rubinius'
config[:target] = './bin/rbx'
when 'x18', 'rubinius18'
config[:target] = './bin/rbx -X18'
when 'x19', 'rubinius19'
config[:target] = './bin/rbx -X19'
when 'x20', 'rubinius20'
config[:target] = './bin/rbx -X20'
when 'X', 'rbx'
config[:target] = 'rbx'
when 'j', 'jruby'
24 changes: 0 additions & 24 deletions mspec/spec/helpers/ruby_exe_spec.rb
Original file line number Diff line number Diff line change
@@ -63,30 +63,6 @@ class RubyExeSpecs
name = File.join RbConfig::CONFIG['bindir'], bin
@script.ruby_exe_options(:install_name).should == name
end

describe "under Rubinius" do
before :each do
@ruby_version = RUBY_VERSION
end

after :each do
Object.const_set :RUBY_VERSION, @ruby_version
end

it "returns 'bin/rbx' when passed :engine, RUBY_NAME is 'rbx' and RUBY_VERSION < 1.9" do
Object.const_set :RUBY_VERSION, "1.8.7"
Object.const_set :RUBY_NAME, 'rbx'

@script.ruby_exe_options(:engine).should == 'bin/rbx'
end

it "returns 'bin/rbx -X19' when passed :engine, RUBY_NAME is 'rbx' and RUBY_VERSION >= 1.9" do
Object.const_set :RUBY_VERSION, "1.9.2"
Object.const_set :RUBY_NAME, 'rbx'

@script.ruby_exe_options(:engine).should == 'bin/rbx -X19'
end
end
end

describe "#resolve_ruby_exe" do