Skip to content

Commit 9132cb0

Browse files
committed
AllocateNode in Range module is DSL inlinable
1 parent b680966 commit 9132cb0

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/main/java/org/truffleruby/core/kernel/KernelNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ protected RubyDynamicObject copy(ImmutableRubyString string,
534534
@Specialization
535535
protected RubyDynamicObject copy(RubyIntOrLongRange range,
536536
@Cached RangeNodes.AllocateNode allocateRangeNode) {
537-
return allocateRangeNode.execute(coreLibrary().rangeClass);
537+
return allocateRangeNode.execute(this, coreLibrary().rangeClass);
538538
}
539539
}
540540

src/main/java/org/truffleruby/core/range/RangeNodes.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
package org.truffleruby.core.range;
1111

1212
import com.oracle.truffle.api.dsl.Bind;
13+
import com.oracle.truffle.api.dsl.GenerateCached;
14+
import com.oracle.truffle.api.dsl.GenerateInline;
1315
import com.oracle.truffle.api.dsl.GenerateUncached;
1416
import com.oracle.truffle.api.dsl.NeverDefault;
17+
import com.oracle.truffle.api.nodes.Node;
1518
import com.oracle.truffle.api.profiles.InlinedConditionProfile;
1619
import com.oracle.truffle.api.profiles.InlinedLoopConditionProfile;
1720
import com.oracle.truffle.api.profiles.LoopConditionProfile;
@@ -468,20 +471,22 @@ public abstract static class RangeAllocateNode extends CoreMethodNode {
468471
@Specialization
469472
protected RubyObjectRange allocate(RubyClass rubyClass,
470473
@Cached AllocateNode allocateNode) {
471-
return allocateNode.execute(rubyClass);
474+
return allocateNode.execute(this, rubyClass);
472475
}
473476
}
474477

475478
@GenerateUncached
479+
@GenerateInline
480+
@GenerateCached(false)
476481
public abstract static class AllocateNode extends RubyBaseNode {
477482

478-
public abstract RubyObjectRange execute(RubyClass rubyClass);
483+
public abstract RubyObjectRange execute(Node node, RubyClass rubyClass);
479484

480485
@Specialization
481-
protected RubyObjectRange allocate(RubyClass rubyClass) {
482-
final Shape shape = getLanguage().objectRangeShape;
486+
protected static RubyObjectRange allocate(Node node, RubyClass rubyClass) {
487+
final Shape shape = getLanguage(node).objectRangeShape;
483488
final RubyObjectRange range = new RubyObjectRange(rubyClass, shape, false, nil, nil, false);
484-
AllocationTracing.trace(range, this);
489+
AllocationTracing.trace(range, node);
485490
return range;
486491
}
487492
}

0 commit comments

Comments
 (0)