@@ -95,11 +95,9 @@ public Backtrace(Node location, SourceSection sourceLocation, int omitted, Throw
95
95
* Creates a backtrace for the given Truffle exception, setting the
96
96
* {@link #getLocation() location} and {@link #getSourceLocation() source location} accordingly,
97
97
* and computing the activations eagerly (since the exception itself is not retained).
98
- *
99
- * <p>This is not/should not be used for constructing the backtrace associated with Ruby
100
- * exceptions.
101
98
*/
102
99
public Backtrace (TruffleException exception ) {
100
+ assert !(exception instanceof RaiseException );
103
101
this .location = exception .getLocation ();
104
102
this .sourceLocation = exception .getSourceLocation ();
105
103
this .omitted = 0 ;
@@ -148,8 +146,6 @@ public RaiseException getRaiseException() {
148
146
149
147
/**
150
148
* Sets the wrapper for the Ruby exception associated with this backtrace.
151
- *
152
- * <p>Do not set the raise exception twice on the same backtrace!
153
149
*/
154
150
public void setRaiseException (RaiseException raiseException ) {
155
151
assert this .raiseException == null : "the RaiseException of a Backtrace must not be set again, otherwise the original backtrace is lost" ;
@@ -308,12 +304,10 @@ public DynamicObject getBacktraceLocations(int length, Node node) {
308
304
: ArrayHelpers .createEmptyArray (context );
309
305
}
310
306
311
- // NOTE (norswap, 08 Jan 2020)
312
- // It used to be that TruffleException#getStackTraceElementLimit() wasn't respected
313
- // due to a mishandling of internal frames. That's why we used Math.min and not just
314
- // length. Leaving it in just in case.
315
307
final int locationsLength = length < 0
316
308
? activationsLength + 1 + length
309
+ // We use Math.min because length > activationsLength is possible and
310
+ // activationsLength > length is too whenever there is a #raiseException set.
317
311
: Math .min (activationsLength , length );
318
312
319
313
final Object [] locations = new Object [locationsLength ];
0 commit comments