JDK-8058941 : C1: multiple compilation bailouts due to CodeBuffer overflow on nashorn/octane
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9,10
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2014-09-23
  • Updated: 2018-10-05
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.
Other
tbdUnresolved
Related Reports
Blocks :  
Description
There are multiple compilation bailouts in C1 when running octane/nashorn.
For example, Box2D has

NMethodSizeLimit is what guides the compiler. 

My observations during quick experiments with changing the limit (512k, Box2D on linux-amd64):
   * default value:
      - 1st iteration: 9-10s
      - <1s: ~9-10th iteration: 
      - <100ms: ~100-110th iteration

   * increase to 2M:
     - bailouts are completely eliminated;  
     - warmup slows down:
        - 1st: 10-11s; <1s: 15-20th iteration; <100ms: 110-120th iteration

   * decrease to 128K:
     - 4x more bailouts
     - at the beginning, slightly improves warmup, but introduces plateau on a higher level (~130-150ms till ~130-140th iter):
        - 1st: ~9s; <1s: 7-8th; <100ms: 140th 

It seems heavy compilations can stuck compiling and considerably reduce code generation throughput on levels 1/2/3, which negatively impacts application warmup. On the other hand, using interpreter more (due to more bailouts) gives slight improvements during first dozen iterations, it considerably worsen performance until C2 kicks in.   
Comments
This affects Nashorn a lot. Of a total 75 secs of bailout compilations in Octane, we spend half here. Quick VM instrumentation patch: http://cr.openjdk.java.net/~shade/8058941/bailout-stat.patch Yields: http://cr.openjdk.java.net/~shade/8058941/nashorn-octane.txt Total compilation time : 360.272 s Bailout reasons: 0.281 secs: Method and/or inlining is too large 51.601 secs: CodeBuffer overflow 2.378 secs: out of nodes before split 1.979 secs: out of nodes after split 36.995 secs: invalid non-klass dependency 0.749 secs: Out of nodes 20.029 secs: out of nodes during split
23-09-2014