JDK-7112478 : after 7105605 JRuby bench_define_method_methods.rb fails with NPE
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs23
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-11-16
  • Updated: 2012-03-22
  • Resolved: 2012-01-20
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 7 JDK 8 Other
7u4Fixed 8Fixed hs23Fixed
Related Reports
Relates :  
Description
$ jruby -J-showversion -X+C -J-d32 --server -J-Xbatch bench/bench_define_method_methods.rb
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b12)
Java HotSpot(TM) Server VM (build 23.0-b06-internal, mixed mode)

                                                                  user     system      total        real
control, simple method, 10k * 100 invocations                 0.418000   0.000000   0.418000 (  0.345000)
define_method(:foo) {1}, 10k * 100 invocations                0.954000   0.000000   0.954000 (  0.955000)
eval'ed define_method(:baz) {1}, 10k * 100 invocations      Formatter.java:2472:in `format': java.lang.NullPointerException
        from Formatter.java:2423:in `format'
        from String.java:2845:in `format'
        from RubyModule.java:439:in `calculateAnonymousName'
        from RubyModule.java:410:in `calculateName'
        from RubyModule.java:401:in `getName'
...

Disabling OptimizePtrCompare makes the test pass:

$ jruby -J-showversion -X+C -J-d32 --server -J-Xbatch -J-XX:-OptimizePtrCompare bench/bench_define_method_methods.rb
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b12)
Java HotSpot(TM) Server VM (build 23.0-b06-internal, mixed mode)

                                                                  user     system      total        real
control, simple method, 10k * 100 invocations                 0.401000   0.000000   0.401000 (  0.341000)
define_method(:foo) {1}, 10k * 100 invocations                0.976000   0.000000   0.976000 (  0.976000)
eval'ed define_method(:baz) {1}, 10k * 100 invocations        2.715000   0.000000   2.715000 (  2.715000)
define_method(:bar) {a = 1}, 10k * 100 invocations            0.779000   0.000000   0.779000 (  0.779000)
b = 1; define_method(:baz) {b = 2}, 10k * 100 invocations     0.759000   0.000000   0.759000 (  0.759000)
...

Comments
EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/cc81b9c09bbb
22-03-2012

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-emb/hotspot/rev/cc81b9c09bbb
15-12-2011

EVALUATION Added missing edges from arraycopy's destination fields to fields of source object. Mark source object as global escape if we are not sure that all edges are created. EA bytecode analyzer gives incorrect information about returned object if there were state merges with processed block. Also call's result missed reference to returned arguments and unknown object when not only arguments is returned. Added missing reference to NULL from array elements with OffsetBot offset. Make sure that LocalVar and Field have edge to at least unknown object before removing deferred edges from the graph. Moved escaped state propagation code to execute it after Connection Graph is completed and skip the rest of code if all objects globally escaped. Also added accessors to check for null and unknown pointers. And don't add fields edges to NULL pointer object.
29-11-2011

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/cc81b9c09bbb
29-11-2011

EVALUATION Incomplete Connection graph.
18-11-2011

EVALUATION $ jruby -X+C -J-d32 --server -J-Xbatch -J-XX:CICompilerCount=1 -J-XX:+PrintCompilation -J-XX:+PrintOptimizePtrCompare bench/bench_define_method_methods.rb ... 7909 254 !b java.util.Formatter::format (271 bytes) ++++ Replaced: 4787 CmpP(4786,38) --> EQ 8061 37 java.lang.AbstractStringBuilder::append (48 bytes) made not entrant Formatter.java:2472:in `format': java.lang.NullPointerException from Formatter.java:2423:in `format' from String.java:2845:in `format' ...
16-11-2011

WORK AROUND -XX:-OptimizePtrCompare
16-11-2011