Frequency of acmp followed equals pattern

Roland Westrelin rwestrel at
Thu Nov 15 11:01:59 UTC 2018

John suggested we should try to determine how often an acmp is followed
by a call to Object.equals() as this could help optimize acmp if it's
implemented as a substituability test.


c2 compiled code code is instrumented so acmp's are classified as:

1- followed by a call to equals()
2- not followed by a call to equals()
3- in an inlined call to equals().

Then 1- and 2- are counted separately and 1 / (1 + 2) is the percentage
of acmp followed by equals(). Null checks are ignored.

This works by:

- delaying inlining of Object.equals()
- After parsing is over, going over the equals() call, looking for
an acmp and tagging one if found as "followed by equals".
- tagging non already tagged acmp as "not followed by equals"
- attempting inlining of Object.equals() using existing JIT heuristics.

I then ran specjvm2008 tests with this. Here is the percentage of acmp
followed by equals according to this.

Compiler.compiler 5%
Compiler.sunflow 12%
Compress 0%
CryptoAes 0%
CryptoRsa 4%
CryptoSignVerify 0%
Derby 52%
MpegAudio 0%
ScimarkFFT 0%
ScimarkLU 0%
ScimarkMonteCarlo 0%
ScimarkSOR 0%
ScimarkSparse 0%
Serial 17%
Sunflow 0%
XmlTransform 10%
XmlValidation 20%


More information about the valhalla-dev mailing list