(original) (raw)
src/cpu/sparc/vm/interp_masm_sparc.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/cpu/sparc/vm/interp_masm_sparc.cpp Wed Sep 16 15:17:30 2015** --- new/src/cpu/sparc/vm/interp_masm_sparc.cpp Wed Sep 16 15:17:29 2015
*** 1641,1699 **** --- 1641,1746 ---- // Record the receiver type. record_klass_in_profile(receiver, scratch, true); 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()));
bind (profile_continue);
+ }
+ #else
+ update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size()));
+ #endif
+ bind(profile_continue);
}
}
void InterpreterMacroAssembler::record_klass_in_profile_helper(
Register receiver, Register scratch,
int start_row, Label& done, bool is_virtual_call) {
+ #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) {
if (TypeProfileWidth == 0) {
if (is_virtual_call) {
increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch);
}
return;
+ #if INCLUDE_JVMCI
+ else if (EnableJVMCI) {
+ increment_mdp_data_at(in_bytes(ReceiverTypeData::nonprofiled_receiver_count_offset()), scratch);
+ }
+ #endif
+ } else {
+ int non_profiled_offset = -1;
+ if (is_virtual_call) {
+ non_profiled_offset = in_bytes(CounterData::count_offset());
}
+ #if INCLUDE_JVMCI
+ else if (EnableJVMCI) {
+ non_profiled_offset = in_bytes(ReceiverTypeData::nonprofiled_receiver_count_offset());
+ }
+ #endif
int last_row = VirtualCallData::row_limit() - 1;
+ record_item_in_profile_helper(receiver, scratch, 0, done, TypeProfileWidth,
+ &VirtualCallData::receiver_offset, &VirtualCallData::receiver_count_offset, non_profiled_offset);
+ }
+ }
+
+ void InterpreterMacroAssembler::record_item_in_profile_helper(Register item,
+ Register scratch, int start_row, Label& done, int total_rows,
+ OffsetFunction item_offset_fn, OffsetFunction item_count_offset_fn,
+ int non_profiled_offset) {
+ int last_row = total_rows - 1;
assert(start_row <= last_row, "must be work left to do");
! // Test this row for both the receiver and for null.**
! // Test this row for both the item and for null.
// Take any of three different outcomes:
**! // 1. found receiver => increment count and goto done
! // 1. found item => increment count and goto done
// 2. found null => keep looking for case 1, maybe allocate this cell
// 3. found something else => keep looking for cases 1 and 2
// Case 3 is handled by a recursive call.
for (int row = start_row; row <= last_row; row++) {
Label next_test;
bool test_for_null_also = (row == start_row);
! // See if the receiver is receiver[n].
! int recvr_offset = in_bytes(VirtualCallData::receiver_offset(row));
! test_mdp_data_at(recvr_offset, receiver, next_test, scratch);
! // See if the item is item[n].
! int item_offset = in_bytes(item_offset_fn(row));
! test_mdp_data_at(item_offset, item, next_test, scratch);
// delayed()->tst(scratch);
! // The receiver is receiver[n]. Increment count[n].
! int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row));
! // The receiver is item[n]. Increment count[n].
! int count_offset = in_bytes(item_count_offset_fn(row));
increment_mdp_data_at(count_offset, scratch);
ba_short(done);
bind(next_test);
if (test_for_null_also) {
Label found_null;
! // Failed the equality check on receiver[n]... Test for null.
! // Failed the equality check on item[n]... Test for null.
if (start_row == last_row) {
// The only thing left to do is handle the null case.
! if (is_virtual_call) {
! if (non_profiled_offset >= 0) {
brx(Assembler::zero, false, Assembler::pn, found_null);
delayed()->nop();
! // Receiver did not match any saved receiver and there is no empty row for it.
! // Item did not match any saved item and there is no empty row for it.
// Increment total counter to indicate polymorphic case.
! increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch);
! increment_mdp_data_at(non_profiled_offset, scratch);
ba_short(done);
bind(found_null);
} else {
brx(Assembler::notZero, false, Assembler::pt, done);
delayed()->nop();
*** 1703,1727 **** --- 1750,1775 ---- // Since null is rare, make it be the branch-taken case. brx(Assembler::zero, false, Assembler::pn, found_null); delayed()->nop();
// Put all the "Case 3" tests here.
! record_klass_in_profile_helper(receiver, scratch, start_row + 1, done, is_virtual_call);
! record_item_in_profile_helper(item, scratch, start_row + 1, done, total_rows,
+ item_offset_fn, item_count_offset_fn, non_profiled_offset);
! // Found a null. Keep searching for a matching receiver,
! // Found a null. Keep searching for a matching item,
// but remember that this is an empty (unused) slot.
bind(found_null);
}
}
! // In the fall-through case, we found no matching receiver, but we
! // observed the receiver[start_row] is NULL.
! // In the fall-through case, we found no matching item, but we
! // observed the item[start_row] is NULL.
! // Fill in the receiver field and increment the count.
! int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row));
! set_mdp_data_at(recvr_offset, receiver);
! int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row));
! // Fill in the item field and increment the count.
! int item_offset = in_bytes(item_offset_fn(start_row));
! set_mdp_data_at(item_offset, item);
! int count_offset = in_bytes(item_count_offset_fn(start_row));
mov(DataLayout::counter_increment, scratch);
set_mdp_data_at(count_offset, scratch);
if (start_row > 0) {
ba_short(done);
}
*** 1730,1740 ****
--- 1778,1788 ----
void InterpreterMacroAssembler::record_klass_in_profile(Register receiver,
Register scratch, bool is_virtual_call) {
assert(ProfileInterpreter, "must be profiling");
Label done;
- record_klass_in_profile_helper(receiver, scratch, 0, done, is_virtual_call);
bind (done);
}
*** 1786,1796 **** --- 1834,1844 ---- set_mdp_flag_at(BitData::null_seen_byte_constant(), scratch);
// The method data pointer needs to be updated.
int mdp_delta = in_bytes(BitData::bit_data_size());
if (TypeProfileCasts) {
! mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
! mdp_delta = in_bytes(ReceiverTypeData::receiver_type_data_size());
}
update_mdp_by_constant(mdp_delta);
bind (profile_continue);
}
*** 1804,1814 ****
--- 1852,1862 ----
// If no method data exists, go to profile_continue.
test_method_data_pointer(profile_continue);
int mdp_delta = in_bytes(BitData::bit_data_size());
if (TypeProfileCasts) {
! mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
! mdp_delta = in_bytes(ReceiverTypeData::receiver_type_data_size());
// Record the object type.
record_klass_in_profile(klass, scratch, false);
}
*** 1826,1836 **** --- 1874,1884 ---- // If no method data exists, go to profile_continue. test_method_data_pointer(profile_continue);
int count_offset = in_bytes(CounterData::count_offset());
// Back up the address, since we have already bumped the mdp.
! count_offset -= in_bytes(VirtualCallData::virtual_call_data_size());
! count_offset -= in_bytes(ReceiverTypeData::receiver_type_data_size());
// *Decrement* the counter. We expect to see zero or small negatives.
increment_mdp_data_at(count_offset, scratch, true);
bind (profile_continue);
src/cpu/sparc/vm/interp_masm_sparc.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File