Skip to content

Commit 2378f64

Browse files
[GR-28209] [GR-26395] Update graal import, which fixes warmup regression
PullRequest: truffleruby/2291
2 parents 2ea2018 + a015aec commit 2378f64

File tree

4 files changed

+37
-17
lines changed

4 files changed

+37
-17
lines changed

mx.truffleruby/suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"name": "regex",
99
"subdir": True,
10-
"version": "d7cc62ad964d16258dc5cd5db4daede81d661076",
10+
"version": "21a3c29d9b142a6005b4fe9bd5c0935cbdb28105",
1111
"urls": [
1212
{"url": "https://github.com/oracle/graal.git", "kind" : "git"},
1313
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
@@ -16,7 +16,7 @@
1616
{
1717
"name": "sulong",
1818
"subdir": True,
19-
"version": "d7cc62ad964d16258dc5cd5db4daede81d661076",
19+
"version": "21a3c29d9b142a6005b4fe9bd5c0935cbdb28105",
2020
"urls": [
2121
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
2222
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},

spec/truffle/interop/node_library_top_scope_spec.rb

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,29 @@
99
# GNU Lesser General Public License version 2.1.
1010
#
1111

12-
# rubocop:disable Lint/UselessAssignment
13-
14-
a = "a"
15-
1612
describe "NodeLibrary top scope" do
1713
it "returns the members" do
18-
b = "b"
19-
def get_top_scope
20-
c = "c"
21-
Primitive.top_scope
22-
end
23-
top_scope = get_top_scope()
14+
top_scope = Primitive.top_scope
15+
Truffle::Boot::INTERACTIVE_BINDING.eval('top_scope_spec_var = :top_scope_spec')
16+
2417
scope_members = Truffle::Interop.members(top_scope)
25-
["$stdout", "is_a?"].all? { |m| scope_members.include?(m) }.should == true
18+
scope_members.should.include?('top_scope_spec_var')
19+
scope_members.should.include?('$stdout')
20+
scope_members.should.include?('is_a?')
21+
22+
scope_members.index('top_scope_spec_var').should < scope_members.index('$stdout')
23+
scope_members.index('$stdout').should < scope_members.index('is_a?')
24+
25+
top_scope["top_scope_spec_var"].should == :top_scope_spec
2626
top_scope["$stdout"].should == $stdout
2727
top_scope["is_a?"].should be_kind_of(Method)
2828
end
29-
end
3029

31-
# rubocop:enable Lint/UselessAssignment
30+
it "is separate from TOPLEVEL_BINDING" do
31+
TOPLEVEL_BINDING.eval('top_scope_spec_top_binding_var = nil')
32+
33+
TOPLEVEL_BINDING.local_variables.should.include?(:top_scope_spec_top_binding_var)
34+
Truffle::Boot::INTERACTIVE_BINDING.local_variables.should_not.include?(:top_scope_spec_top_binding_var)
35+
Truffle::Interop.members(Primitive.top_scope).should_not.include?('top_scope_spec_top_binding_var')
36+
end
37+
end

src/main/java/org/truffleruby/core/binding/BindingNodes.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,4 +498,18 @@ protected RubyBinding binding(VirtualFrame frame) {
498498
return BindingNodes.createBinding(getContext(), getLanguage(), callerFrame);
499499
}
500500
}
501+
502+
@Primitive(name = "create_empty_binding")
503+
public abstract static class CreateEmptyBindingNode extends PrimitiveArrayArgumentsNode {
504+
@Specialization
505+
protected RubyBinding binding(VirtualFrame frame) {
506+
// Use the current frame to initialize the arguments, etc, correctly
507+
final RubyBinding binding = BindingNodes
508+
.createBinding(getContext(), getLanguage(), frame.materialize(), getEncapsulatingSourceSection());
509+
final MaterializedFrame newFrame = newFrame(binding, newFrameDescriptor());
510+
RubyArguments.setDeclarationFrame(newFrame, null); // detach from the current frame
511+
return binding;
512+
}
513+
}
514+
501515
}

src/main/ruby/truffleruby/core/truffle/boot.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
# There must be no local variables at the top scope in this file,
1212
# as the TOPLEVEL_BINDING should be empty until the main script is executed.
13-
TOPLEVEL_BINDING = binding
13+
TOPLEVEL_BINDING = Primitive.create_empty_binding
1414

1515
# The Binding used for sharing top-level locals of interactive Sources
16-
Truffle::Boot::INTERACTIVE_BINDING = binding
16+
Truffle::Boot::INTERACTIVE_BINDING = Primitive.create_empty_binding
1717

1818
module Truffle::Boot
1919

0 commit comments

Comments
 (0)