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: 40f4f6c57e56
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 97c331d2a7b7
Choose a head ref
  • 6 commits
  • 8 files changed
  • 2 contributors

Commits on Feb 12, 2016

  1. Copy the full SHA
    1e493bf View commit details
  2. Copy the full SHA
    19cd62b View commit details

Commits on Apr 6, 2016

  1. Merge branch 'fix/zsuper-keyword-args' of https://github.com/ahmadshe…

    …rif/rubinius into ahmadsherif-fix/zsuper-keyword-args
    brixen committed Apr 6, 2016
    Copy the full SHA
    744905d View commit details
  2. Copy the full SHA
    a119b4a View commit details
  3. Copy the full SHA
    8fb059d View commit details
  4. Updated Melbourne version.

    brixen committed Apr 6, 2016
    Copy the full SHA
    97c331d View commit details
Showing with 50 additions and 5 deletions.
  1. +1 −1 Gemfile.lock
  2. +1 −1 gems_list.txt
  3. +18 −1 machine/instructions.def
  4. +4 −0 machine/machine_code.cpp
  5. +1 −0 machine/machine_code.hpp
  6. +24 −0 spec/jit/method_spec.rb
  7. +1 −0 spec/tags/jit/method_tags.txt
  8. +0 −2 spec/tags/ruby/language/super_tags.txt
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ GEM
rubinius-toolset (~> 3)
rubinius-compiler (3.1)
rubinius-instructions (3.0)
rubinius-melbourne (3.4)
rubinius-melbourne (3.5)
rubinius-processor (3.0)
rubinius-toolset (3.0)

2 changes: 1 addition & 1 deletion gems_list.txt
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ rubinius-coverage-2.0.3.gem
rubinius-debugger-2.4.gem
rubinius-developer_tools-2.0.0.gem
rubinius-instructions-3.0.gem
rubinius-melbourne-3.4.gem
rubinius-melbourne-3.5.gem
rubinius-processor-3.0.gem
rubinius-profiler-2.0.2.gem
rubinius-toolset-3.0.gem
19 changes: 18 additions & 1 deletion machine/instructions.def
Original file line number Diff line number Diff line change
@@ -2242,8 +2242,13 @@ instruction zsuper(literal) [ block -- value ]
}
}

Tuple* tup = Tuple::create(state, arg_count);
native_int keywords_position, placeholder_position;
if(mc->keywords) {
placeholder_position = splat_obj ? mc->total_args : mc->total_args - 1;
keywords_position = placeholder_position + 1;
}

Tuple* tup = Tuple::create(state, arg_count);
for(int i = 0; i < mc->total_args; i++) {
tup->put(state, i, scope->get_local(state, i));
}
@@ -2256,6 +2261,18 @@ instruction zsuper(literal) [ block -- value ]
tup->put(state, mc->total_args, splat_obj);
}

if(mc->keywords) {
Object* placeholder = scope->get_local(state, placeholder_position);
Array* ary = Array::create(state, 2);

for(native_int i = keywords_position; i <= mc->keywords_count; i++) {
ary->set(state, 0, as<Symbol>(call_frame->compiled_code->local_names()->at(state, i)));
ary->set(state, 1, scope->get_local(state, i));

placeholder->send(state, state->symbol("[]="), ary);
}
}

CallSite* call_site = reinterpret_cast<CallSite*>(literal);

Arguments new_args(call_site->name(), recv, block, arg_count, 0);
4 changes: 4 additions & 0 deletions machine/machine_code.cpp
Original file line number Diff line number Diff line change
@@ -82,6 +82,10 @@ namespace rubinius {
run = MachineCode::tooling_interpreter;
}

if(keywords) {
keywords_count = code->keywords()->num_fields() / 2;
}

opcodes = new opcode[total];

fill_opcodes(state, code);
1 change: 1 addition & 0 deletions machine/machine_code.hpp
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@ namespace rubinius {
native_int required_args;
native_int post_args;
native_int splat_position;
native_int keywords_count;

native_int stack_size;
native_int number_of_locals;
24 changes: 24 additions & 0 deletions spec/jit/method_spec.rb
Original file line number Diff line number Diff line change
@@ -155,5 +155,29 @@ def m(a=1, **kw) [a, kw] end
end
end
end

context "to m(a:, b: 'b', **) super end" do
before :each do
parent = Class.new do
def m(**args) args end
end

child = Class.new(parent) do
def m(a:, b: 'b', **) super end
end

@o = child.new

jit(@o, :m) { @o.m(a: "a", c: "c") }
end

it "compiles" do
@o.method(:m).executable.jitted?.should be_true
end

it "returns all keyword arguments passed including default ones" do
@o.m(a: "a", c: "c").should == {a: "a", b: "b", c: "c"}
end
end
end
end
1 change: 1 addition & 0 deletions spec/tags/jit/method_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fails:JIT compiling a method call to m(a: 0) compiles
fails:JIT compiling a method call to m(a=1, **kw) compiles
fails:JIT compiling a method call to m(a:, b: 'b', **) super end compiles
2 changes: 0 additions & 2 deletions spec/tags/ruby/language/super_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
fails:The super keyword raises a RuntimeError when called with implicit arguments from a method defined with define_method
fails:The super keyword invokes methods from a chain of anonymous modules
fails:The super keyword when using keyword arguments does not pass any keyword arguments to the parent when none are given
fails:The super keyword when using keyword arguments passes any given keyword arguments including optional and required ones to the parent