Skip to content
Permalink
Browse files
8240976: [JVMCI] MethodProfileWidth flag is broken
Remove JVMCI code which is not used

Reviewed-by: thartmann, redestad
  • Loading branch information
Vladimir Kozlov committed Mar 17, 2020
1 parent 1a09959 commit ec5bd02186668e2cdda6352dd1ae3ed29434d60e
@@ -1153,38 +1153,10 @@ void InterpreterMacroAssembler::profile_virtual_call(Register receiver,
bind(skip_receiver_profile);

// The method data pointer needs to be updated to reflect the new target.
#if INCLUDE_JVMCI
if (MethodProfileWidth == 0) {
update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
}
#else // INCLUDE_JVMCI
update_mdp_by_constant(mdp,
in_bytes(VirtualCallData::
virtual_call_data_size()));
#endif // INCLUDE_JVMCI
bind(profile_continue);
}
}

#if INCLUDE_JVMCI
void InterpreterMacroAssembler::profile_called_method(Register method, Register mdp, Register reg2) {
assert_different_registers(method, mdp, reg2);
if (ProfileInterpreter && MethodProfileWidth > 0) {
Label profile_continue;

// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, profile_continue);

Label done;
record_item_in_profile_helper(method, mdp, reg2, 0, done, MethodProfileWidth,
&VirtualCallData::method_offset, &VirtualCallData::method_count_offset, in_bytes(VirtualCallData::nonprofiled_receiver_count_offset()));
bind(done);

update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
bind(profile_continue);
}
}
#endif // INCLUDE_JVMCI

// This routine creates a state machine for updating the multi-row
// type profile at a virtual call site (or other type-sensitive bytecode).
@@ -262,7 +262,6 @@ class InterpreterMacroAssembler: public MacroAssembler {
void profile_virtual_call(Register receiver, Register mdp,
Register scratch2,
bool receiver_can_be_null = false);
void profile_called_method(Register method, Register mdp, Register reg2) NOT_JVMCI_RETURN;
void profile_ret(Register return_bci, Register mdp);
void profile_null_seen(Register mdp);
void profile_typecheck(Register mdp, Register klass, Register scratch);
@@ -3664,7 +3664,6 @@ void TemplateTable::invokeinterface(int byte_no) {
// Found entry. Jump off!
// Argument and return type profiling.
__ profile_arguments_type(Rmethod2, Rscratch1, Rscratch2, true);
//__ profile_called_method(Rindex, Rscratch1);
__ call_from_interpreter(Rmethod2, Rret_addr, Rscratch1, Rscratch2);

// Vtable entry was NULL => Throw abstract method error.
@@ -1646,36 +1646,10 @@ void InterpreterMacroAssembler::profile_virtual_call(Register receiver,
bind(skip_receiver_profile);

// The method data pointer needs to be updated to reflect the new target.
#if INCLUDE_JVMCI
if (MethodProfileWidth == 0) {
update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size()));
}
#else
update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size()));
#endif
bind(profile_continue);
}
}

#if INCLUDE_JVMCI
void InterpreterMacroAssembler::profile_called_method(Register method, Register scratch) {
assert_different_registers(method, scratch);
if (ProfileInterpreter && MethodProfileWidth > 0) {
Label profile_continue;

// If no method data exists, go to profile_continue.
test_method_data_pointer(profile_continue);

Label done;
record_item_in_profile_helper(method, scratch, 0, done, MethodProfileWidth,
&VirtualCallData::method_offset, &VirtualCallData::method_count_offset, in_bytes(VirtualCallData::nonprofiled_receiver_count_offset()));
bind(done);

update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size()));
bind(profile_continue);
}
}
#endif // INCLUDE_JVMCI

void InterpreterMacroAssembler::record_klass_in_profile_helper(Register receiver, Register scratch,
Label& done, bool is_virtual_call) {
@@ -302,7 +302,6 @@ class InterpreterMacroAssembler: public MacroAssembler {
void profile_call(Register scratch);
void profile_final_call(Register scratch);
void profile_virtual_call(Register receiver, Register scratch, bool receiver_can_be_null = false);
void profile_called_method(Register method, Register scratch) NOT_JVMCI_RETURN;
void profile_ret(TosState state, Register return_bci, Register scratch);
void profile_null_seen(Register scratch);
void profile_typecheck(Register klass, Register scratch);
@@ -3028,7 +3028,6 @@ void TemplateTable::generate_vtable_call(Register Rrecv, Register Rindex, Regist
// get target Method* & entry point
__ lookup_virtual_method(Rrecv, Rindex, G5_method);
__ profile_arguments_type(G5_method, Rcall, Gargs, true);
__ profile_called_method(G5_method, Rtemp);
__ call_from_interpreter(Rcall, Gargs, Rret);
}

@@ -3299,7 +3298,6 @@ void TemplateTable::invokeinterface(int byte_no) {
assert_different_registers(Rcall, G5_method, Gargs, Rret);

__ profile_arguments_type(G5_method, Rcall, Gargs, true);
__ profile_called_method(G5_method, Rscratch);
__ call_from_interpreter(Rcall, Gargs, Rret);

__ bind(L_no_such_interface);
@@ -1621,38 +1621,10 @@ void InterpreterMacroAssembler::profile_virtual_call(Register receiver,
bind(skip_receiver_profile);

// The method data pointer needs to be updated to reflect the new target.
#if INCLUDE_JVMCI
if (MethodProfileWidth == 0) {
update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
}
#else // INCLUDE_JVMCI
update_mdp_by_constant(mdp,
in_bytes(VirtualCallData::
virtual_call_data_size()));
#endif // INCLUDE_JVMCI
bind(profile_continue);
}
}

#if INCLUDE_JVMCI
void InterpreterMacroAssembler::profile_called_method(Register method, Register mdp, Register reg2) {
assert_different_registers(method, mdp, reg2);
if (ProfileInterpreter && MethodProfileWidth > 0) {
Label profile_continue;

// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, profile_continue);

Label done;
record_item_in_profile_helper(method, mdp, reg2, 0, done, MethodProfileWidth,
&VirtualCallData::method_offset, &VirtualCallData::method_count_offset, in_bytes(VirtualCallData::nonprofiled_receiver_count_offset()));
bind(done);

update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
bind(profile_continue);
}
}
#endif // INCLUDE_JVMCI

// This routine creates a state machine for updating the multi-row
// type profile at a virtual call site (or other type-sensitive bytecode).
@@ -269,7 +269,6 @@ class InterpreterMacroAssembler: public MacroAssembler {
void profile_virtual_call(Register receiver, Register mdp,
Register scratch2,
bool receiver_can_be_null = false);
void profile_called_method(Register method, Register mdp, Register reg2) NOT_JVMCI_RETURN;
void profile_ret(Register return_bci, Register mdp);
void profile_null_seen(Register mdp);
void profile_typecheck(Register mdp, Register klass, Register scratch);
@@ -3743,7 +3743,6 @@ void TemplateTable::invokevirtual_helper(Register index,
__ profile_virtual_call(rax, rlocals, rdx);
// get target Method* & entry point
__ lookup_virtual_method(rax, index, method);
__ profile_called_method(method, rdx, rbcp);

__ profile_arguments_type(rdx, method, rbcp, true);
__ jump_from_interpreted(method, rdx);
@@ -3895,7 +3894,6 @@ void TemplateTable::invokeinterface(int byte_no) {
__ testptr(rbx, rbx);
__ jcc(Assembler::zero, no_such_method);

__ profile_called_method(rbx, rbcp, rdx);
__ profile_arguments_type(rdx, rbx, rbcp, true);

// do the call
@@ -210,7 +210,6 @@ JVMCIObjectArray CompilerToVM::initialize_intrinsics(JVMCI_TRAPS) {
do_intx_flag(JVMCICounterSize) \
do_bool_flag(JVMCIPrintProperties) \
do_bool_flag(JVMCIUseFastLocking) \
do_intx_flag(MethodProfileWidth) \
do_intx_flag(ObjectAlignmentInBytes) \
do_bool_flag(PrintInlining) \
do_bool_flag(ReduceInitialCardMarks) \
@@ -108,7 +108,6 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI)
CHECK_NOT_SET(JVMCIUseFastLocking, EnableJVMCI)
CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI)
CHECK_NOT_SET(MethodProfileWidth, EnableJVMCI)
CHECK_NOT_SET(JVMCIPrintProperties, EnableJVMCI)
CHECK_NOT_SET(UseJVMCINativeLibrary, EnableJVMCI)
CHECK_NOT_SET(JVMCILibPath, EnableJVMCI)
@@ -107,9 +107,6 @@ class fileStream;
experimental(intx, JVMCINMethodSizeLimit, (80*K)*wordSize, \
"Maximum size of a compiled method.") \
\
experimental(intx, MethodProfileWidth, 0, \
"Number of methods to record in call profile") \
\
experimental(ccstr, JVMCILibPath, NULL, \
"LD path for loading the JVMCI shared library") \
\
@@ -409,28 +409,6 @@ void ReceiverTypeData::clean_weak_klass_links(bool always_clean) {
}
}

#if INCLUDE_JVMCI
void VirtualCallData::clean_weak_klass_links(bool always_clean) {
ReceiverTypeData::clean_weak_klass_links(always_clean);
for (uint row = 0; row < method_row_limit(); row++) {
Method* p = method(row);
if (p != NULL && (always_clean || !p->method_holder()->is_loader_alive())) {
clear_method_row(row);
}
}
}

void VirtualCallData::clean_weak_method_links() {
ReceiverTypeData::clean_weak_method_links();
for (uint row = 0; row < method_row_limit(); row++) {
Method* p = method(row);
if (p != NULL && p->is_old()) {
clear_method_row(row);
}
}
}
#endif // INCLUDE_JVMCI

void ReceiverTypeData::print_receiver_data_on(outputStream* st) const {
uint row;
int entries = 0;
@@ -461,35 +439,9 @@ void ReceiverTypeData::print_data_on(outputStream* st, const char* extra) const
print_receiver_data_on(st);
}

#if INCLUDE_JVMCI
void VirtualCallData::print_method_data_on(outputStream* st) const {
uint row;
int entries = 0;
for (row = 0; row < method_row_limit(); row++) {
if (method(row) != NULL) entries++;
}
tab(st);
st->print_cr("method_entries(%u)", entries);
int total = count();
for (row = 0; row < method_row_limit(); row++) {
if (method(row) != NULL) {
total += method_count(row);
}
}
for (row = 0; row < method_row_limit(); row++) {
if (method(row) != NULL) {
tab(st);
method(row)->print_value_on(st);
st->print_cr("(%u %4.2f)", method_count(row), (float) method_count(row) / (float) total);
}
}
}
#endif // INCLUDE_JVMCI

void VirtualCallData::print_data_on(outputStream* st, const char* extra) const {
print_shared(st, "VirtualCallData", extra);
print_receiver_data_on(st);
print_method_data_on(st);
}

// ==================================================================
@@ -1229,7 +1229,7 @@ class VirtualCallData : public ReceiverTypeData {
static int static_cell_count() {
// At this point we could add more profile state, e.g., for arguments.
// But for now it's the same size as the base record type.
return ReceiverTypeData::static_cell_count() JVMCI_ONLY(+ (uint) MethodProfileWidth * receiver_type_row_cell_count);
return ReceiverTypeData::static_cell_count();
}

virtual int cell_count() const {
@@ -1241,61 +1241,6 @@ class VirtualCallData : public ReceiverTypeData {
return cell_offset(static_cell_count());
}

#if INCLUDE_JVMCI
static ByteSize method_offset(uint row) {
return cell_offset(method_cell_index(row));
}
static ByteSize method_count_offset(uint row) {
return cell_offset(method_count_cell_index(row));
}
static int method_cell_index(uint row) {
return receiver0_offset + (row + TypeProfileWidth) * receiver_type_row_cell_count;
}
static int method_count_cell_index(uint row) {
return count0_offset + (row + TypeProfileWidth) * receiver_type_row_cell_count;
}
static uint method_row_limit() {
return MethodProfileWidth;
}

Method* method(uint row) const {
assert(row < method_row_limit(), "oob");

Method* method = (Method*)intptr_at(method_cell_index(row));
assert(method == NULL || method->is_method(), "must be");
return method;
}

uint method_count(uint row) const {
assert(row < method_row_limit(), "oob");
return uint_at(method_count_cell_index(row));
}

void set_method(uint row, Method* m) {
assert((uint)row < method_row_limit(), "oob");
set_intptr_at(method_cell_index(row), (uintptr_t)m);
}

void set_method_count(uint row, uint count) {
assert(row < method_row_limit(), "oob");
set_uint_at(method_count_cell_index(row), count);
}

void clear_method_row(uint row) {
assert(row < method_row_limit(), "oob");
// Clear total count - indicator of polymorphic call site (see comment for clear_row() in ReceiverTypeData).
set_nonprofiled_count(0);
set_method(row, NULL);
set_method_count(row, 0);
}

// GC support
virtual void clean_weak_klass_links(bool always_clean);

// Redefinition support
virtual void clean_weak_method_links();
#endif // INCLUDE_JVMCI

void print_method_data_on(outputStream* st) const NOT_JVMCI_RETURN;
void print_data_on(outputStream* st, const char* extra = NULL) const;
};
@@ -36,7 +36,6 @@
public class MethodData extends Metadata implements MethodDataInterface<Klass,Method> {
static int TypeProfileWidth = 2;
static int BciProfileWidth = 2;
static int MethodProfileWidth = 0;
static int CompileThreshold;

static int Reason_many; // indicates presence of several reasons
@@ -143,8 +142,6 @@ private static synchronized void initialize(TypeDataBase db) throws WrongTypeExc
TypeProfileWidth = (int)flag.getIntx();
} else if (flag.getName().equals("BciProfileWidth")) {
BciProfileWidth = (int)flag.getIntx();
} else if (flag.getName().equals("MethodProfileWidth")) {
MethodProfileWidth = (int)flag.getIntx();
} else if (flag.getName().equals("CompileThreshold")) {
CompileThreshold = (int)flag.getIntx();
}
@@ -45,9 +45,6 @@ static int staticCellCount() {
// At this point we could add more profile state, e.g., for arguments.
// But for now it's the same size as the base record type.
int cellCount = ReceiverTypeData.staticCellCount();
if (INCLUDE_JVMCI == 1) {
cellCount += MethodData.MethodProfileWidth * receiverTypeRowCellCount;
}
return cellCount;
}

@@ -313,7 +313,7 @@ final int baseVtableLength() {

final int bciProfileWidth = getFlag("BciProfileWidth", Integer.class);
final int typeProfileWidth = getFlag("TypeProfileWidth", Integer.class);
final int methodProfileWidth = getFlag("MethodProfileWidth", Integer.class);
final int methodProfileWidth = getFlag("MethodProfileWidth", Integer.class, 0);

final int deoptReasonNone = getConstant("Deoptimization::Reason_none", Integer.class);
final int deoptReasonNullCheck = getConstant("Deoptimization::Reason_null_check", Integer.class);

0 comments on commit ec5bd02

Please sign in to comment.