Skip to content

Conversation

@adinn
Copy link
Collaborator

@adinn adinn commented Jun 16, 2017

The Problem:
This patch fixes the 12 CountedLoop unit tests that currently fail with an assert during code generation.

Diagnosis:
On AArch64 DIv/Rem nodes are replaced by a snippet which includes AArch64-specific SafeDiv/Rem nodes. The latter are cloned from the original DIv/Rem nodes with a null beforeState. Unfortunately, they inherit their generate method from the generic Div/Rem nodes. The inherited methods call gen.state(this) to retrieve the beforeState and construct a FrameState passed in the call to the generators emitDiv/Rem method. This blows up because the beforeState is null.

Fix:
The AArch64 generator's emitDiv/Rem methods ignore the state argument because they will never encounter a div by zero. So, there is no need to compute a frame state. The fix works by overriding the inherited methods and passing null for the frame state.

Testing:
After this patch the 12 failing CountedLoop unit tests all succeed.

Copy link
Member

@axel22 axel22 left a comment

Choose a reason for hiding this comment

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

After the fix to the currently failing eclipseformat job, this looks good to me.

protected SafeSignedRemNode(ValueNode x, ValueNode y) {
super(TYPE, x, y);
}
@Override
Copy link
Member

Choose a reason for hiding this comment

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

Eclipseformat is complaining about a missing empty line between the methods.

@adinn
Copy link
Collaborator Author

adinn commented Jun 16, 2017

Restyled and pushed :-) Good to go?

@axel22
Copy link
Member

axel22 commented Jun 16, 2017

@adinn Should be great - the merge should land soon! Thanks a lot!

@dougxc dougxc merged commit 1e7ee4a into oracle:master Jun 16, 2017
dougxc pushed a commit that referenced this pull request Jun 16, 2017
@adinn adinn deleted the safe_div_patch branch June 23, 2017 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants