United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6589823 Error: meet not symmetric
JDK-6589823 : Error: meet not symmetric

Details
Type:
Bug
Submit Date:
2007-08-06
Status:
Closed
Updated Date:
2011-04-25
Project Name:
JDK
Resolved Date:
2011-04-25
Component:
hotspot
OS:
solaris_9
Sub-Component:
compiler
CPU:
sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs12
Fixed Versions:
hs21 (b05)

Related Reports
Backport:
Relates:
Relates:
Relates:

Sub Tasks

Description
It could be duplicate of 6589186 but the failure is different.
64-bits VM sparcv9 start failing after John's putback
20070719212032.jrose.6337834

jaberwocky% gamma -Xcomp -XX:CompileThreshold=100 -Xss4m -Xverify:all -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=8000 -Xbootclasspath/p:/net/vmsqe.sfbay/export/backup/testbase/CompileTheWorld/jarfiles/jck13classes.jar
...
CompileTheWorld (11068) : javasoft/sqe/tests/lang/conv080/conv08001/conv08001i
CompileTheWorld (11069) : javasoft/sqe/tests/lang/conv081/conv08101/conv08101
=== Meet Not Symmetric ===
t   =                   javasoft/sqe/tests/lang/conv081/conv08101/SomeClass:TopPTR *[int:max..0:www]:AnyNull:exact*
this=                   javasoft/sqe/tests/lang/conv081/conv08101/ImmediateSubclass:TopPTR *[int:5:www]:AnyNull:exact*
mt=(t meet this)=       javasoft/sqe/tests/lang/conv081/conv08101/ImmediateSubclass:TopPTR *[int:5:www]:AnyNull:exact*
t_dual=                 javasoft/sqe/tests/lang/conv081/conv08101/SomeClass *[int:>=0]:NotNull:exact*
this_dual=              javasoft/sqe/tests/lang/conv081/conv08101/ImmediateSubclass *[int:5]:NotNull:exact*
mt_dual=                javasoft/sqe/tests/lang/conv081/conv08101/ImmediateSubclass *[int:5]:NotNull:exact*
mt_dual meet t_dual=    javasoft/sqe/tests/lang/conv081/conv08101/SomeClass *[int:>=0]:NotNull*
mt_dual meet this_dual= javasoft/sqe/tests/lang/conv081/conv08101/ImmediateSubclass *[int:5]:NotNull:exact*
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/type.cpp:520
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  Internal Error (/net/prt-sol-sparc-3/tmp/PrtBuildDir/workspace/src/share/vm/opto/type.cpp:520), pid=838, tid=8
#  Error: meet not symmetric
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20070719212032.jrose.6337834-fastdebug compiled mode solaris-sparc)
# An error report file with more information is saved as:
# /tmp/kvn/ctw/hs_err_pid838.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Current thread is 8
Dumping core ...
Abort

                                    

Comments
EVALUATION

Currently I can't reproduce the bug failure after next John's changes (in 2007):
6603492: multianewarray should generate same code as anewarray for 1-d arrays.
Static subtypes analysis in gen_subtype_check() hides this problem as well.
So one of the option is to derefer this bug from jdk 7.

But bug is still here and it can be reproduced by hand if you call TypeOopPtr::filter() for next types (ImmediateSubclass is subclass of SomeClass):

t1 = SomeClass *[int:>=0]:NotNull:exact*
t2 = ImmediateSubclass *[int:5]:NotNull:exact*

The main problem is TypeAryPtr::xmeet() executes TypeAry::meet() separate from TypeAryPtr type lattice analysis. Exactness of TypeAryPtr should affect result of TypeAry::meet() but it does not:

=== Meet Not Symmetric ===
t   =                   SomeClass:TopPTR *,iid=top[int:max..0]:AnyNull:exact *,iid=top
this=                   ImmediateSubclass:TopPTR *,iid=top[int:5]:AnyNull:exact *,iid=top
mt=(t meet this)=       ImmediateSubclass:TopPTR *,iid=top[int:5]:AnyNull:exact *,iid=top
t_dual=                 SomeClass *[int:>=0]:NotNull:exact *
this_dual=              ImmediateSubclass *[int:5]:NotNull:exact *
mt_dual=                ImmediateSubclass *[int:5]:NotNull:exact *
mt_dual meet t_dual=    SomeClass *[int:>=0]:NotNull *
mt_dual meet this_dual= ImmediateSubclass *[int:5]:NotNull:exact *

It fails since "mt_dual meet t_dual" != "t_dual".
Here is how TypeInstPtr::xmeet() works in similar case:

t   =                   SomeClass:AnyNull:exact *,iid=top
this=                   ImmediateSubclass:AnyNull:exact *,iid=top
mt=(t meet this)=       SomeClass:NotNull *
t_dual=                 SomeClass:NotNull:exact*
this_dual=              ImmediateSubclass:NotNull:exact*
mt_dual=                SomeClass:AnyNull*
mt_dual meet t_dual=    SomeClass:NotNull:exact*
mt_dual meet this_dual= ImmediateSubclass:NotNull:exact*

Note that "mt" is dropped down in lattice. Here is code which does it:

    // Since klasses are different, we require a LCA in the Java
    // class hierarchy - which means we have to fall to at least NotNull.
    if( ptr == TopPTR || ptr == AnyNull || ptr == Constant )
      ptr = NotNull;
    instance_id = InstanceBot;

    // Now we find the LCA of Java classes
    ciKlass* k = this_klass->least_common_ancestor(tinst_klass);
    return make( ptr, k, false, NULL, off, instance_id );

There are no such code in TypeAryPtr. And type system falls apart when I tried to implement (seems wrong) the same functionality in TypeAryPtr by coping code from TypeInstPtr::xmeet():

=== Meet Not Symmetric ===
t   =                   SomeClass *[int:5]:NotNull:exact *
this=                   ImmediateSubclass *[int:5]:NotNull:exact *
mt=(t meet this)=       SomeClass *[int:>=0] *
t_dual=                 SomeClass:TopPTR *,iid=top[int:5]:AnyNull:exact *,iid=top
this_dual=              ImmediateSubclass:TopPTR *,iid=top[int:5]:AnyNull:exact *,iid=top
mt_dual=                SomeClass:TopPTR *,iid=top[int:max..0]:TopPTR *,iid=top
mt_dual meet t_dual=    SomeClass:TopPTR *,iid=top[int:max..0]:AnyNull:exact *,iid=top
mt_dual meet this_dual= ImmediateSubclass:TopPTR *,iid=top[int:5]:AnyNull:exact *,iid=top

Here is webrev, new code is under UseNewCode:

http://cr.openjdk.java.net/~kvn/6589823/webrev

Test case:

/net/sqenfs-1/export1/comp/vm/testbase/jck/6b/dist/JCK-runtime-6b/tests/lang/CONV/conv081/conv08101/conv08101.java
                                     
2011-03-01
EVALUATION

Tom added next code into C2 and I extended it to show the problem:

      const TypeAryPtr* obj  = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInstPtr::BOTTOM,TypeInt::POS), NULL,  true,  0);
      const TypeAryPtr* num  = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInstPtr::make(TypePtr::BotPTR,  env()->Integer_klass()->super()),TypeInt::POS), NULL,  true, 0);
      const Type* m1 = obj->cast_to_exactness(true)->meet(num->cast_to_exactness(true));
      const Type* m2 = obj->cast_to_exactness(true)->meet(num->cast_to_exactness(false));
      const Type* m3 = obj->cast_to_exactness(false)->meet(num->cast_to_exactness(true));
      const Type* m4 = obj->cast_to_exactness(false)->meet(num->cast_to_exactness(false));
      const Type* j1 = obj->cast_to_exactness(true)->join(num->cast_to_exactness(true));
      const Type* j2 = obj->cast_to_exactness(true)->join(num->cast_to_exactness(false));
      const Type* j3 = obj->cast_to_exactness(false)->join(num->cast_to_exactness(true));
      const Type* j4 = obj->cast_to_exactness(false)->join(num->cast_to_exactness(false));

      const TypeAryPtr* thr  = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInstPtr::make(TypePtr::BotPTR,  env()->Thread_klass()),TypeInt::POS), NULL,  true, 0);
      const Type* tm1 = thr->cast_to_exactness(true)->meet(num->cast_to_exactness(true));
      const Type* tm2 = thr->cast_to_exactness(true)->meet(num->cast_to_exactness(false));
      const Type* tm3 = thr->cast_to_exactness(false)->meet(num->cast_to_exactness(true));
      const Type* tm4 = thr->cast_to_exactness(false)->meet(num->cast_to_exactness(false));
      const Type* tj1 = thr->cast_to_exactness(true)->join(num->cast_to_exactness(true));
      const Type* tj2 = thr->cast_to_exactness(true)->join(num->cast_to_exactness(false));
      const Type* tj3 = thr->cast_to_exactness(false)->join(num->cast_to_exactness(true));
      const Type* tj4 = thr->cast_to_exactness(false)->join(num->cast_to_exactness(false));

      const TypeAryPtr* str  = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInstPtr::make(TypePtr::BotPTR,  env()->String_klass()),TypeInt::POS), NULL,  true, 0);
      const Type* sm1 = str->cast_to_exactness(true)->meet(num->cast_to_exactness(true));
      const Type* sm2 = str->cast_to_exactness(true)->meet(num->cast_to_exactness(false));
      const Type* sm3 = str->cast_to_exactness(false)->meet(num->cast_to_exactness(true));
      const Type* sm4 = str->cast_to_exactness(false)->meet(num->cast_to_exactness(false));
      const Type* sj1 = str->cast_to_exactness(true)->join(num->cast_to_exactness(true));
      const Type* sj2 = str->cast_to_exactness(true)->join(num->cast_to_exactness(false));
      const Type* sj3 = str->cast_to_exactness(false)->join(num->cast_to_exactness(true));
      const Type* sj4 = str->cast_to_exactness(false)->join(num->cast_to_exactness(false));
                                     
2011-03-04
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/8e72cd29b15d
                                     
2011-03-06
PUBLIC COMMENTS

Array pointers meet must fall to bottom if exact array klasses in upper lattice are not equal or super klass is exact.
                                     
2011-03-07
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/8e72cd29b15d
                                     
2011-03-21



Hardware and Software, Engineered to Work Together