Skip to content

Commit f977218

Browse files
committed
Minor code clean up and add changelog entry.
1 parent 7b81ec5 commit f977218

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Performance:
5555
* Calls with a literal block are no longer always split but instead the decision is made by the Truffle splitting heuristic.
5656
* `Symbol#to_proc` is now AST-inlined in order to not rely on splitting and to avoid needing the caller frame to find refinements which apply.
5757
* `Symbol#to_proc` is now globally cached per Symbol and refinements, to avoid creating many redundant `CallTargets`.
58+
* Setting and access to the special variables `$~` and `$_` has been refactored to require less splitting.
5859

5960
Changes:
6061

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public abstract static class GetSpecialVariableStorage extends RubyContextNode {
188188
public abstract SpecialVariableStorage execute(VirtualFrame frame);
189189

190190
@Specialization(
191-
guards = { "frame.getFrameDescriptor() == descriptor", "declarationFrameSlot != null" },
191+
guards = "frame.getFrameDescriptor() == descriptor",
192192
assumptions = "frameAssumption",
193193
limit = "1")
194194
protected SpecialVariableStorage getFromKnownFrameDescriptor(VirtualFrame frame,
@@ -273,13 +273,11 @@ protected int declarationDepth(VirtualFrame topFrame) {
273273
}
274274

275275
protected FrameDescriptor declarationDescriptor(VirtualFrame topFrame, int depth) {
276-
MaterializedFrame frame;
277276
if (depth == 0) {
278-
frame = topFrame.materialize();
277+
return topFrame.getFrameDescriptor();
279278
} else {
280-
frame = RubyArguments.getDeclarationFrame(topFrame, depth);
279+
return RubyArguments.getDeclarationFrame(topFrame, depth).getFrameDescriptor();
281280
}
282-
return frame.getFrameDescriptor();
283281
}
284282

285283
@TruffleBoundary

src/main/java/org/truffleruby/language/backtrace/BacktraceFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void printRubyExceptionOnEnvStderr(String info, RubyException rubyExcepti
114114
context.getCoreLibrary().truffleExceptionOperationsModule,
115115
"get_formatted_backtrace",
116116
rubyException);
117-
final String formatted = fullMessage != null ? ((RubyString) fullMessage).getJavaString() : "";
117+
final String formatted = fullMessage != null ? ((RubyString) fullMessage).getJavaString() : "<no message>";
118118
if (formatted.endsWith("\n")) {
119119
printer.print(formatted);
120120
} else {

0 commit comments

Comments
 (0)