Skip to content
Permalink
Browse files
8266561: Remove Compile::_save_argument_registers
Reviewed-by: kvn, thartmann
  • Loading branch information
cl4es committed May 6, 2021
1 parent 47d4438 commit c665dba591ae5c15c9ca49e14d1aaa4eea38e7ae
@@ -531,7 +531,6 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
bool subsume_loads, bool do_escape_analysis, bool eliminate_boxing, bool install_code, DirectiveSet* directive)
: Phase(Compiler),
_compile_id(ci_env->compile_id()),
_save_argument_registers(false),
_subsume_loads(subsume_loads),
_do_escape_analysis(do_escape_analysis),
_install_code(install_code),
@@ -825,12 +824,10 @@ Compile::Compile( ciEnv* ci_env,
const char *stub_name,
int is_fancy_jump,
bool pass_tls,
bool save_arg_registers,
bool return_pc,
DirectiveSet* directive)
: Phase(Compiler),
_compile_id(0),
_save_argument_registers(save_arg_registers),
_subsume_loads(true),
_do_escape_analysis(false),
_install_code(true),
@@ -244,7 +244,6 @@ class Compile : public Phase {
private:
// Fixed parameters to this compilation.
const int _compile_id;
const bool _save_argument_registers; // save/restore arg regs for trampolines
const bool _subsume_loads; // Load can be matched as part of a larger op.
const bool _do_escape_analysis; // Do escape analysis.
const bool _install_code; // Install the code that was compiled
@@ -510,7 +509,6 @@ class Compile : public Phase {
bool eliminate_boxing() const { return _eliminate_boxing; }
/** Do aggressive boxing elimination. */
bool aggressive_unboxing() const { return _eliminate_boxing && AggressiveUnboxing; }
bool save_argument_registers() const { return _save_argument_registers; }
bool should_install_code() const { return _install_code; }

// Other fixed compilation parameters.
@@ -1030,7 +1028,7 @@ class Compile : public Phase {
Compile(ciEnv* ci_env, const TypeFunc *(*gen)(),
address stub_function, const char *stub_name,
int is_fancy_jump, bool pass_tls,
bool save_arg_registers, bool return_pc, DirectiveSet* directive);
bool return_pc, DirectiveSet* directive);

// Are we compiling a method?
bool has_method() { return method() != NULL; }
@@ -724,12 +724,10 @@ void Matcher::init_first_stack_mask() {
}

//---------------------------is_save_on_entry----------------------------------
bool Matcher::is_save_on_entry( int reg ) {
bool Matcher::is_save_on_entry(int reg) {
return
_register_save_policy[reg] == 'E' ||
_register_save_policy[reg] == 'A' || // Save-on-entry register?
// Also save argument registers in the trampolining stubs
(C->save_argument_registers() && is_spillable_arg(reg));
_register_save_policy[reg] == 'A'; // Save-on-entry register?
}

//---------------------------Fixup_Save_On_Entry-------------------------------
@@ -745,12 +743,6 @@ void Matcher::Fixup_Save_On_Entry( ) {
StartNode *start = C->start();
assert( start, "Expect a start node" );

// Save argument registers in the trampolining stubs
if( C->save_argument_registers() )
for( i = 0; i < _last_Mach_Reg; i++ )
if( is_spillable_arg(i) )
soe_cnt++;

// Input RegMask array shared by all Returns.
// The type for doubles and longs has a count of 2, but
// there is only 1 returned value
@@ -1266,21 +1266,6 @@ void PhaseOutput::estimate_buffer_size(int& const_req) {
// Compute prolog code size
_method_size = 0;
_frame_slots = OptoReg::reg2stack(C->matcher()->_old_SP) + C->regalloc()->_framesize;
#if defined(IA64) && !defined(AIX)
if (save_argument_registers()) {
// 4815101: this is a stub with implicit and unknown precision fp args.
// The usual spill mechanism can only generate stfd's in this case, which
// doesn't work if the fp reg to spill contains a single-precision denorm.
// Instead, we hack around the normal spill mechanism using stfspill's and
// ldffill's in the MachProlog and MachEpilog emit methods. We allocate
// space here for the fp arg regs (f8-f15) we're going to thusly spill.
//
// If we ever implement 16-byte 'registers' == stack slots, we can
// get rid of this hack and have SpillCopy generate stfspill/ldffill
// instead of stfd/stfs/ldfd/ldfs.
_frame_slots += 8*(16/BytesPerInt);
}
#endif
assert(_frame_slots >= 0 && _frame_slots < 1000000, "sanity check");

if (C->has_mach_constant_base_node()) {
@@ -3356,8 +3341,7 @@ void PhaseOutput::install() {
if (!C->should_install_code()) {
return;
} else if (C->stub_function() != NULL) {
install_stub(C->stub_name(),
C->save_argument_registers());
install_stub(C->stub_name());
} else {
install_code(C->method(),
C->entry_bci(),
@@ -3412,8 +3396,7 @@ void PhaseOutput::install_code(ciMethod* target,
}
}
}
void PhaseOutput::install_stub(const char* stub_name,
bool caller_must_gc_arguments) {
void PhaseOutput::install_stub(const char* stub_name) {
// Entry point will be accessed using stub_entry_point();
if (code_buffer() == NULL) {
Matcher::soft_match_failure();
@@ -3432,7 +3415,7 @@ void PhaseOutput::install_stub(const char* stub_name,
// _code_offsets.value(CodeOffsets::Frame_Complete),
frame_size_in_words(),
oop_map_set(),
caller_must_gc_arguments);
false);
assert(rs != NULL && rs->is_runtime_stub(), "sanity check");

C->set_stub_entry_point(rs->entry_point());
@@ -164,8 +164,7 @@ class PhaseOutput : public Phase {
bool has_wide_vectors,
RTMState rtm_state);

void install_stub(const char* stub_name,
bool caller_must_gc_arguments);
void install_stub(const char* stub_name);

// Constant table
ConstantTable& constant_table() { return _constant_table; }
@@ -124,8 +124,8 @@ static bool check_compiled_frame(JavaThread* thread) {
#endif // ASSERT


#define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \
var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc); \
#define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, return_pc) \
var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, return_pc); \
if (var == NULL) { return false; }

bool OptoRuntime::generate(ciEnv* env) {
@@ -134,23 +134,23 @@ bool OptoRuntime::generate(ciEnv* env) {

// Note: tls: Means fetching the return oop out of the thread-local storage
//
// variable/name type-function-gen , runtime method ,fncy_jp, tls,save_args,retpc
// variable/name type-function-gen , runtime method ,fncy_jp, tls,retpc
// -------------------------------------------------------------------------------------------------------------------------------
gen(env, _new_instance_Java , new_instance_Type , new_instance_C , 0 , true , false, false);
gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true , false, false);
gen(env, _new_array_nozero_Java , new_array_Type , new_array_nozero_C , 0 , true , false, false);
gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true , false, false);
gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true , false, false);
gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false);
gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true , false, false);
gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false);
gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C, 0, false, false, false);
gen(env, _monitor_notify_Java , monitor_notify_Type , monitor_notify_C , 0 , false, false, false);
gen(env, _monitor_notifyAll_Java , monitor_notify_Type , monitor_notifyAll_C , 0 , false, false, false);
gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true );

gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false, false);
gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false, false);
gen(env, _new_instance_Java , new_instance_Type , new_instance_C , 0 , true, false);
gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true, false);
gen(env, _new_array_nozero_Java , new_array_Type , new_array_nozero_C , 0 , true, false);
gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true, false);
gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true, false);
gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true, false);
gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true, false);
gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true, false);
gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C, 0, false, false);
gen(env, _monitor_notify_Java , monitor_notify_Type , monitor_notify_C , 0 , false, false);
gen(env, _monitor_notifyAll_Java , monitor_notify_Type , monitor_notifyAll_C , 0 , false, false);
gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , true );

gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false);
gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false);

return true;
}
@@ -159,17 +159,16 @@ bool OptoRuntime::generate(ciEnv* env) {


// Helper method to do generation of RunTimeStub's
address OptoRuntime::generate_stub( ciEnv* env,
TypeFunc_generator gen, address C_function,
const char *name, int is_fancy_jump,
bool pass_tls,
bool save_argument_registers,
bool return_pc) {
address OptoRuntime::generate_stub(ciEnv* env,
TypeFunc_generator gen, address C_function,
const char *name, int is_fancy_jump,
bool pass_tls,
bool return_pc) {

// Matching the default directive, we currently have no method to match.
DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_full_optimization));
ResourceMark rm;
Compile C( env, gen, C_function, name, is_fancy_jump, pass_tls, save_argument_registers, return_pc, directive);
Compile C(env, gen, C_function, name, is_fancy_jump, pass_tls, return_pc, directive);
DirectivesStack::release(directive);
return C.stub_entry_point();
}
@@ -130,7 +130,7 @@ class OptoRuntime : public AllStatic {

private:
// define stubs
static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char *name, int is_fancy_jump, bool pass_tls, bool save_arguments, bool return_pc);
static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char* name, int is_fancy_jump, bool pass_tls, bool return_pc);

// References to generated stubs
static address _new_instance_Java;
@@ -912,7 +912,6 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
c2_nonstatic_field(Compile, _regalloc, PhaseRegAlloc*) \
c2_nonstatic_field(Compile, _method, ciMethod*) \
c2_nonstatic_field(Compile, _compile_id, const int) \
c2_nonstatic_field(Compile, _save_argument_registers, const bool) \
c2_nonstatic_field(Compile, _subsume_loads, const bool) \
c2_nonstatic_field(Compile, _do_escape_analysis, const bool) \
c2_nonstatic_field(Compile, _eliminate_boxing, const bool) \

1 comment on commit c665dba

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on c665dba May 6, 2021

Please sign in to comment.