Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8248234: Disabling UseExactTypes crashes C2
Remove the flag since it is broken, untested and hasn't been used in many years.

Reviewed-by: kvn, redestad, neliasso
  • Loading branch information
TobiHartmann committed Jun 29, 2020
1 parent a793293 commit a25bacdd136b58babc1af642c778fe32b84cf23e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
@@ -246,9 +246,6 @@
develop(bool, UseUniqueSubclasses, true, \
"Narrow an abstract reference to the unique concrete subclass") \
\
develop(bool, UseExactTypes, true, \
"Use exact types to eliminate array store checks and v-calls") \
\
product(intx, TrackedInitializationLimit, 50, \
"When initializing fields, track up to this many words") \
range(0, 65535) \
@@ -2187,7 +2187,6 @@ const Type* LoadNode::klass_value_common(PhaseGVN* phase) const {
// See if we can become precise: no subklasses and no interface
// (Note: We need to support verified interfaces.)
if (!ik->is_interface() && !ik->has_subklass()) {
//assert(!UseExactTypes, "this code should be useless with exact types");
// Add a dependence; if any subclass added we need to recompile
if (!ik->is_final()) {
// %%% should use stronger assert_unique_concrete_subtype instead
@@ -2221,7 +2220,6 @@ const Type* LoadNode::klass_value_common(PhaseGVN* phase) const {
ciInstanceKlass* ik = base_k->as_instance_klass();
// See if we can become precise: no subklasses and no interface
if (!ik->is_interface() && !ik->has_subklass()) {
//assert(!UseExactTypes, "this code should be useless with exact types");
// Add a dependence; if any subclass added we need to recompile
if (!ik->is_final()) {
phase->C->dependencies()->assert_leaf_type(ik);
@@ -2232,7 +2230,6 @@ const Type* LoadNode::klass_value_common(PhaseGVN* phase) const {
}
return TypeKlassPtr::make(TypePtr::NotNull, ak, 0/*offset*/);
} else { // Found a type-array?
//assert(!UseExactTypes, "this code should be useless with exact types");
assert( ak->is_type_array_klass(), "" );
return TypeKlassPtr::make(ak); // These are always precise
}
@@ -2218,7 +2218,6 @@ bool TypeAry::empty(void) const {

//--------------------------ary_must_be_exact----------------------------------
bool TypeAry::ary_must_be_exact() const {
if (!UseExactTypes) return false;
// This logic looks at the element type of an array, and returns true
// if the element type is either a primitive or a final instance class.
// In such cases, an array built on this ary must have no subclasses.
@@ -3192,13 +3191,11 @@ const TypeOopPtr* TypeOopPtr::make_from_klass_common(ciKlass *klass, bool klass_
klass_is_exact = sub->is_final();
}
}
if (!klass_is_exact && try_for_exact
&& deps != NULL && UseExactTypes) {
if (!ik->is_interface() && !ik->has_subklass()) {
// Add a dependence; if concrete subclass added we need to recompile
deps->assert_leaf_type(ik);
klass_is_exact = true;
}
if (!klass_is_exact && try_for_exact && deps != NULL &&
!ik->is_interface() && !ik->has_subklass()) {
// Add a dependence; if concrete subclass added we need to recompile
deps->assert_leaf_type(ik);
klass_is_exact = true;
}
}
return TypeInstPtr::make(TypePtr::BotPTR, klass, klass_is_exact, NULL, 0);
@@ -3509,8 +3506,7 @@ const TypeInstPtr *TypeInstPtr::make(PTR ptr,
// Ptr is never Null
assert( ptr != Null, "NULL pointers are not typed" );

assert(instance_id <= 0 || xk || !UseExactTypes, "instances are always exactly typed");
if (!UseExactTypes) xk = false;
assert(instance_id <= 0 || xk, "instances are always exactly typed");
if (ptr == Constant) {
// Note: This case includes meta-object constants, such as methods.
xk = true;
@@ -3562,7 +3558,6 @@ const Type *TypeInstPtr::cast_to_ptr_type(PTR ptr) const {
//-----------------------------cast_to_exactness-------------------------------
const Type *TypeInstPtr::cast_to_exactness(bool klass_is_exact) const {
if( klass_is_exact == _klass_is_exact ) return this;
if (!UseExactTypes) return this;
if (!_klass->is_loaded()) return this;
ciInstanceKlass* ik = _klass->as_instance_klass();
if( (ik->is_final() || _const_oop) ) return this; // cannot clear xk
@@ -4069,8 +4064,7 @@ const TypeAryPtr *TypeAryPtr::make(PTR ptr, const TypeAry *ary, ciKlass* k, bool
assert(!(k == NULL && ary->_elem->isa_int()),
"integral arrays must be pre-equipped with a class");
if (!xk) xk = ary->ary_must_be_exact();
assert(instance_id <= 0 || xk || !UseExactTypes, "instances are always exactly typed");
if (!UseExactTypes) xk = (ptr == Constant);
assert(instance_id <= 0 || xk, "instances are always exactly typed");
return (TypeAryPtr*)(new TypeAryPtr(ptr, NULL, ary, k, xk, offset, instance_id, false, speculative, inline_depth))->hashcons();
}

@@ -4082,8 +4076,7 @@ const TypeAryPtr *TypeAryPtr::make(PTR ptr, ciObject* o, const TypeAry *ary, ciK
"integral arrays must be pre-equipped with a class");
assert( (ptr==Constant && o) || (ptr!=Constant && !o), "" );
if (!xk) xk = (o != NULL) || ary->ary_must_be_exact();
assert(instance_id <= 0 || xk || !UseExactTypes, "instances are always exactly typed");
if (!UseExactTypes) xk = (ptr == Constant);
assert(instance_id <= 0 || xk, "instances are always exactly typed");
return (TypeAryPtr*)(new TypeAryPtr(ptr, o, ary, k, xk, offset, instance_id, is_autobox_cache, speculative, inline_depth))->hashcons();
}

@@ -4097,7 +4090,6 @@ const Type *TypeAryPtr::cast_to_ptr_type(PTR ptr) const {
//-----------------------------cast_to_exactness-------------------------------
const Type *TypeAryPtr::cast_to_exactness(bool klass_is_exact) const {
if( klass_is_exact == _klass_is_exact ) return this;
if (!UseExactTypes) return this;
if (_ary->ary_must_be_exact()) return this; // cannot clear xk
return make(ptr(), const_oop(), _ary, klass(), klass_is_exact, _offset, _instance_id, _speculative, _inline_depth);
}
@@ -5044,7 +5036,6 @@ const Type *TypeKlassPtr::cast_to_ptr_type(PTR ptr) const {
//-----------------------------cast_to_exactness-------------------------------
const Type *TypeKlassPtr::cast_to_exactness(bool klass_is_exact) const {
if( klass_is_exact == _klass_is_exact ) return this;
if (!UseExactTypes) return this;
return make(klass_is_exact ? Constant : NotNull, _klass, _offset);
}

0 comments on commit a25bacd

Please sign in to comment.