Skip to content

Commit

Permalink
Fill in sender behind a @TruffleBoundary
Browse files Browse the repository at this point in the history
invalidate() is blocklisted
  • Loading branch information
fniephaus committed Jul 20, 2021
1 parent c8d6002 commit 9564e61
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,23 +241,28 @@ public Object getFrameSender() {
public AbstractSqueakObject getSender() {
final Object value = getFrameSender();
if (value instanceof FrameMarker) {
if (!methodOrBlock.hasPrimitive() || methodOrBlock.isUnwindMarked() || methodOrBlock.isExceptionHandlerMarked()) {
/*
* Only invalidate sender assumption if not a primitive method. The sender of a
* primitive method is usually required in exceptional cases (when the debugger is
* opened, example: `1/0`), except if the method is unwind marked or marked as
* exception handler.
*/
methodOrBlock.getDoesNotNeedSenderAssumption().invalidate("Sender requested");
}
final ContextObject previousContext = ((FrameMarker) value).getMaterializedContext();
FrameAccess.setSender(getTruffleFrame(), previousContext);
return previousContext;
return fillInSenderFromMaker((FrameMarker) value);
} else {
return (AbstractSqueakObject) value;
}
}

@TruffleBoundary
private AbstractSqueakObject fillInSenderFromMaker(final FrameMarker value) {
if (!methodOrBlock.hasPrimitive() || methodOrBlock.isUnwindMarked() || methodOrBlock.isExceptionHandlerMarked()) {
/*
* Only invalidate sender assumption if not a primitive method. The sender of a
* primitive method is usually required in exceptional cases (when the debugger is
* opened, example: `1/0`), except if the method is unwind marked or marked as exception
* handler.
*/
methodOrBlock.getDoesNotNeedSenderAssumption().invalidate("Sender requested");
}
final ContextObject previousContext = value.getMaterializedContext();
FrameAccess.setSender(getTruffleFrame(), previousContext);
return previousContext;
}

// should only be used when sender is not nil
public ContextObject getNotNilSender() {
return (ContextObject) getSender();
Expand Down

1 comment on commit 9564e61

@TruffleSqueak-Bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance Report (9564e61)

Benchmarks ran on graalvm-ce-java11-21.2.0.

Steady (after 50 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 181 276 186.67 183 186.18 37333 0.62
DeltaBlue 293 467 420.6 416 420.15 84120 1.4
Havlak 1491 1682 1557.76 1567 1557.41 311551 5.19
Json 514 552 520.02 517 519.97 104004 1.73
List 893 996 901.31 898 901.24 180262 3
Mandelbrot 145 179 147.69 147 147.65 29538 0.49
NBody 272 305 277.83 276 277.75 55565 0.93
Permute 234 275 239.79 237 239.67 47957 0.8
Queens 255 306 260.82 256 260.59 52163 0.87
Richards 1100 1171 1107.79 1101 1107.71 221558 3.69
Sieve 214 277 229.06 226 228.68 45812 0.76
Storage 301 361 307.48 304 307.34 61495 1.02
Towers 351 387 353.52 352 353.47 70703 1.18
6244 7234 6510.31 6480 6507.82 1302061 21.7

9564e61-2-steady.svg

Warmup (first 50 iterations)

9564e61-3-warmup.svg

Please sign in to comment.