JDK-6741738 : TypePtr::add_offset() set incorrect offset when the add overflows
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs14
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris
  • CPU: x86
  • Submitted: 2008-08-26
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
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 6 JDK 7 Other
6u14Fixed 7Fixed hs14Fixed
Description
The next code shows the problem:

public class Bug647 {

        private String[] values;
        private int count;

        String foo() {
                int i = Integer.MAX_VALUE-1;
                return values[i];
        }

        public static void main(String[] args) {
                Bug647 t = new Bug647();
                String s = t.foo();
        }
}


$ java -Xcomp -XX:CompileOnly=Bug647.foo -XX:+PrintCompilation -cp . Bug647
VM option 'CompileOnly=Bug647.foo'
VM option '+PrintCompilation'
CompileOnly: compileonly *Bug647*.foo
  1   b   Bug647::foo (10 bytes)
o62     LoadP   === o66 o7 o61  [[o63  30 ]]  @java/lang/Object *[int:>=0]+any*, idx=5; #java/lang/String:exact *  Oop:java/lang/String:exact *

mach:
 33     loadConL        === _  [[ 32 ]]   [3000033]
o26     LoadP   === _ o7 o25  [[o55 o28 o36 o61 o61 o43 o43  32 ]]  @Bug647+24*, name=values, idx=4; #java/lang/String:exact *[int:>=0]:exact *
o7      Parm    === o3  [[o63 o62 o55 o44 o26 o36  32 ]] Memory  Memory:@BotPTR *+bot, idx=Bot;
o66     IfFalse === o65  [[o62 o63  32 ]] #0
 32     loadP   === o66 o7 o26  33  [[]] java/lang/String:exact * Oop:java/lang/String:exact *
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=\matcher.cpp:1484
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (C:\...\hotspot\src\share\vm\opto\matcher.cpp:1484), pid=24028, tid=23040
#  Error: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/af945ba2e739
28-08-2008

SUGGESTED FIX TypePtr::add_offset() should set the offset to OffsetBot when the add overflows.
26-08-2008

EVALUATION AddPNode::bottom_type() and AddPNode::Value() have the point fix when an offset add overflows and AddPNode::mach_bottom_type() does not have it. Which leads to type mismatch.
26-08-2008