Skip to content

Commit

Permalink
Introduce NEW_CACHE_LIMIT and reduce to 3
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Feb 24, 2025
1 parent 958df88 commit b63865b
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,6 +11,7 @@ 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 = 3;
public static final int PERFORM_SELECTOR_CACHE_LIMIT = 4;
public static final int POINTERS_LAYOUT_CACHE_LIMIT = 4;
public static final int POINTERS_VARIABLE_PART_CACHE_LIMIT = 3;
Expand Down
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(guards = {"receiver == cachedReceiver"}, assumptions = {"cachedReceiver.getClassFormatStable()"}, limit = "NEW_CACHE_LIMIT")
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(guards = {"receiver == cachedReceiver", "isInstantiable(cachedReceiver, size)"}, assumptions = {"cachedReceiver.getClassFormatStable()"}, limit = "NEW_CACHE_LIMIT")
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 b63865b

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

Benchmarks ran on 23.0.2-graal.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 547 569 551.54 548 551.52 110309 1.84
CD 566 585 571.61 568 571.58 114322 1.91
DeltaBlue 298 472 427.79 431 426.16 85558 1.43
Havlak 1097 1144 1121.27 1120 1121.23 224254 3.74
Json 321 339 325.35 323 325.31 65070 1.08
List 351 377 353.93 352 353.89 70786 1.18
Mandelbrot 129 154 130.88 130 130.83 26176 0.44
NBody 252 275 257.19 254 257.13 51438 0.86
Permute 164 179 165.77 165 165.74 33153 0.55
Queens 235 261 237.8 236 237.75 47559 0.79
Richards 895 921 899.89 897 899.87 179977 3
Sieve 170 197 171.26 170 171.23 34252 0.57
Storage 144 158 146.35 144 146.29 29270 0.49
Towers 205 229 207.04 206 206.99 41407 0.69
5374 5860 5567.66 5544 5565.51 1113531 18.56

b63865b-2-steady.svg

Warmup (first 100 iterations)

b63865b-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 (b63865b)

Benchmarks ran on 23.0.2-graal.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 542 556 546.61 543 546.59 109321 1.82
CD 609 631 615.14 611 615.1 123028 2.05
DeltaBlue 294 475 429.77 432 428.76 85954 1.43
Havlak 1093 1146 1122.55 1122 1122.51 224510 3.74
Json 345 363 348.76 346 348.72 69752 1.16
List 353 383 355.25 354 355.2 71050 1.18
Mandelbrot 129 160 130.8 130 130.74 26160 0.44
NBody 252 274 256.86 254 256.8 51371 0.86
Permute 172 187 173.73 173 173.71 34745 0.58
Queens 231 263 234.51 233 234.45 46901 0.78
Richards 900 915 904.27 901 904.25 180853 3.01
Sieve 170 206 171.35 170 171.3 34270 0.57
Storage 143 161 146.19 144 146.13 29238 0.49
Towers 205 234 206.81 206 206.76 41361 0.69
5438 5954 5642.57 5619 5641.01 1128514 18.81

b63865b-2-steady.svg

Warmup (first 100 iterations)

b63865b-3-warmup.svg

Please sign in to comment.