Skip to content
Permalink
Browse files

8263448: CTW: fatal error: meet not symmetric

Reviewed-by: roland
  • Loading branch information
Vladimir Kozlov committed Apr 1, 2021
1 parent 328e951 commit 6e0da9961f58bfbf863d6e97e375d854a2b263de
Showing with 25 additions and 58 deletions.
  1. +25 −58 src/hotspot/share/opto/type.cpp
@@ -3780,50 +3780,8 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
case RawPtr: return TypePtr::BOTTOM;

case AryPtr: { // All arrays inherit from Object class
const TypeAryPtr *tp = t->is_aryptr();
int offset = meet_offset(tp->offset());
PTR ptr = meet_ptr(tp->ptr());
int instance_id = meet_instance_id(tp->instance_id());
const TypePtr* speculative = xmeet_speculative(tp);
int depth = meet_inline_depth(tp->inline_depth());
switch (ptr) {
case TopPTR:
case AnyNull: // Fall 'down' to dual of object klass
// For instances when a subclass meets a superclass we fall
// below the centerline when the superclass is exact. We need to
// do the same here.
if (klass()->equals(ciEnv::current()->Object_klass()) && !klass_is_exact()) {
return TypeAryPtr::make(ptr, tp->ary(), tp->klass(), tp->klass_is_exact(), offset, instance_id, speculative, depth);
} else {
// cannot subclass, so the meet has to fall badly below the centerline
ptr = NotNull;
instance_id = InstanceBot;
return TypeInstPtr::make( ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
}
case Constant:
case NotNull:
case BotPTR: // Fall down to object klass
// LCA is object_klass, but if we subclass from the top we can do better
if( above_centerline(_ptr) ) { // if( _ptr == TopPTR || _ptr == AnyNull )
// If 'this' (InstPtr) is above the centerline and it is Object class
// then we can subclass in the Java class hierarchy.
// For instances when a subclass meets a superclass we fall
// below the centerline when the superclass is exact. We need
// to do the same here.
if (klass()->equals(ciEnv::current()->Object_klass()) && !klass_is_exact()) {
// that is, tp's array type is a subtype of my klass
return TypeAryPtr::make(ptr, (ptr == Constant ? tp->const_oop() : NULL),
tp->ary(), tp->klass(), tp->klass_is_exact(), offset, instance_id, speculative, depth);
}
}
// The other case cannot happen, since I cannot be a subtype of an array.
// The meet falls down to Object class below centerline.
if( ptr == Constant )
ptr = NotNull;
instance_id = InstanceBot;
return make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
default: typerr(t);
}
// Call in reverse direction to avoid duplication
return t->is_aryptr()->xmeet_helper(this);
}

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

// 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 )
if (ptr == TopPTR || ptr == AnyNull || ptr == Constant) {
ptr = NotNull;

}
instance_id = InstanceBot;

// Now we find the LCA of Java classes
@@ -4495,16 +4457,18 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
// Only precise for identical arrays
xk = this->_klass_is_exact && (klass() == tap->klass());
}
return TypeAryPtr::make(ptr, o, tary, lazy_klass, xk, off, instance_id, speculative, depth);
return make(ptr, o, tary, lazy_klass, xk, off, instance_id, speculative, depth);
}
case NotNull:
case BotPTR:
// Compute new klass on demand, do not use tap->_klass
if (above_centerline(this->_ptr))
xk = tap->_klass_is_exact;
else xk = (tap->_klass_is_exact & this->_klass_is_exact) &&
(klass() == tap->klass()); // Only precise for identical arrays
return TypeAryPtr::make(ptr, NULL, tary, lazy_klass, xk, off, instance_id, speculative, depth);
if (above_centerline(this->_ptr)) {
xk = tap->_klass_is_exact;
} else {
xk = (tap->_klass_is_exact & this->_klass_is_exact) &&
(klass() == tap->klass()); // Only precise for identical arrays
}
return make(ptr, NULL, tary, lazy_klass, xk, off, instance_id, speculative, depth);
default: ShouldNotReachHere();
}
}
@@ -4524,7 +4488,7 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
// below the centerline when the superclass is exact. We need to
// do the same here.
if (tp->klass()->equals(ciEnv::current()->Object_klass()) && !tp->klass_is_exact()) {
return TypeAryPtr::make(ptr, _ary, _klass, _klass_is_exact, offset, instance_id, speculative, depth);
return make(ptr, _ary, _klass, _klass_is_exact, offset, instance_id, speculative, depth);
} else {
// cannot subclass, so the meet has to fall badly below the centerline
ptr = NotNull;
@@ -4549,10 +4513,13 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
}
// The other case cannot happen, since t cannot be a subtype of an array.
// The meet falls down to Object class below centerline.
if( ptr == Constant )
if (ptr == Constant) {
ptr = NotNull;
instance_id = InstanceBot;
return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL,offset, instance_id, speculative, depth);
}
if (instance_id > 0) {
instance_id = InstanceBot;
}
return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
default: typerr(t);
}
}

1 comment on commit 6e0da99

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 6e0da99 Apr 1, 2021

Please sign in to comment.