JDK-8150463 : StringConcat MH_INLINE_SIZED_EXACT should skip storage initialization
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-02-23
  • Updated: 2016-04-11
  • Resolved: 2016-03-24
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
9 b112Fixed
Related Reports
Blocks :  
Blocks :  
Description
MH_INLINE_SIZED_EXACT strategy is known to win in many cases where OptimizeStringConcat does not work, but it is penalized when OptimizeStringConcat does work:
 http://cr.openjdk.java.net/~shade/8150463/perf-bad.txt

"perfasm" profiling shows this is because MH_INLINE_SIZED_EXACT has to allocate the underlying storage from Java, which requires zeroing; while C2 is able to avoid zeroing altogether, because it knows the array would get overwritten completely:
  http://cr.openjdk.java.net/~shade/8150463/BC_SB.perfasm
  http://cr.openjdk.java.net/~shade/8150463/MH_INLINE_SIZED_EXACT.perfasm

We need to solve this before switching to most optimal concat strategy.
Comments
Webrev: http://cr.openjdk.java.net/~shade/8150463/webrev.01/ Performance had improved: http://cr.openjdk.java.net/~shade/8150463/perf.txt
16-03-2016

JDK-8150463 may bring the necessary API to use in StringConcatFactory. My preliminary runs with JDK-8150463 patch are very positive. StringConcatFactory would probably have to provide a few more checks if using any new Unsafe API: notably the "exactness" debug check in MH_INLINE_SIZED_EXACT should probably be turned on by default -- this will check we never ever construct a String with garbage data.
25-02-2016