Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to limit identity hash code to positive values #3198

Merged
merged 1 commit into from
Oct 10, 2018

Conversation

gacholio
Copy link
Contributor

@gacholio gacholio commented Oct 9, 2018

Add command line option "-XX:[+|-]PositiveIdentityHash" to
enable/disable forcing identity hash code to be a positive value.

Doc issue eclipse-openj9/openj9-docs#109
Fixes: #3062

Signed-off-by: Graham Chapman graham_chapman@ca.ibm.com

Add command line option "-XX:[+|-]PositiveIdentityHash" to
enable/disable forcing identity hash code to be a positive value.

Fixes: eclipse-openj9#3062

Signed-off-by: Graham Chapman <graham_chapman@ca.ibm.com>
@gacholio
Copy link
Contributor Author

gacholio commented Oct 9, 2018

jenkins test sanity zlinux jdk8

Copy link
Member

@DanHeidinga DanHeidinga left a comment

Choose a reason for hiding this comment

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

Change looks good. @vijaysun-omr What perf testing do you think this needs?

@DanHeidinga DanHeidinga self-assigned this Oct 10, 2018
@vijaysun-omr
Copy link
Contributor

vijaysun-omr commented Oct 10, 2018

Thanks @DanHeidinga and @gacholio for this change.

I think a small unit test that computes indentityHashCode many times should tell us the relative cost of adding the option check on this code path. The baseline would be a build without this change. Maybe Gac can show the data from that test.

I can also get Liberty tried with this change just to make sure it does not regress. I believe some code in a Lucene test we had exercised identity hash codes but I cannot be sure but I'll ask the team members I was working with at that time if we still have the test.

@gacholio
Copy link
Contributor Author

I'd like some indication of how much of slowdown we'll take enabling the option to include in the doc. I expect it will be negligible in practice since anyone using a hash code is going to do something to make it positive before it could be used as a bucket index, etc.

@vijaysun-omr
Copy link
Contributor

I asked and we don't have the Lucene testing I was thinking of anymore. So I will just get this evaluated on Liberty.

@gacholio
Copy link
Contributor Author

-Xint microbench:

Before:

100000000 iterations took 36859 ms
100000000 iterations took 37137 ms
100000000 iterations took 36258 ms

After:

100000000 iterations took 36080 ms
100000000 iterations took 36458 ms
100000000 iterations took 36003 ms

No measureble difference.

@gacholio
Copy link
Contributor Author

-Xjit results (10x the iteration count of -Xint):

Before:

1000000000 iterations took 9923 ms
1000000000 iterations took 9785 ms
1000000000 iterations took 9789 ms

After:

1000000000 iterations took 10815 ms
1000000000 iterations took 10812 ms
1000000000 iterations took 10865 ms

Seems consistently slower.

@vijaysun-omr
Copy link
Contributor

vijaysun-omr commented Oct 10, 2018

I assume this is comparing a build without the option vs a build with the option (but the option is not specified on the command line) ?

@gacholio
Copy link
Contributor Author

@vijaysun-omr The JIT seems to recognize and replaced identityHashCode, but it looks like that's guarded by an option that is not set, and the replacement code is unimplmeneted. Can you confirm?

I can't explain why the JIT would be slower (the JITs were not identical in the builds, but they were no more than a day different).

@gacholio
Copy link
Contributor Author

Yes, the "before" is a build from today and the "after" is a build from yesterday with this PR added. The new option was not enabled.

@vijaysun-omr
Copy link
Contributor

I've never seen identityHashCode take more than a couple of percent in any profile really; it's much lower than that in the profiles of benchmarks we work with usually. So I am thinking this is acceptable since the overhead of the extra check you added would be < 0.2% in those benchmarks.

@gacholio
Copy link
Contributor Author

There is a Fast JNI implementation in use by the JIT (and that will get the change from this PR).

@vijaysun-omr
Copy link
Contributor

vijaysun-omr commented Oct 10, 2018

Is it possible to swap the JIT module between these 2 builds and see if we can get a pair of runs with literally the same JIT ?

@gacholio
Copy link
Contributor Author

@vijaysun-omr For the Liberty bench, it would be good to know the cost of enabling the new option, not just the cost of the new code.

@gacholio
Copy link
Contributor Author

Copying the "before" JIT into the "after" VM:

1000000000 iterations took 10844 ms
1000000000 iterations took 10856 ms
1000000000 iterations took 10876 ms

yields essentially identical results.

@DanHeidinga
Copy link
Member

@vijaysun-omr @gacholio I'm OK with merging this now so it makes the 0.11.0 release and we can update with the Liberty results when they're available.

Any objections?

@gacholio
Copy link
Contributor Author

I guess I can just say "unknowable performance impact" in the doc.

@vijaysun-omr
Copy link
Contributor

Given that I don't expect any measurable regression in Liberty I have no issue merging this now without waiting for the Liberty result.

@vijaysun-omr
Copy link
Contributor

@gacholio yes we don't do anything special for the identityHashCode computation in the JIT as far as I know.

@eclipse-openj9 eclipse-openj9 deleted a comment from pshipton Oct 10, 2018
@gacholio
Copy link
Contributor Author

Doc issue: eclipse-openj9/openj9-docs#109

@DanHeidinga DanHeidinga merged commit 1870fe5 into eclipse-openj9:master Oct 10, 2018
@gacholio gacholio deleted the hash branch October 10, 2018 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants