Skip to content

Commit

Permalink
Introduce NEW_CACHE_LIMIT and reduce to 4
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Feb 16, 2025
1 parent 906101f commit 442c4a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ public final class CacheLimits {
public static final int INDIRECT_PRIMITIVE_CACHE_LIMIT = 2;
public static final int INLINE_BLOCK_CACHE_LIMIT = 4;
public static final int INLINE_METHOD_CACHE_LIMIT = 4;
public static final int NEW_CACHE_LIMIT = 4;
public static final int PERFORM_SELECTOR_CACHE_LIMIT = 4;
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
import de.hpi.swa.trufflesqueak.nodes.primitives.AbstractPrimitiveFactoryHolder;
import de.hpi.swa.trufflesqueak.nodes.primitives.AbstractPrimitiveNode;
import de.hpi.swa.trufflesqueak.nodes.primitives.AbstractSingletonPrimitiveNode;
import de.hpi.swa.trufflesqueak.nodes.primitives.Primitive.Primitive1;
import de.hpi.swa.trufflesqueak.nodes.primitives.Primitive.Primitive1WithFallback;
import de.hpi.swa.trufflesqueak.nodes.primitives.Primitive.Primitive0;
import de.hpi.swa.trufflesqueak.nodes.primitives.Primitive.Primitive0WithFallback;
import de.hpi.swa.trufflesqueak.nodes.primitives.Primitive.Primitive1;
import de.hpi.swa.trufflesqueak.nodes.primitives.Primitive.Primitive1WithFallback;
import de.hpi.swa.trufflesqueak.nodes.primitives.Primitive.Primitive2WithFallback;
import de.hpi.swa.trufflesqueak.nodes.primitives.Primitive.Primitive3WithFallback;
import de.hpi.swa.trufflesqueak.nodes.primitives.SqueakPrimitive;
Expand Down Expand Up @@ -184,9 +184,7 @@ protected static final Object literalAtPut(final CompiledCodeObject receiver, @S
@GenerateNodeFactory
@SqueakPrimitive(indices = 70)
public abstract static class PrimNewNode extends AbstractPrimitiveNode implements Primitive0WithFallback {
public static final int NEW_CACHE_SIZE = 6;

@Specialization(limit = "NEW_CACHE_SIZE", guards = {"receiver == cachedReceiver"}, assumptions = {"cachedReceiver.getClassFormatStable()"})
@Specialization(limit = "NEW_CACHE_LIMIT", guards = {"receiver == cachedReceiver"}, assumptions = {"cachedReceiver.getClassFormatStable()"})
protected static final AbstractSqueakObjectWithClassAndHash newDirect(@SuppressWarnings("unused") final ClassObject receiver,
@Bind("this") final Node node,
@Cached("receiver.withEnsuredBehaviorHash()") final ClassObject cachedReceiver,
Expand Down Expand Up @@ -217,9 +215,7 @@ protected static final AbstractSqueakObjectWithClassAndHash newIndirect(final Cl
@GenerateNodeFactory
@SqueakPrimitive(indices = 71)
protected abstract static class PrimNewWithArgNode extends AbstractPrimitiveNode implements Primitive1 {
public static final int NEW_CACHE_SIZE = 6;

@Specialization(limit = "NEW_CACHE_SIZE", guards = {"receiver == cachedReceiver", "isInstantiable(cachedReceiver, size)"}, assumptions = {"cachedReceiver.getClassFormatStable()"})
@Specialization(limit = "NEW_CACHE_LIMIT", guards = {"receiver == cachedReceiver", "isInstantiable(cachedReceiver, size)"}, assumptions = {"cachedReceiver.getClassFormatStable()"})
protected static final AbstractSqueakObjectWithClassAndHash newWithArgDirect(@SuppressWarnings("unused") final ClassObject receiver, final long size,
@Bind("this") final Node node,
@Cached(value = "createIdentityProfile()", inline = true) final InlinedIntValueProfile sizeProfile,
Expand Down

2 comments on commit 442c4a6

@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 (442c4a6)

Benchmarks ran on 23.0.2-graal.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 520 534 524.11 521 524.09 104822 1.75
CD 522 542 528 524 527.95 105600 1.76
DeltaBlue 188 305 260.64 259 260.48 52127 0.87
Havlak 1145 1206 1178.47 1178 1178.41 235694 3.93
Json 336 354 339.99 337 339.95 67997 1.13
List 318 367 330.95 321 330.67 66190 1.1
Mandelbrot 129 150 130.69 130 130.65 26137 0.44
NBody 244 267 248.92 246 248.87 49784 0.83
Permute 155 168 156.83 156 156.81 31366 0.52
Queens 218 250 222.45 221 222.39 44489 0.74
Richards 806 826 816.94 816 816.93 163388 2.72
Sieve 170 184 171.15 170 171.13 34229 0.57
Storage 137 154 140.3 138 140.24 28060 0.47
Towers 178 205 180.13 179 180.06 36026 0.6
5066 5512 5229.55 5196 5228.62 1045909 17.43

442c4a6-2-steady.svg

Warmup (first 100 iterations)

442c4a6-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 (442c4a6)

Benchmarks ran on 23.0.2-graal.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 526 540 530.72 527 530.7 106144 1.77
CD 527 548 532.73 529 532.68 106545 1.78
DeltaBlue 179 293 263.13 263 262.92 52626 0.88
Havlak 1225 1277 1250.93 1250 1250.88 250185 4.17
Json 322 339 326.27 323 326.23 65255 1.09
List 319 355 323.48 320 323.39 64695 1.08
Mandelbrot 129 156 130.74 130 130.69 26147 0.44
NBody 244 267 249.02 246 248.96 49803 0.83
Permute 155 172 156.39 156 156.37 31278 0.52
Queens 217 249 220.09 219 220.03 44017 0.73
Richards 811 826 814.92 812 814.9 162983 2.72
Sieve 170 194 171.15 170 171.12 34230 0.57
Storage 136 152 138.71 137 138.64 27742 0.46
Towers 175 205 177.4 176 177.33 35479 0.59
5135 5573 5285.65 5258 5284.84 1057129 17.62

442c4a6-2-steady.svg

Warmup (first 100 iterations)

442c4a6-3-warmup.svg

Please sign in to comment.