8297201: Obsolete AliasLevel flag

Co-authored-by: Tobias Holenstein <tholenstein@openjdk.org>
Reviewed-by: chagedorn, dholmes, tholenstein, rcastanedalo
This commit is contained in:
Tobias Hartmann 2022-11-17 13:23:02 +00:00
parent d02bfdf9d7
commit b6aff54245
10 changed files with 20 additions and 77 deletions

View File

@ -633,13 +633,6 @@
"Scaling factor for branch frequencies (deprecated)") \
range(1, max_intx) \
\
product(intx, AliasLevel, 3, \
"(Deprecated) 0 for no aliasing, " \
"1 for oop/field/static/array split, " \
"2 for class split, 3 for unique instances") \
range(0, 3) \
constraint(AliasLevelConstraintFunc,AfterErgo) \
\
develop(bool, VerifyAliases, false, \
"perform extra checks on the results of alias analysis") \
\

View File

@ -694,8 +694,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
method()->ensure_method_data();
}
Init(::AliasLevel);
Init(/*do_aliasing=*/ true);
print_compile_messages();
@ -938,7 +937,7 @@ Compile::Compile( ciEnv* ci_env,
set_has_irreducible_loop(false); // no loops
CompileWrapper cw(this);
Init(/*AliasLevel=*/ 0);
Init(/*do_aliasing=*/ false);
init_tf((*generator)());
{
@ -960,7 +959,8 @@ Compile::Compile( ciEnv* ci_env,
//------------------------------Init-------------------------------------------
// Prepare for a single compilation
void Compile::Init(int aliaslevel) {
void Compile::Init(bool aliasing) {
_do_aliasing = aliasing;
_unique = 0;
_regalloc = NULL;
@ -1053,16 +1053,6 @@ void Compile::Init(int aliaslevel) {
set_default_node_notes(Node_Notes::make(this));
}
// // -- Initialize types before each compile --
// // Update cached type information
// if( _method && _method->constants() )
// Type::update_loaded_types(_method, _method->constants());
// Init alias_type map.
if (!do_escape_analysis() && aliaslevel == 3) {
aliaslevel = 2; // No unique types without escape analysis
}
_AliasLevel = aliaslevel;
const int grow_ats = 16;
_max_alias_types = grow_ats;
_alias_types = NEW_ARENA_ARRAY(comp_arena(), AliasType*, grow_ats);
@ -1299,6 +1289,7 @@ bool Compile::allow_range_check_smearing() const {
//------------------------------flatten_alias_type-----------------------------
const TypePtr *Compile::flatten_alias_type( const TypePtr *tj ) const {
assert(do_aliasing(), "Aliasing should be enabled");
int offset = tj->offset();
TypePtr::PTR ptr = tj->ptr();
@ -1330,7 +1321,7 @@ const TypePtr *Compile::flatten_alias_type( const TypePtr *tj ) const {
cast_to_ptr_type(ptr)->
with_offset(offset);
}
} else if( ta && _AliasLevel >= 2 ) {
} else if (ta) {
// For arrays indexed by constant indices, we flatten the alias
// space to include all of the array body. Only the header, klass
// and array length can be accessed un-aliased.
@ -1401,7 +1392,7 @@ const TypePtr *Compile::flatten_alias_type( const TypePtr *tj ) const {
// Oop pointers need some flattening
const TypeInstPtr *to = tj->isa_instptr();
if( to && _AliasLevel >= 2 && to != TypeOopPtr::BOTTOM ) {
if (to && to != TypeOopPtr::BOTTOM) {
ciInstanceKlass* ik = to->instance_klass();
if( ptr == TypePtr::Constant ) {
if (ik != ciEnv::current()->Class_klass() ||
@ -1504,31 +1495,6 @@ const TypePtr *Compile::flatten_alias_type( const TypePtr *tj ) const {
if (tj->base() == Type::AnyPtr)
tj = TypePtr::BOTTOM; // An error, which the caller must check for.
// Flatten all to bottom for now
switch( _AliasLevel ) {
case 0:
tj = TypePtr::BOTTOM;
break;
case 1: // Flatten to: oop, static, field or array
switch (tj->base()) {
//case Type::AryPtr: tj = TypeAryPtr::RANGE; break;
case Type::RawPtr: tj = TypeRawPtr::BOTTOM; break;
case Type::AryPtr: // do not distinguish arrays at all
case Type::InstPtr: tj = TypeInstPtr::BOTTOM; break;
case Type::KlassPtr:
case Type::AryKlassPtr:
case Type::InstKlassPtr: tj = TypeInstKlassPtr::OBJECT; break;
case Type::AnyPtr: tj = TypePtr::BOTTOM; break; // caller checks it
default: ShouldNotReachHere();
}
break;
case 2: // No collapsing at level 2; keep all splits
case 3: // No collapsing at level 3; keep all splits
break;
default:
Unimplemented();
}
offset = tj->offset();
assert( offset != Type::OffsetTop, "Offset has fallen from constant" );
@ -1635,8 +1601,9 @@ void Compile::grow_alias_types() {
//--------------------------------find_alias_type------------------------------
Compile::AliasType* Compile::find_alias_type(const TypePtr* adr_type, bool no_create, ciField* original_field) {
if (_AliasLevel == 0)
if (!do_aliasing()) {
return alias_type(AliasIdxBot);
}
AliasCacheEntry* ace = probe_alias_cache(adr_type);
if (ace->_adr_type == adr_type) {

View File

@ -327,7 +327,7 @@ class Compile : public Phase {
bool _do_freq_based_layout; // True if we intend to do frequency based block layout
bool _do_vector_loop; // True if allowed to execute loop in parallel iterations
bool _use_cmove; // True if CMove should be used without profitability analysis
int _AliasLevel; // Locally-adjusted version of AliasLevel flag.
bool _do_aliasing; // True if we intend to do aliasing
bool _print_assembly; // True if we should dump assembly code for this compilation
bool _print_inlining; // True if we should print inlining for this compilation
bool _print_intrinsics; // True if we should print intrinsics for this compilation
@ -616,7 +616,7 @@ class Compile : public Phase {
void set_do_vector_loop(bool z) { _do_vector_loop = z; }
bool use_cmove() const { return _use_cmove; }
void set_use_cmove(bool z) { _use_cmove = z; }
int AliasLevel() const { return _AliasLevel; }
bool do_aliasing() const { return _do_aliasing; }
bool print_assembly() const { return _print_assembly; }
void set_print_assembly(bool z) { _print_assembly = z; }
bool print_inlining() const { return _print_inlining; }
@ -1103,9 +1103,7 @@ class Compile : public Phase {
private:
// Phase control:
void Init(int aliaslevel); // Prepare for a single compilation
int Inline_Warm(); // Find more inlining work.
void Finish_Warm(); // Give up on further inlines.
void Init(bool aliasing); // Prepare for a single compilation
void Optimize(); // Given a graph, optimize it
void Code_Gen(); // Generate code from a graph

View File

@ -355,8 +355,8 @@ bool ConnectionGraph::compute_escape() {
// 5. Separate memory graph for scalar replaceable allcations.
bool has_scalar_replaceable_candidates = (alloc_worklist.length() > 0);
if (has_scalar_replaceable_candidates &&
C->AliasLevel() >= 3 && EliminateAllocations) {
if (has_scalar_replaceable_candidates && EliminateAllocations) {
assert(C->do_aliasing(), "Aliasing should be enabled");
// Now use the escape information to create unique types for
// scalar replaceable objects.
split_unique_types(alloc_worklist, arraycopy_worklist, mergemem_worklist);
@ -374,8 +374,6 @@ bool ConnectionGraph::compute_escape() {
tty->print(" since EliminateAllocations is off ===");
} else if(!has_scalar_replaceable_candidates) {
tty->print(" since there are no scalar replaceable candidates ===");
} else if(C->AliasLevel() < 3) {
tty->print(" since AliasLevel < 3 ===");
}
tty->cr();
#endif

View File

@ -588,7 +588,7 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
int load_alias_idx = C->get_alias_index(load->adr_type());
#ifdef ASSERT
assert(Compile::AliasIdxTop <= load_alias_idx && load_alias_idx < C->num_alias_types(), "Invalid alias index");
if (load_alias_idx == Compile::AliasIdxBot && C->AliasLevel() > 0 &&
if (load_alias_idx == Compile::AliasIdxBot && C->do_aliasing() &&
(PrintOpto || VerifyAliases ||
(PrintMiscellaneous && (WizardMode || Verbose)))) {
// Load nodes should not consume all of memory.

View File

@ -5297,7 +5297,7 @@ bool LibraryCallKit::inline_arraycopy() {
AllocateArrayNode*
LibraryCallKit::tightly_coupled_allocation(Node* ptr) {
if (stopped()) return NULL; // no fast path
if (C->AliasLevel() == 0) return NULL; // no MergeMems around
if (!C->do_aliasing()) return NULL; // no MergeMems around
AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(ptr, &_gvn);
if (alloc == NULL) return NULL;

View File

@ -4906,7 +4906,7 @@ static void verify_memory_slice(const MergeMemNode* m, int alias_idx, Node* n) {
//-----------------------------memory_at---------------------------------------
Node* MergeMemNode::memory_at(uint alias_idx) const {
assert(alias_idx >= Compile::AliasIdxRaw ||
alias_idx == Compile::AliasIdxBot && Compile::current()->AliasLevel() == 0,
alias_idx == Compile::AliasIdxBot && !Compile::current()->do_aliasing(),
"must avoid base_memory and AliasIdxTop");
// Otherwise, it is a narrow slice.
@ -4919,9 +4919,9 @@ Node* MergeMemNode::memory_at(uint alias_idx) const {
|| n->adr_type() == NULL // address is TOP
|| n->adr_type() == TypePtr::BOTTOM
|| n->adr_type() == TypeRawPtr::BOTTOM
|| Compile::current()->AliasLevel() == 0,
|| !Compile::current()->do_aliasing(),
"must be a wide memory");
// AliasLevel == 0 if we are organizing the memory states manually.
// do_aliasing == false if we are organizing the memory states manually.
// See verify_memory_slice for comments on TypeRawPtr::BOTTOM.
} else {
// make sure the stored slice is sane

View File

@ -785,7 +785,7 @@ public:
StoreNode(c, mem, adr, at, val, oop_store, MemNode::release),
_oop_alias_idx(oop_alias_idx) {
assert(_oop_alias_idx >= Compile::AliasIdxRaw ||
_oop_alias_idx == Compile::AliasIdxBot && Compile::current()->AliasLevel() == 0,
_oop_alias_idx == Compile::AliasIdxBot && !Compile::current()->do_aliasing(),
"bad oop alias idx");
}
virtual int Opcode() const;

View File

@ -36,18 +36,6 @@
#include "runtime/globals_extension.hpp"
#include "utilities/powerOfTwo.hpp"
JVMFlag::Error AliasLevelConstraintFunc(intx value, bool verbose) {
if ((value <= 1) && (Arguments::mode() == Arguments::_comp || Arguments::mode() == Arguments::_mixed)) {
JVMFlag::printError(verbose,
"AliasLevel (" INTX_FORMAT ") is not "
"compatible with -Xcomp or -Xmixed\n",
value);
return JVMFlag::VIOLATES_CONSTRAINT;
} else {
return JVMFlag::SUCCESS;
}
}
/**
* Validate the minimum number of compiler threads needed to run the JVM.
*/

View File

@ -35,7 +35,6 @@
*/
#define COMPILER_CONSTRAINTS(f) \
f(intx, AliasLevelConstraintFunc) \
f(intx, CICompilerCountConstraintFunc) \
f(intx, AllocatePrefetchDistanceConstraintFunc) \
f(intx, AllocatePrefetchInstrConstraintFunc) \