United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6741738 TypePtr::add_offset() set incorrect offset when the add overflows
JDK-6741738 : TypePtr::add_offset() set incorrect offset when the add overflows

Details
Type:
Bug
Submit Date:
2008-08-26
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
solaris
Sub-Component:
compiler
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs14
Fixed Versions:
hs14 (b04)

Related Reports
Backport:
Backport:

Sub Tasks

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
SUGGESTED FIX

TypePtr::add_offset() should set the offset to OffsetBot when the add overflows.
                                     
2008-08-26
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.
                                     
2008-08-26
EVALUATION

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



Hardware and Software, Engineered to Work Together