JDK-7181658 : CTW: assert(t->meet(t0) == t) failed: Not monotonic
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-07-04
  • Updated: 2013-10-23
  • Resolved: 2012-07-14
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
7u40Fixed 8Fixed hs24Fixed
Description
% /java/re/jdk/8/latest//binaries/linux-i586/fastdebug/bin/java -XX:+CompileTheWorld -Xbootclasspath/p:/net/sqenfs-1/export1/comp/vm/testbase/ctw/full/maven2/directory/apacheds-main/0.9.3/apacheds-main-0.9.3.jar
[...]
CompileTheWorld (1254) : org/apache/commons/lang/StringPrintWriter
CompileTheWorld (1255) : org/apache/commons/lang/StringUtils
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/phaseX.cpp:1353
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/HUDSON/workspace/jdk8-2-build-linux-i586-product/jdk8/hotspot/src/share/vm/opto/phaseX.cpp:1353), pid=6029, tid=2761947968
#  assert(t->meet(t0) == t) failed: Not monotonic
#
# JRE version: 8.0-b45
# Java VM: Java HotSpot(TM) Server VM (24.0-b14-fastdebug mixed mode linux-x86 )

Comments
EVALUATION http://hg.openjdk.java.net/hsx/hotspot-emb/hotspot/rev/ae9241bbce4a
14-07-2012

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/ae9241bbce4a
11-07-2012

EVALUATION http://cr.openjdk.java.net/~vlivanov/7181658/webrev.01
10-07-2012

EVALUATION The problem is in the following code: 555 } else if (hi0 <= lo1) { 556 // Check for special case in Hashtable::get. (See below.) 557 if ((jint)lo0 >= 0 && (jint)lo1 >= 0 && 558 in(1)->Opcode() == Op_ModI && 559 in(1)->in(2) == in(2) ) 560 return TypeInt::CC_LT; 561 return TypeInt::CC_LE; 562 } During 2nd iteration of CCP over CmpU node, 867: #int:0 416: #int:0..1073741820 "in(1)->in(2) == in(2)" doesn't take CastII node into account, so TypeInt::CC_LE (#int:-1..0) is returned. On the next pass, [1] infers TypeInt::CC_LT and it breaks monotonicity assumption of CCP optimization. [1] 570 if ((jint)lo0 >= 0 && (jint)lo1 >= 0 && 571 in(1)->Opcode() == Op_ModI && 572 in(1)->in(2)->uncast() == in(2)->uncast()) 573 return TypeInt::CC_LT; 574 return TypeInt::CC; // else use worst case results 575 } The fix is trivial: @@ -556,7 +556,7 @@ // Check for special case in Hashtable::get. (See below.) if ((jint)lo0 >= 0 && (jint)lo1 >= 0 && in(1)->Opcode() == Op_ModI && - in(1)->in(2) == in(2) ) + in(1)->in(2)->eqv_uncast( in(2) )) return TypeInt::CC_LT; return TypeInt::CC_LE; }
05-07-2012

EVALUATION Ignore my previous comment: behavior at 578 is correct, since 416 is CastII node and it's in(1) == #373.
05-07-2012

EVALUATION n1 (= #861->in(1)->in(2) ) == #373 n2 (= #861->in(2) ) == #416 But: n1->uncast() == #373 n2->uncast() == #373 So, "in(1)->in(2)->uncast() == in(2)->uncast())" erroneously succeeds.
05-07-2012

EVALUATION CmpUNode::sub computes int:-1..0 in the following place: const Type *CmpUNode::sub( const Type *t1, const Type *t2 ) const { 570 if ((jint)lo0 >= 0 && (jint)lo1 >= 0 && 571 in(1)->Opcode() == Op_ModI && 572 in(1)->in(2)->uncast() == in(2)->uncast()) 573 return TypeInt::CC_LT; <============= int:-1..0 574 return TypeInt::CC; // else use worst case results 575 }} However, graph shape doesn't match preconditions (#861->in(1)->in(2) != #861->in(2)): 416 CastII === 397 373 [[ 521 822 861 906 ]] #int:0..1073741820 !jvms: String::toCharArray @ bci:20 StringUtils::rightPad @ bci:105 867 ModI === 800 877 373 [[ 861 866 888 ]] !orig=519 !jvms: StringUtils::rightPad @ bci:129 861 CmpU === _ 867 416 [[ 860 ]] !orig=521 !jvms: StringUtils::rightPad @ bci:130
05-07-2012

EVALUATION PhaseCCP::analyze(): ... while( worklist.size() ) { Node *n = worklist.pop(); const Type *t = n->Value(this); if (t != type(n)) { assert(ccp_type_widens(t, type(n)), "ccp type must widen"); static bool ccp_type_widens(const Type* t, const Type* t0) { assert(t->meet(t0) == t, "Not monotonic"); n: 861 CmpU === _ 867 416 [[ 860 ]] !orig=521 !jvms: StringUtils::rightPad @ bci:130 t: int:-1 t0 (type(n)): int:-1..0 t->meet(t0): int:-1..0
04-07-2012