Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

value profiling for float, double, and remaining integer types #9

Merged
merged 3 commits into from
Feb 4, 2016

Conversation

mrigger
Copy link
Collaborator

@mrigger mrigger commented Feb 4, 2016

Previously, value profiling for memory loads has only been performed for I32 and I64 types. This changes adds value profiling for float, double, and the remaining integer types. There are still other loads which are not profiled because it is unclear if there is a benefit (e.g., for pointers).

@Override
public double executeDouble(VirtualFrame frame) {
double value = LLVMMemory.getDouble(addressNode.executePointee(frame));
if (value == profiledValue) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using == here might cause you problems. For example -0.0 == 0.0, but it's not the case for every operator that f(-0.0) == f(0.0). You probably want to compare the bits instead, using Double.toLongBits.

However, Truffle already has classes for value profiling (which gets this right). Maybe use those?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I would suggest that I first push the fix for this, and then I will finish the travis configuration. When the gate can run the test cases I will refactor the load nodes to use the Truffle value profiling classes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do this yourself, you should use doubleToRawLongBits - it doesn't normalize NaNs.

chrisseaton added a commit that referenced this pull request Feb 4, 2016
value profiling for float, double, and remaining integer types
@chrisseaton chrisseaton merged commit 292ab34 into master Feb 4, 2016
@chrisseaton chrisseaton deleted the load-value-profiling branch February 4, 2016 14:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants