JDK-8150038 : aarch64: Make use of CBZ and CBNZ when comparing narrow pointer with zero
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: aarch64
  • Submitted: 2016-02-17
  • Updated: 2021-02-01
  • Resolved: 2016-03-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9 Other
9 b110Fixed openjdk8u292Fixed
Related Reports
Relates :  
Description
For several times I noticed the following pattern in JIT code (the java heap size is set to 200MB):

   2042   0x0000007f6c9419c4: ldr       w14, [x11,#32]  ;*getfield buffer
   2043                                                 ; - org.apache.hadoop.io.DataInputBuffer::reset@1 (line 83)
   2044                                                 ; - org.apache.hadoop.mapreduce.task.ReduceContextImpl::nextKeyValue@88 (line 141)
   2045                                                 ; - org.apache.hadoop.mapreduce.task.ReduceContextImpl$ValueIterator::next@209 (li        ne 239)
   2046                                                 ; - org.apache.hadoop.examples.WordCount$IntSumReducer::reduce@23 (line 60)
   2047
   2048   0x0000007f6c9419c8: cmp       w14, wzr
   2049   0x0000007f6c9419cc: b.eq      0x0000007f6c9425e4  ;*invokevirtual reset
   2050                                                 ; - org.apache.hadoop.io.DataInputBuffer::reset@7 (line 83)
   2051                                                 ; - org.apache.hadoop.mapreduce.task.ReduceContextImpl::nextKeyValue@88 (line 141)
   2052                                                 ; - org.apache.hadoop.mapreduce.task.ReduceContextImpl$ValueIterator::next@209 (li        ne 239)

The two cmp and b.eq instructions can be combined into one "cbz" instruction.

Currently, the aarch64 port only makes use of CBZ and CBNZ when comparing operands with Integer/Long/Pointer type with zero.  The issue can be fixed by add one similar combine template in the ad file for Narrow pointer types, just like the sparc port does.