Skip to content

Commit 6e0da99

Browse files
author
Vladimir Kozlov
committed
8263448: CTW: fatal error: meet not symmetric
Reviewed-by: roland
1 parent 328e951 commit 6e0da99

File tree

1 file changed

+25
-58
lines changed

1 file changed

+25
-58
lines changed

src/hotspot/share/opto/type.cpp

Lines changed: 25 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3780,50 +3780,8 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
37803780
case RawPtr: return TypePtr::BOTTOM;
37813781

37823782
case AryPtr: { // All arrays inherit from Object class
3783-
const TypeAryPtr *tp = t->is_aryptr();
3784-
int offset = meet_offset(tp->offset());
3785-
PTR ptr = meet_ptr(tp->ptr());
3786-
int instance_id = meet_instance_id(tp->instance_id());
3787-
const TypePtr* speculative = xmeet_speculative(tp);
3788-
int depth = meet_inline_depth(tp->inline_depth());
3789-
switch (ptr) {
3790-
case TopPTR:
3791-
case AnyNull: // Fall 'down' to dual of object klass
3792-
// For instances when a subclass meets a superclass we fall
3793-
// below the centerline when the superclass is exact. We need to
3794-
// do the same here.
3795-
if (klass()->equals(ciEnv::current()->Object_klass()) && !klass_is_exact()) {
3796-
return TypeAryPtr::make(ptr, tp->ary(), tp->klass(), tp->klass_is_exact(), offset, instance_id, speculative, depth);
3797-
} else {
3798-
// cannot subclass, so the meet has to fall badly below the centerline
3799-
ptr = NotNull;
3800-
instance_id = InstanceBot;
3801-
return TypeInstPtr::make( ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
3802-
}
3803-
case Constant:
3804-
case NotNull:
3805-
case BotPTR: // Fall down to object klass
3806-
// LCA is object_klass, but if we subclass from the top we can do better
3807-
if( above_centerline(_ptr) ) { // if( _ptr == TopPTR || _ptr == AnyNull )
3808-
// If 'this' (InstPtr) is above the centerline and it is Object class
3809-
// then we can subclass in the Java class hierarchy.
3810-
// For instances when a subclass meets a superclass we fall
3811-
// below the centerline when the superclass is exact. We need
3812-
// to do the same here.
3813-
if (klass()->equals(ciEnv::current()->Object_klass()) && !klass_is_exact()) {
3814-
// that is, tp's array type is a subtype of my klass
3815-
return TypeAryPtr::make(ptr, (ptr == Constant ? tp->const_oop() : NULL),
3816-
tp->ary(), tp->klass(), tp->klass_is_exact(), offset, instance_id, speculative, depth);
3817-
}
3818-
}
3819-
// The other case cannot happen, since I cannot be a subtype of an array.
3820-
// The meet falls down to Object class below centerline.
3821-
if( ptr == Constant )
3822-
ptr = NotNull;
3823-
instance_id = InstanceBot;
3824-
return make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
3825-
default: typerr(t);
3826-
}
3783+
// Call in reverse direction to avoid duplication
3784+
return t->is_aryptr()->xmeet_helper(this);
38273785
}
38283786

38293787
case OopPtr: { // Meeting to OopPtrs
@@ -3961,8 +3919,12 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
39613919
k = above_centerline(ptr) ? tinst_klass : ciEnv::current()->Object_klass();
39623920
xk = above_centerline(ptr) ? tinst_xk : false;
39633921
// Watch out for Constant vs. AnyNull interface.
3964-
if (ptr == Constant) ptr = NotNull; // forget it was a constant
3965-
instance_id = InstanceBot;
3922+
if (ptr == Constant) {
3923+
ptr = NotNull; // forget it was a constant
3924+
}
3925+
if (instance_id > 0) {
3926+
instance_id = InstanceBot;
3927+
}
39663928
}
39673929
ciObject* o = NULL; // the Constant value, if any
39683930
if (ptr == Constant) {
@@ -4051,9 +4013,9 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
40514013

40524014
// Since klasses are different, we require a LCA in the Java
40534015
// class hierarchy - which means we have to fall to at least NotNull.
4054-
if( ptr == TopPTR || ptr == AnyNull || ptr == Constant )
4016+
if (ptr == TopPTR || ptr == AnyNull || ptr == Constant) {
40554017
ptr = NotNull;
4056-
4018+
}
40574019
instance_id = InstanceBot;
40584020

40594021
// Now we find the LCA of Java classes
@@ -4495,16 +4457,18 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
44954457
// Only precise for identical arrays
44964458
xk = this->_klass_is_exact && (klass() == tap->klass());
44974459
}
4498-
return TypeAryPtr::make(ptr, o, tary, lazy_klass, xk, off, instance_id, speculative, depth);
4460+
return make(ptr, o, tary, lazy_klass, xk, off, instance_id, speculative, depth);
44994461
}
45004462
case NotNull:
45014463
case BotPTR:
45024464
// Compute new klass on demand, do not use tap->_klass
4503-
if (above_centerline(this->_ptr))
4504-
xk = tap->_klass_is_exact;
4505-
else xk = (tap->_klass_is_exact & this->_klass_is_exact) &&
4506-
(klass() == tap->klass()); // Only precise for identical arrays
4507-
return TypeAryPtr::make(ptr, NULL, tary, lazy_klass, xk, off, instance_id, speculative, depth);
4465+
if (above_centerline(this->_ptr)) {
4466+
xk = tap->_klass_is_exact;
4467+
} else {
4468+
xk = (tap->_klass_is_exact & this->_klass_is_exact) &&
4469+
(klass() == tap->klass()); // Only precise for identical arrays
4470+
}
4471+
return make(ptr, NULL, tary, lazy_klass, xk, off, instance_id, speculative, depth);
45084472
default: ShouldNotReachHere();
45094473
}
45104474
}
@@ -4524,7 +4488,7 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
45244488
// below the centerline when the superclass is exact. We need to
45254489
// do the same here.
45264490
if (tp->klass()->equals(ciEnv::current()->Object_klass()) && !tp->klass_is_exact()) {
4527-
return TypeAryPtr::make(ptr, _ary, _klass, _klass_is_exact, offset, instance_id, speculative, depth);
4491+
return make(ptr, _ary, _klass, _klass_is_exact, offset, instance_id, speculative, depth);
45284492
} else {
45294493
// cannot subclass, so the meet has to fall badly below the centerline
45304494
ptr = NotNull;
@@ -4549,10 +4513,13 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
45494513
}
45504514
// The other case cannot happen, since t cannot be a subtype of an array.
45514515
// The meet falls down to Object class below centerline.
4552-
if( ptr == Constant )
4516+
if (ptr == Constant) {
45534517
ptr = NotNull;
4554-
instance_id = InstanceBot;
4555-
return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL,offset, instance_id, speculative, depth);
4518+
}
4519+
if (instance_id > 0) {
4520+
instance_id = InstanceBot;
4521+
}
4522+
return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
45564523
default: typerr(t);
45574524
}
45584525
}

0 commit comments

Comments
 (0)