Skip to content

Commit 3a2371d

Browse files
author
Nicolas Laurent
committed
reformat
1 parent bc90612 commit 3a2371d

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

src/main/java/org/truffleruby/core/exception/ExceptionNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ protected Object backtraceLocations(DynamicObject exception,
187187
DynamicObject backtraceLocations = Layouts.EXCEPTION.getBacktraceLocations(exception);
188188
if (hasLocationsProfile.profile(backtraceLocations == null)) {
189189
Backtrace backtrace = Layouts.EXCEPTION.getBacktrace(exception);
190-
backtraceLocations = backtrace.getBacktraceLocations(GetBacktraceException.UNLIMITED, this);
190+
backtraceLocations = backtrace.getBacktraceLocations(GetBacktraceException.UNLIMITED, null);
191191
Layouts.EXCEPTION.setBacktraceLocations(exception, backtraceLocations);
192192
}
193193
return backtraceLocations;

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,6 @@ private DynamicObject innerCallerLocations(int omit, int length) {
318318
// Always skip #caller_locations.
319319
final int omitted = omit + 1;
320320
final Backtrace backtrace = getContext().getCallStack().getBacktrace(this, omitted);
321-
322-
// We can't set an effective limit when dealing with negative range endings.
323-
final int limit = length < 0
324-
? GetBacktraceException.UNLIMITED
325-
: omitted + length;
326-
327321
return backtrace.getBacktraceLocations(length, this);
328322
}
329323
}

src/main/java/org/truffleruby/core/thread/ThreadNodes.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ protected DynamicObject backtraceLocations(
155155
private DynamicObject backtraceLocationsInternal(DynamicObject rubyThread, int omit, int length) {
156156
final Memo<DynamicObject> backtraceLocationsMemo = new Memo<>(null);
157157

158-
// We can't set an effective limit when dealing with negative range endings.
159-
final int stackTraceElementsLimit = length < 0
160-
? GetBacktraceException.UNLIMITED
161-
: omit + length;
162-
163158
final SafepointAction safepointAction = (thread1, currentNode) -> {
164159
final Backtrace backtrace = getContext().getCallStack().getBacktrace(this, omit);
165160
backtraceLocationsMemo.set(backtrace.getBacktraceLocations(length, this));

src/main/java/org/truffleruby/language/CallStackManager.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,13 @@ public boolean ignoreFrame(Node callNode, RootCallTarget callTarget) {
228228
}
229229
}
230230

231-
return rootNode != null && rootNode.isInternal() && !BacktraceFormatter.isCore(context, rootNode.getSourceSection())
232-
|| rootNode instanceof InternalRootNode
233-
|| callNode.getEncapsulatingSourceSection() == null;
231+
if (rootNode != null && rootNode.isInternal() &&
232+
!BacktraceFormatter.isCore(context, rootNode.getSourceSection())) {
233+
return true;
234+
}
235+
236+
return rootNode instanceof InternalRootNode || callNode.getEncapsulatingSourceSection() == null;
237+
234238
}
235239

236240
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
* may have set a custom backtrace (an array of strings).
5454
*
5555
* <p>In general, there isn't any guarantee that the getters will return non-null values, excepted
56-
* {@link #getActivations(), {@link #getActivations(Throwable)} and {@link #getBacktraceLocations(int)}.
56+
* {@link #getActivations()}, {@link #getActivations(Throwable)} and
57+
* {@link #getBacktraceLocations(int, Node)}.
5758
*
5859
* <p>NOTE(norswap): And this is somewhat unfortunate, as it's difficult to track the assumptions
5960
* on the backtrace object and generally require being very defensive depending on the information
@@ -245,7 +246,7 @@ public Activation[] getActivations(Throwable truffleException) {
245246
activations.add(new Activation(callNode, methodName));
246247
}
247248

248-
activationCount++;
249+
++activationCount;
249250
}
250251

251252
// If there are activations with a InternalMethod but no caller information above in the
@@ -291,16 +292,15 @@ public DynamicObject getBacktraceLocations(int length, Node node) {
291292
// When dealing with the backtrace of a Ruby exception, we use the wrapping
292293
// exception and we don't set a limit on the retrieved activations.
293294
activationsLength = getActivations().length;
294-
}
295-
else {
295+
} else {
296296
// We can't set an effective limit when dealing with negative range endings.
297297
final int stackTraceElementsLimit = length < 0
298298
? GetBacktraceException.UNLIMITED
299299
: omitted + length;
300300
final Throwable e = new GetBacktraceException(node, stackTraceElementsLimit);
301301
activationsLength = getActivations(e).length;
302302
}
303-
303+
304304
// Omitting more locations than available should return nil.
305305
if (activationsLength == 0) {
306306
return omitted > totalUnderlyingActivations
@@ -315,7 +315,7 @@ public DynamicObject getBacktraceLocations(int length, Node node) {
315315
final int locationsLength = length < 0
316316
? activationsLength + 1 + length
317317
: Math.min(activationsLength, length);
318-
318+
319319
final Object[] locations = new Object[locationsLength];
320320
final DynamicObjectFactory factory = context.getCoreLibrary().threadBacktraceLocationFactory;
321321
for (int i = 0; i < locationsLength; i++) {

0 commit comments

Comments
 (0)