Skip to content

Commit

Permalink
Handle aboutToReturn in commonNLReturn
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Dec 27, 2023
1 parent 876d77e commit db6c968
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ failingTests := OrderedCollection new.
{
#FloatTest -> #(#testIsDenormalized #testPrimTruncated).
#ProcessorTest -> #("flaky" #testGrabProcessor #testGrabProcessorOnlyForNoTimeout #testGrabProcessorOnlyForTimeout #testValueUnpreemptively).
#ProcessTerminateUnwindNonLocalReturn -> #(test1ATerminate #test1BTerminate #test2ATerminate #test2BTerminate #test3ATerminate #test3BTerminate #test4ATerminate #test4BTerminate #test5ATerminate #test5BTerminate "flaky" #test5DTerminate #test6ATerminate #test6BTerminate "flaky" #test6DTerminate #test7ATerminate #test7BTerminate #test8ATerminate #test8BTerminate).
#SmallIntegerTest -> #(#testMaxVal #testMinVal #testPrintString).
#WeakIdentitySetTest -> #(#test). "Failing (or flaky?) on TruffleSqueak Native"
} collect: [:assoc | | testCase |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void executeLoop() {
activeContext = ps.getNewContext();
LogUtils.SCHEDULING.log(Level.FINE, "Process Switch: {0}", activeContext);
} catch (final NonLocalReturn nlr) {
activeContext = commonNLReturn(sender, nlr.getTargetContext(), nlr.getReturnValue());
activeContext = commonNLReturn(sender, nlr);
LogUtils.SCHEDULING.log(Level.FINE, "Non Local Return on top-level: {0}", activeContext);
} catch (final NonVirtualReturn nvr) {
activeContext = commonReturn(nvr.getCurrentContext(), nvr.getTargetContext(), nvr.getReturnValue());
Expand All @@ -124,12 +124,29 @@ private static ContextObject returnTo(final ContextObject activeContext, final A
}

@TruffleBoundary
private ContextObject commonNLReturn(final AbstractSqueakObject sender, final ContextObject targetContext, final Object returnValue) {
private ContextObject commonNLReturn(final AbstractSqueakObject sender, final NonLocalReturn nlr) {
final ContextObject targetContext = nlr.getTargetContext();
final Object returnValue = nlr.getReturnValue();
if (!(sender instanceof final ContextObject senderContext)) {
assert sender == NilObject.SINGLETON;
throw returnToTopLevel(targetContext, returnValue);
}
ContextObject context = senderContext;
while (context != targetContext) {
if (context.getCodeObject().isUnwindMarked()) {
try {
// TODO: make this better
AboutToReturnNode.create(context.getCodeObject()).executeAboutToReturn(context.getTruffleFrame(), nlr);
} catch (NonVirtualReturn nvr) {
return commonReturn(nvr.getCurrentContext(), nvr.getTargetContext(), nvr.getReturnValue());
}
}
final AbstractSqueakObject currentSender = context.getSender();
if (currentSender instanceof final ContextObject o) {
context = o;
}
}
context = senderContext;
while (context != targetContext) {
final AbstractSqueakObject currentSender = context.getSender();
if (currentSender instanceof final ContextObject o) {
Expand Down

1 comment on commit db6c968

@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 (db6c968)

Benchmarks ran on graalvm-jdk-21+35.1.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 560 567 562.65 561 562.65 112530 1.88
CD 484 496 487.93 486 487.92 97586 1.63
DeltaBlue 280 473 418.42 424 416.86 83684 1.39
Havlak 1135 1189 1165.03 1170 1164.96 233005 3.88
Json 364 373 366.39 365 366.37 73277 1.22
List 375 389 376 376 376 75200 1.25
Mandelbrot 229 239 232.88 234 232.86 46575 0.78
NBody 256 270 259.13 257 259.11 51825 0.86
Permute 154 171 156.4 155 156.37 31280 0.52
Queens 245 267 248.48 246 248.43 49696 0.83
Richards 1217 1233 1220.36 1221 1220.36 244072 4.07
Sieve 177 194 178.25 178 178.23 35649 0.59
Storage 141 150 143.14 142 143.12 28628 0.48
Towers 196 209 197.91 197 197.9 39582 0.66
5813 6220 6012.95 6012 6011.13 1202589 20.04

db6c968-2-steady.svg

Warmup (first 100 iterations)

db6c968-3-warmup.svg

Please sign in to comment.