Skip to content

Commit

Permalink
Access fromFraction in a static way
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Oct 20, 2024
1 parent 04c454d commit a98e22b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.oracle.truffle.api.nodes.Node;

import de.hpi.swa.trufflesqueak.exceptions.PrimitiveFailed;
import de.hpi.swa.trufflesqueak.image.SqueakImageContext;
import de.hpi.swa.trufflesqueak.model.BooleanObject;
import de.hpi.swa.trufflesqueak.model.FloatObject;
import de.hpi.swa.trufflesqueak.model.NativeObject;
Expand Down Expand Up @@ -102,7 +103,7 @@ protected static final double doFloat(final NativeObject receiver, final long in
protected static final double doFraction(final NativeObject receiver, final long index, final PointersObject value,
@Bind("this") final Node node,
@Cached final AbstractPointersObjectNodes.AbstractPointersObjectReadNode readNode) {
return doDouble(receiver, index, getContext(node).fromFraction(value, readNode, node));
return doDouble(receiver, index, SqueakImageContext.fromFraction(value, readNode, node));
}

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.oracle.truffle.api.nodes.Node;

import de.hpi.swa.trufflesqueak.exceptions.PrimitiveFailed;
import de.hpi.swa.trufflesqueak.image.SqueakImageContext;
import de.hpi.swa.trufflesqueak.model.BooleanObject;
import de.hpi.swa.trufflesqueak.model.FloatObject;
import de.hpi.swa.trufflesqueak.model.NativeObject;
Expand Down Expand Up @@ -103,7 +104,7 @@ protected static final double doFloat(final NativeObject receiver, final long in
protected static final double doFraction(final NativeObject receiver, final long index, final PointersObject value,
@Bind("this") final Node node,
@Cached final AbstractPointersObjectNodes.AbstractPointersObjectReadNode readNode) {
return doDouble(receiver, index, getContext(node).fromFraction(value, readNode, node));
return doDouble(receiver, index, SqueakImageContext.fromFraction(value, readNode, node));
}

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import de.hpi.swa.trufflesqueak.exceptions.PrimitiveFailed;
import de.hpi.swa.trufflesqueak.exceptions.RespecializeException;
import de.hpi.swa.trufflesqueak.image.SqueakImageContext;
import de.hpi.swa.trufflesqueak.model.AbstractSqueakObject;
import de.hpi.swa.trufflesqueak.model.BooleanObject;
import de.hpi.swa.trufflesqueak.model.FloatObject;
Expand Down Expand Up @@ -1246,7 +1247,7 @@ protected static final Object doFraction(final double lhs, final PointersObject
@Bind("this") final Node node,
@Cached final AsFloatObjectIfNessaryNode boxNode,
@Cached final AbstractPointersObjectNodes.AbstractPointersObjectReadNode readNode) {
return boxNode.execute(node, lhs - getContext(node).fromFraction(rhs, readNode, node));
return boxNode.execute(node, lhs - SqueakImageContext.fromFraction(rhs, readNode, node));
}
}

Expand Down

1 comment on commit a98e22b

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

Benchmarks ran on 22.0.2-graal.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 514 584 516.81 515 516.78 103362 1.72
CD 489 500 492.62 490 492.6 98523 1.64
DeltaBlue 280 473 412.32 408 410.9 82463 1.37
Havlak 1130 1180 1159.83 1166 1159.75 231966 3.87
Json 376 385 378.6 377 378.58 75719 1.26
List 309 320 309.63 309 309.62 61925 1.03
Mandelbrot 127 141 127.56 127 127.55 25512 0.43
NBody 250 269 253.32 252 253.29 50663 0.84
Permute 154 169 155.83 155 155.81 31166 0.52
Queens 229 242 230.26 230 230.25 46052 0.77
Richards 1249 1305 1253.65 1252 1253.64 250730 4.18
Sieve 177 186 178.13 178 178.12 35625 0.59
Storage 140 150 142.23 141 142.21 28446 0.47
Towers 196 213 198.11 197 198.09 39621 0.66
5620 6117 5808.87 5797 5807.2 1161773 19.36

a98e22b-2-steady.svg

Warmup (first 100 iterations)

a98e22b-3-warmup.svg

Please sign in to comment.