Skip to content

Commit b680966

Browse files
committed
AllocateNode is DSL inlinable node
1 parent ecbe811 commit b680966

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-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
@@ -528,7 +528,7 @@ protected RubyDynamicObject copyRubyClass(RubyClass self,
528528
@Specialization
529529
protected RubyDynamicObject copy(ImmutableRubyString string,
530530
@Cached StringNodes.AllocateNode allocateStringNode) {
531-
return allocateStringNode.execute(coreLibrary().stringClass);
531+
return allocateStringNode.execute(this, coreLibrary().stringClass);
532532
}
533533

534534
@Specialization

src/main/java/org/truffleruby/core/string/StringNodes.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,24 +186,26 @@ public abstract static class StringAllocateNode extends CoreMethodNode {
186186
@Specialization
187187
protected RubyString allocate(RubyClass rubyClass,
188188
@Cached AllocateNode allocateNode) {
189-
return allocateNode.execute(rubyClass);
189+
return allocateNode.execute(this, rubyClass);
190190
}
191191
}
192192

193193
@GenerateUncached
194+
@GenerateInline
195+
@GenerateCached(false)
194196
public abstract static class AllocateNode extends RubyBaseNode {
195197

196-
public abstract RubyString execute(RubyClass rubyClass);
198+
public abstract RubyString execute(Node node, RubyClass rubyClass);
197199

198200
@Specialization
199-
protected RubyString allocate(RubyClass rubyClass) {
201+
protected static RubyString allocate(Node node, RubyClass rubyClass) {
200202
final RubyString string = new RubyString(
201203
rubyClass,
202-
getLanguage().stringShape,
204+
getLanguage(node).stringShape,
203205
false,
204206
EMPTY_BINARY,
205207
Encodings.BINARY);
206-
AllocationTracing.trace(string, this);
208+
AllocationTracing.trace(string, node);
207209
return string;
208210
}
209211
}

0 commit comments

Comments
 (0)