Skip to content

Commit

Permalink
Use LoopConditionProfile in ConditionalJumpNode
Browse files Browse the repository at this point in the history
Compared with CountingConditionProfile, LoopConditionProfile uses a long field for counting true cases.
  • Loading branch information
fniephaus committed Feb 12, 2025
1 parent dc2dafd commit 69244fd
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.oracle.truffle.api.nodes.DirectCallNode;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.nodes.NodeUtil;
import com.oracle.truffle.api.profiles.CountingConditionProfile;
import com.oracle.truffle.api.profiles.LoopConditionProfile;

import de.hpi.swa.trufflesqueak.exceptions.ProcessSwitch;
import de.hpi.swa.trufflesqueak.exceptions.SqueakExceptions.SqueakException;
Expand All @@ -29,7 +29,7 @@ public final class JumpBytecodes {

public abstract static class ConditionalJumpNode extends AbstractBytecodeNode {
private final int jumpSuccessorIndex;
private final CountingConditionProfile conditionProfile = CountingConditionProfile.create();
private final LoopConditionProfile loopConditionProfile = LoopConditionProfile.create();

@Child private FrameStackPopNode popNode = FrameStackPopNode.create();

Expand All @@ -48,7 +48,7 @@ public final void executeVoid(final VirtualFrame frame) {
public final boolean executeCondition(final VirtualFrame frame) {
final Object result = popNode.execute(frame);
if (result instanceof Boolean r) {
return conditionProfile.profile(check(r));
return loopConditionProfile.profile(check(r));
} else {
CompilerDirectives.transferToInterpreter();
FrameAccess.setInstructionPointer(frame, FrameAccess.getCodeObject(frame).getInitialPC() + getSuccessorIndex());
Expand Down

2 comments on commit 69244fd

@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 (69244fd)

Benchmarks ran on 23.0.2-graal.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 522 535 526.04 523 526.01 105207 1.75
CD 524 544 530.42 526 530.38 106083 1.77
DeltaBlue 269 405 360.03 359 359.77 72005 1.2
Havlak 1214 1272 1243.41 1244 1243.36 248681 4.14
Json 326 342 330.14 327.5 330.1 66028 1.1
List 318 346 320.07 318 320.02 64014 1.07
Mandelbrot 129 153 130.87 130 130.82 26173 0.44
NBody 244 269 248.79 246 248.73 49758 0.83
Permute 156 173 157.16 156 157.13 31431 0.52
Queens 216 243 219.18 218 219.13 43836 0.73
Richards 807 823 811.55 808 811.53 162309 2.71
Sieve 170 198 171.17 170 171.14 34233 0.57
Storage 137 155 139.69 138 139.61 27938 0.47
Towers 175 201 177.07 176 177.01 35413 0.59
5207 5659 5365.54 5339.5 5364.74 1073109 17.89

69244fd-2-steady.svg

Warmup (first 100 iterations)

69244fd-3-warmup.svg

@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 (69244fd)

Benchmarks ran on 23.0.2-graal.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 526 541 530.28 527 530.26 106056 1.77
CD 493 512 498.43 495 498.38 99685 1.66
DeltaBlue 272 407 359.92 362 359.5 71983 1.2
Havlak 1146 1208 1178.93 1179 1178.87 235785 3.93
Json 341 366 345.12 342 345.06 69023 1.15
List 319 353 321.02 319 320.96 64203 1.07
Mandelbrot 129 152 130.74 130 130.7 26148 0.44
NBody 245 268 248.98 246 248.92 49795 0.83
Permute 155 170 156.3 156 156.28 31260 0.52
Queens 217 249 221.06 220 221 44212 0.74
Richards 826 873 831.44 828 831.41 166287 2.77
Sieve 170 183 171.13 170 171.11 34225 0.57
Storage 141 155 144.14 142 144.08 28828 0.48
Towers 175 201 177.81 176 177.74 35561 0.59
5155 5638 5315.26 5292 5314.28 1063051 17.72

69244fd-2-steady.svg

Warmup (first 100 iterations)

69244fd-3-warmup.svg

Please sign in to comment.