/* * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// Initiate popframe handling only if it is not already being processed. If the flag // has the popframe_processing bit set, it means that this code is called *during* popframe // handling - we don't want to reenter.
// Call Interpreter::remove_activation_preserving_args_entry() to get the // address of the same-named entrypoint in the generated interpreter code.
call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_preserving_args_entry));
// Call indirectly to avoid generation ordering problem.
jump(R0);
case ltos: ldr(R1_tos_hi, val_addr_hi); // fall through case btos: // fall through case ztos: // fall through case ctos: // fall through case stos: // fall through case itos: ldr_s32(R0_tos, val_addr); break; #ifdef __SOFTFP__ case dtos: ldr(R1_tos_hi, val_addr_hi); // fall through case ftos: ldr(R0_tos, val_addr); break; #else case ftos: ldr_float (S0_tos, val_addr); break; case dtos: ldr_double(D0_tos, val_addr); break; #endif// __SOFTFP__ case vtos: /* nothing to do */ break; default : ShouldNotReachHere();
} // Clean up tos value in the thread object
str(zero, val_addr);
str(zero, val_addr_hi);
// Initiate earlyret handling only if it is not already being processed. // If the flag has the earlyret_processing bit set, it means that this code // is called *during* earlyret handling - we don't want to reenter.
// Sets reg. Blows Rtemp. void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset) {
assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode");
assert(reg != Rtemp, "should be different registers");
// convert from field index to ConstantPoolCacheEntry index
assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below");
logical_shift_left(index, index, 2);
}
// Sets cache, index, bytecode. void InterpreterMacroAssembler::get_cache_and_index_and_bytecode_at_bcp(Register cache, Register index, Register bytecode, int byte_no, int bcp_offset, size_t index_size) {
get_cache_and_index_at_bcp(cache, index, bcp_offset, index_size); // caution index and bytecode can be the same
add(bytecode, cache, AsmOperand(index, lsl, LogBytesPerWord));
ldrb(bytecode, Address(bytecode, (1 + byte_no) + in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::indices_offset())));
TemplateTable::volatile_barrier(MacroAssembler::LoadLoad, noreg, true);
}
// Sets cache. Blows reg_tmp. void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, Register reg_tmp, int bcp_offset, size_t index_size) {
assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
assert_different_registers(cache, reg_tmp);
// skip past the header
add(cache, cache, in_bytes(ConstantPoolCache::base_offset())); // convert from field index to ConstantPoolCacheEntry index // and from word offset to byte offset
assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below");
add(cache, cache, AsmOperand(reg_tmp, lsl, 2 + LogBytesPerWord));
}
Register cache = result; // load pointer for resolved_references[] objArray
ldr(cache, Address(result, ConstantPool::cache_offset_in_bytes()));
ldr(cache, Address(result, ConstantPoolCache::resolved_references_offset_in_bytes()));
resolve_oop_handle(cache); // Add in the index // convert from field index to resolved_references() index and from // word index to byte offset. Since this is a java object, it can be compressed
logical_shift_left(index, index, LogBytesPerHeapOop);
add(index, index, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
load_heap_oop(result, Address(cache, index));
}
// Generate a subtype check: branch to not_subtype if sub_klass is // not a subtype of super_klass. // Profiling code for the subtype check failure (profile_typecheck_failed) // should be explicitly generated by the caller in the not_subtype case. // Blows Rtemp, tmp1, tmp2. void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Register Rsuper_klass,
Label ¬_subtype, Register tmp1, Register tmp2) {
// Profile the not-null value's klass.
profile_typecheck(tmp1, Rsub_klass);
// Load the super-klass's check offset into
ldr_u32(super_check_offset, Address(Rsuper_klass, Klass::super_check_offset_offset()));
// Check for self
cmp(Rsub_klass, Rsuper_klass);
// Load from the sub-klass's super-class display list, or a 1-word cache of // the secondary superclass list, or a failing value with a sentinel offset // if the super-klass is an interface or exceptionally deep in the Java // hierarchy and we have to scan the secondary superclass list the hard way. // See if we get an immediate positive hit
ldr(cached_super, Address(Rsub_klass, super_check_offset));
// Check for immediate negative hit
cmp(super_check_offset, in_bytes(Klass::secondary_super_cache_offset()));
b(not_subtype, ne);
// Now do a linear scan of the secondary super-klass chain. constRegister supers_arr = tmp1; constRegister supers_cnt = tmp2; constRegister cur_super = Rtemp;
// Load objArrayOop of secondary supers.
ldr(supers_arr, Address(Rsub_klass, Klass::secondary_supers_offset()));
ldr_u32(supers_cnt, Address(supers_arr, Array<Klass*>::length_offset_in_bytes())); // Load the array length
cmp(supers_cnt, 0);
// Skip to the start of array elements and prefetch the first super-klass.
ldr(cur_super, Address(supers_arr, Array<Klass*>::base_offset_in_bytes(), pre_indexed), ne);
b(not_subtype, eq);
// Transition vtos -> state. Blows R0, R1. Sets TOS cached value. void InterpreterMacroAssembler::pop(TosState state) { switch (state) { case atos: pop_ptr(R0_tos); break; case btos: // fall through case ztos: // fall through case ctos: // fall through case stos: // fall through case itos: pop_i(R0_tos); break; case ltos: pop_l(R0_tos_lo, R1_tos_hi); break; #ifdef __SOFTFP__ case ftos: pop_i(R0_tos); break; case dtos: pop_l(R0_tos_lo, R1_tos_hi); break; #else case ftos: pop_f(S0_tos); break; case dtos: pop_d(D0_tos); break; #endif// __SOFTFP__ case vtos: /* nothing to do */ break; default : ShouldNotReachHere();
}
interp_verify_oop(R0_tos, state, __FILE__, __LINE__);
}
// Transition state -> vtos. Blows Rtemp. void InterpreterMacroAssembler::push(TosState state) {
interp_verify_oop(R0_tos, state, __FILE__, __LINE__); switch (state) { case atos: push_ptr(R0_tos); break; case btos: // fall through case ztos: // fall through case ctos: // fall through case stos: // fall through case itos: push_i(R0_tos); break; case ltos: push_l(R0_tos_lo, R1_tos_hi); break; #ifdef __SOFTFP__ case ftos: push_i(R0_tos); break; case dtos: push_l(R0_tos_lo, R1_tos_hi); break; #else case ftos: push_f(); break; case dtos: push_d(); break; #endif// __SOFTFP__ case vtos: /* nothing to do */ break; default : ShouldNotReachHere();
}
}
// Converts return value in R0/R1 (interpreter calling conventions) to TOS cached value. void InterpreterMacroAssembler::convert_retval_to_tos(TosState state) { #if (!defined __SOFTFP__ && !defined __ABI_HARD__) // According to interpreter calling conventions, result is returned in R0/R1, // but templates expect ftos in S0, and dtos in D0. if (state == ftos) {
fmsr(S0_tos, R0);
} elseif (state == dtos) {
fmdrr(D0_tos, R0, R1);
} #endif// !__SOFTFP__ && !__ABI_HARD__
}
// Converts TOS cached value to return value in R0/R1 (according to interpreter calling conventions). void InterpreterMacroAssembler::convert_tos_to_retval(TosState state) { #if (!defined __SOFTFP__ && !defined __ABI_HARD__) // According to interpreter calling conventions, result is returned in R0/R1, // so ftos (S0) and dtos (D0) are moved to R0/R1. if (state == ftos) {
fmrs(R0, S0_tos);
} elseif (state == dtos) {
fmrrd(R0, R1, D0_tos);
} #endif// !__SOFTFP__ && !__ABI_HARD__
}
// Helpers for swap and dup void InterpreterMacroAssembler::load_ptr(int n, Register val) {
ldr(val, Address(Rstack_top, Interpreter::expr_offset_in_bytes(n)));
}
void InterpreterMacroAssembler::store_ptr(int n, Register val) {
str(val, Address(Rstack_top, Interpreter::expr_offset_in_bytes(n)));
}
// record last_sp
str(Rsender_sp, Address(FP, frame::interpreter_frame_last_sp_offset * wordSize));
}
// Jump to from_interpreted entry of a call unless single stepping is possible // in this thread in which case we must call the i2i entry void InterpreterMacroAssembler::jump_from_interpreted(Register method) {
assert_different_registers(method, Rtemp);
prepare_to_jump_from_interpreted();
if (can_post_interpreter_events()) { // JVMTI events, such as single-stepping, are implemented partly by avoiding running // compiled code in threads for which the event is enabled. Check here for // interp_only_mode if these events CAN be enabled.
// The following two routines provide a hook so that an implementation // can schedule the dispatch in two parts. void InterpreterMacroAssembler::dispatch_prolog(TosState state, int step) { // Nothing ARM-specific to be done here.
}
void InterpreterMacroAssembler::dispatch_epilog(TosState state, int step) {
dispatch_next(state, step);
}
// remove activation // // Unlock the receiver if this is a synchronized method. // Unlock any Java monitors from synchronized blocks. // Remove the activation from the stack. // // If there are locked Java monitors // If throw_monitor_exception // throws IllegalMonitorStateException // Else if install_monitor_exception // installs IllegalMonitorStateException // Else // no error processing void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_addr, bool throw_monitor_exception, bool install_monitor_exception, bool notify_jvmdi) {
Label unlock, unlocked, no_unlock;
// Note: Registers R0, R1, S0 and D0 (TOS cached value) may be in use for the result.
// Don't unlock anything if the _do_not_unlock_if_synchronized flag is set.
cbnz(Rflag, no_unlock);
// unlock monitor
push(state); // save result
// BasicObjectLock will be first in list, since this is a synchronized method. However, need // to check that the object has not been unlocked by an explicit monitorexit bytecode.
if (throw_monitor_exception) { // Entry already unlocked, need to throw exception
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception));
should_not_reach_here();
} else { // Monitor already unlocked during a stack unroll. // If requested, install an illegal_monitor_state_exception. // Continue with stack unrolling. if (install_monitor_exception) {
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
}
b(unlocked);
}
// Exception case for the check that all monitors are unlocked. constRegister Rcur = R2;
Label restart_check_monitors_unlocked, exception_monitor_is_still_locked;
bind(exception_monitor_is_still_locked); // Monitor entry is still locked, need to throw exception. // Rcur: monitor entry.
if (throw_monitor_exception) { // Throw exception
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception));
should_not_reach_here();
} else { // Stack unrolling. Unlock object and install illegal_monitor_exception // Unlock does not block, so don't have to worry about the frame
ldr(Rcur, Address(FP, frame::interpreter_frame_monitor_block_top_offset * wordSize)); // points to current entry, starting with top-most entry
sub(Rbottom, FP, -frame::interpreter_frame_monitor_block_bottom_offset * wordSize); // points to word before bottom of monitor block
cmp(Rcur, Rbottom); // check if there are no monitors
ldr(Rcur_obj, Address(Rcur, BasicObjectLock::obj_offset_in_bytes()), ne); // prefetch monitor's object
b(no_unlock, eq);
bind(loop); // check if current entry is used
cbnz(Rcur_obj, exception_monitor_is_still_locked);
add(Rcur, Rcur, entry_size); // otherwise advance to next entry
cmp(Rcur, Rbottom); // check if bottom reached
ldr(Rcur_obj, Address(Rcur, BasicObjectLock::obj_offset_in_bytes()), ne); // prefetch monitor's object
b(loop, ne); // if not at bottom then check this entry
}
bind(no_unlock);
// jvmti support if (notify_jvmdi) {
notify_method_exit(state, NotifyJVMTI); // preserve TOSCA
} else {
notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA
}
// At certain points in the method invocation the monitor of // synchronized methods hasn't been entered yet. // To correctly handle exceptions at these points, we set the thread local // variable _do_not_unlock_if_synchronized to true. The remove_activation will // check this flag. void InterpreterMacroAssembler::set_do_not_unlock_if_synchronized(bool flag, Register tmp) { const Address do_not_unlock_if_synchronized(Rthread,
JavaThread::do_not_unlock_if_synchronized_offset()); if (flag) {
mov(tmp, 1);
strb(tmp, do_not_unlock_if_synchronized);
} else {
strb(zero_register(tmp), do_not_unlock_if_synchronized);
}
}
// Lock object // // Argument: R1 : Points to BasicObjectLock to be used for locking. // Must be initialized with object to lock. // Blows volatile registers R0-R3, Rtemp, LR. Calls VM. void InterpreterMacroAssembler::lock_object(Register Rlock) {
assert(Rlock == R1, "the second argument");
// On MP platforms the next load could return a 'stale' value if the memory location has been modified by another thread. // That would be acceptable as ether CAS or slow case path is taken in that case. // Exception to that is if the object is locked by the calling thread, then the recursive test will pass (guaranteed as // loads are satisfied from a store queue if performed on the same processor).
// If we got here that means the object is locked by ether calling thread or another thread.
bind(already_locked); // Handling of locked objects: recursive locks and slow case.
// Fast check for recursive lock. // // Can apply the optimization only if this is a stack lock // allocated in this thread. For efficiency, we can focus on // recently allocated stack locks (instead of reading the stack // base and checking whether 'mark' points inside the current // thread stack): // 1) (mark & 3) == 0 // 2) SP <= mark < SP + os::pagesize() // // Warning: SP + os::pagesize can overflow the stack base. We must // neither apply the optimization for an inflated lock allocated // just above the thread stack (this is why condition 1 matters) // nor apply the optimization if the stack lock is inside the stack // of another thread. The latter is avoided even in case of overflow // because we have guard pages at the end of all stacks. Hence, if // we go over the stack base and hit the stack of another thread, // this should not be in a writeable area that could contain a // stack lock allocated by that thread. As a consequence, a stack // lock less than page size away from SP is guaranteed to be // owned by the current thread. // // Note: assuming SP is aligned, we can check the low bits of // (mark-SP) instead of the low bits of mark. In that case, // assuming page size is a power of 2, we can merge the two // conditions into a single test: // => ((mark - SP) & (3 - os::pagesize())) == 0
// (3 - os::pagesize()) cannot be encoded as an ARM immediate operand. // Check independently the low bits and the distance to SP. // -1- test low 2 bits
movs(R0, AsmOperand(Rmark, lsl, 30)); // -2- test (mark - SP) if the low two bits are 0
sub(R0, Rmark, SP, eq);
movs(R0, AsmOperand(R0, lsr, exact_log2(os::vm_page_size())), eq); // If still 'eq' then recursive locking OK: store 0 into lock record
str(R0, Address(Rlock, mark_offset), eq);
b(done, eq);
bind(slow_case);
// Call the runtime routine for slow case
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), Rlock);
bind(done);
}
}
// Unlocks an object. Used in monitorexit bytecode and remove_activation. // // Argument: R0: Points to BasicObjectLock structure for lock // Throw an IllegalMonitorException if object is not locked by current thread // Blows volatile registers R0-R3, Rtemp, LR. Calls VM. void InterpreterMacroAssembler::unlock_object(Register Rlock) {
assert(Rlock == R0, "the first argument");
// Call the runtime routine for slow case.
str(Robj, Address(Rlock, obj_offset)); // restore obj
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), Rlock);
bind(done);
}
}
// Test ImethodDataPtr. If it is null, continue at the specified label void InterpreterMacroAssembler::test_method_data_pointer(Register mdp, Label& zero_continue) {
assert(ProfileInterpreter, "must be profiling interpreter");
ldr(mdp, Address(FP, frame::interpreter_frame_mdp_offset * wordSize));
cbz(mdp, zero_continue);
}
// Set the method data pointer for the current bcp. // Blows volatile registers R0-R3, Rtemp, LR. void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() {
assert(ProfileInterpreter, "must be profiling interpreter");
Label set_mdp;
// Test MDO to avoid the call if it is NULL.
ldr(Rtemp, Address(Rmethod, Method::method_data_offset()));
cbz(Rtemp, set_mdp);
// mdo is guaranteed to be non-zero here, we checked for it before the call.
ldr(Rtemp, Address(Rmethod, Method::method_data_offset()));
add(Rtemp, Rtemp, in_bytes(MethodData::data_offset()));
add_ptr_scaled_int32(Rtemp, Rtemp, R0, 0);
void InterpreterMacroAssembler::set_mdp_flag_at(Register mdp_in, int flag_byte_constant) {
assert_different_registers(mdp_in, Rtemp);
assert(ProfileInterpreter, "must be profiling interpreter");
assert((0 < flag_byte_constant) && (flag_byte_constant < (1 << BitsPerByte)), "flag mask is out of range");
// Set the flag
ldrb(Rtemp, Address(mdp_in, in_bytes(DataLayout::flags_offset())));
orr(Rtemp, Rtemp, (unsigned)flag_byte_constant);
strb(Rtemp, Address(mdp_in, in_bytes(DataLayout::flags_offset())));
}
// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, profile_continue);
// We are taking a branch. Increment the not taken count.
increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()), Rtemp);
// The method data pointer needs to be updated to correspond to the next bytecode
update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size()));
// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, profile_continue);
// We are making a call. Increment the count.
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()), Rtemp);
// The method data pointer needs to be updated to reflect the new target.
update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, profile_continue);
Label skip_receiver_profile; if (receiver_can_be_null) {
Label not_null;
cbnz(receiver, not_null); // We are making a call. Increment the count for null receiver.
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()), Rtemp);
b(skip_receiver_profile);
bind(not_null);
}
// Record the receiver type.
record_klass_in_profile(receiver, mdp, Rtemp, true);
bind(skip_receiver_profile);
// The method data pointer needs to be updated to reflect the new target.
update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
bind(profile_continue);
}
}
void InterpreterMacroAssembler::record_klass_in_profile_helper( Register receiver, Register mdp, Register reg_tmp, int start_row, Label& done, bool is_virtual_call) { if (TypeProfileWidth == 0) return;
int last_row = VirtualCallData::row_limit() - 1;
assert(start_row <= last_row, "must be work left to do"); // Test this row for both the receiver and for null. // Take any of three different outcomes: // 1. found receiver => 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;
// See if the receiver is receiver[n]. int recvr_offset = in_bytes(VirtualCallData::receiver_offset(row));
// The receiver is receiver[n]. Increment count[n]. int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row));
increment_mdp_data_at(mdp, count_offset, reg_tmp);
b(done);
bind(next_test); // reg_tmp now contains the receiver from the CallData.
if (row == start_row) {
Label found_null; // Failed the equality check on receiver[n]... Test for null. if (start_row == last_row) { // The only thing left to do is handle the null case. if (is_virtual_call) {
cbz(reg_tmp, found_null); // Receiver did not match any saved receiver and there is no empty row for it. // Increment total counter to indicate polymorphic case.
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()), reg_tmp);
b(done);
bind(found_null);
} else {
cbnz(reg_tmp, done);
} break;
} // Since null is rare, make it be the branch-taken case.
cbz(reg_tmp, found_null);
// Put all the "Case 3" tests here.
record_klass_in_profile_helper(receiver, mdp, reg_tmp, start_row + 1, done, is_virtual_call);
// Found a null. Keep searching for a matching receiver, // 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.
// Fill in the receiver field and increment the count. int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row));
set_mdp_data_at(mdp, recvr_offset, receiver); int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row));
mov(reg_tmp, DataLayout::counter_increment);
set_mdp_data_at(mdp, count_offset, reg_tmp); if (start_row > 0) {
b(done);
}
}
// See if return_bci is equal to bci[n]:
test_mdp_data_at(mdp, in_bytes(RetData::bci_offset(row)), return_bci,
Rtemp, next_test);
// return_bci is equal to bci[n]. Increment the count.
increment_mdp_data_at(mdp, in_bytes(RetData::bci_count_offset(row)), Rtemp);
// The method data pointer needs to be updated to reflect the new target.
update_mdp_by_offset(mdp, in_bytes(RetData::bci_displacement_offset(row)), Rtemp);
b(profile_continue);
bind(next_test);
}
// 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());
}
update_mdp_by_constant(mdp, mdp_delta);
if (ProfileInterpreter && TypeProfileCasts) {
Label profile_continue;
// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, 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());
// *Decrement* the counter. We expect to see zero or small negatives.
increment_mdp_data_at(mdp, count_offset, Rtemp, true);
// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, profile_continue);
// 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());
// Record the object type.
record_klass_in_profile(klass, mdp, Rtemp, false);
}
update_mdp_by_constant(mdp, mdp_delta);
// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, profile_continue);
// Update the default case count
increment_mdp_data_at(mdp, in_bytes(MultiBranchData::default_count_offset()), Rtemp);
// The method data pointer needs to be updated.
update_mdp_by_offset(mdp, in_bytes(MultiBranchData::default_displacement_offset()), Rtemp);
bind(profile_continue);
}
}
// Sets mdp. Blows reg_tmp1, reg_tmp2. Index could be the same as reg_tmp2. void InterpreterMacroAssembler::profile_switch_case(Register mdp, Register index, Register reg_tmp1, Register reg_tmp2) {
assert_different_registers(mdp, reg_tmp1, reg_tmp2);
assert_different_registers(mdp, reg_tmp1, index);
// If no method data exists, go to profile_continue.
test_method_data_pointer(mdp, profile_continue);
// Build the base (index * per_case_size_in_bytes())
logical_shift_left(reg_tmp1, index, exact_log2(in_bytes(MultiBranchData::per_case_size())));
// Update the case count
add(reg_tmp1, reg_tmp1, count_offset);
increment_mdp_data_at(Address(mdp, reg_tmp1), reg_tmp2);
// The method data pointer needs to be updated.
add(reg_tmp1, reg_tmp1, displacement_offset - count_offset);
update_mdp_by_offset(mdp, reg_tmp1, reg_tmp2);
// Inline assembly for: // // if (thread is in interp_only_mode) { // InterpreterRuntime::post_method_entry(); // } // if (DTraceMethodProbes) { // SharedRuntime::dtrace_method_entry(method, receiver); // } // if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { // SharedRuntime::rc_trace_method_entry(method, receiver); // }
void InterpreterMacroAssembler::notify_method_entry() { // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to // track stack depth. If it is possible to enter interp_only_mode we add // the code to check if the event should be sent. if (can_post_interpreter_events()) {
Label L;
bind(Lcontinue);
} // RedefineClasses() tracing support for obsolete method entry if (log_is_enabled(Trace, redefine, class, obsolete)) {
mov(R0, Rthread);
mov(R1, Rmethod);
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry),
R0, R1);
}
}
void InterpreterMacroAssembler::notify_method_exit(
TosState state, NotifyMethodExitMode mode, bool native, Register result_lo, Register result_hi, FloatRegister result_fp) { // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to // track stack depth. If it is possible to enter interp_only_mode we add // the code to check if the event should be sent. if (mode == NotifyJVMTI && can_post_interpreter_events()) {
Label L; // Note: frame::interpreter_frame_result has a dependency on how the // method result is saved across the call to post_method_exit. If this // is changed then the interpreter_frame_result implementation will // need to be updated too.
if (native) { // For c++ and template interpreter push both result registers on the // stack in native, we don't know the state. // See frame::interpreter_frame_result for code that gets the result values from here.
assert(result_lo != noreg, "result registers should be defined");
assert(result_hi != noreg, "result registers should be defined");
#ifdef __ABI_HARD__
assert(result_fp != fnoreg, "FP result register must be defined");
sub(SP, SP, 2 * wordSize);
fstd(result_fp, Address(SP)); #endif// __ABI_HARD__
} else { // For the template interpreter, the value on tos is the size of the // state. (c++ interpreter calls jvmti somewhere else).
push(state);
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit));
pop(state);
}
bind(L);
}
// Note: Disable DTrace runtime check for now to eliminate overhead on each method exit if (DTraceMethodProbes) {
Label Lcontinue;
// Jump if ((*counter_addr += increment) & mask) satisfies the condition. void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, int increment, Address mask_addr, Register scratch, Register scratch2,
AsmCondition cond, Label* where) { // caution: scratch2 and base address of counter_addr can be the same
assert_different_registers(scratch, scratch2);
ldr_u32(scratch, counter_addr);
add(scratch, scratch, increment);
str_32(scratch, counter_addr);
if (saveRegs) { // Save and restore in use caller-saved registers since they will be trashed by call_VM
assert(reg1 != noreg, "must specify reg1");
assert(reg2 != noreg, "must specify reg2");
assert(reg3 == noreg, "must not specify reg3");
push(RegisterSet(reg1) | RegisterSet(reg2));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.