Thu, 05 Jun 2008 15:57:56 -0700
6711316: Open source the Garbage-First garbage collector
Summary: First mercurial integration of the code for the Garbage-First garbage collector.
Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | #include "incls/_precompiled.incl" |
duke@435 | 26 | #include "incls/_interp_masm_x86_64.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | |
duke@435 | 29 | // Implementation of InterpreterMacroAssembler |
duke@435 | 30 | |
duke@435 | 31 | void InterpreterMacroAssembler::call_VM_leaf_base(address entry_point, |
duke@435 | 32 | int number_of_arguments) { |
duke@435 | 33 | // interpreter specific |
duke@435 | 34 | // |
duke@435 | 35 | // Note: No need to save/restore bcp & locals (r13 & r14) pointer |
duke@435 | 36 | // since these are callee saved registers and no blocking/ |
duke@435 | 37 | // GC can happen in leaf calls. |
ysr@777 | 38 | // Further Note: DO NOT save/restore bcp/locals. If a caller has |
ysr@777 | 39 | // already saved them so that it can use esi/edi as temporaries |
ysr@777 | 40 | // then a save/restore here will DESTROY the copy the caller |
ysr@777 | 41 | // saved! There used to be a save_bcp() that only happened in |
ysr@777 | 42 | // the ASSERT path (no restore_bcp). Which caused bizarre failures |
ysr@777 | 43 | // when jvm built with ASSERTs. |
duke@435 | 44 | #ifdef ASSERT |
duke@435 | 45 | { |
duke@435 | 46 | Label L; |
duke@435 | 47 | cmpq(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int)NULL_WORD); |
duke@435 | 48 | jcc(Assembler::equal, L); |
duke@435 | 49 | stop("InterpreterMacroAssembler::call_VM_leaf_base:" |
duke@435 | 50 | " last_sp != NULL"); |
duke@435 | 51 | bind(L); |
duke@435 | 52 | } |
duke@435 | 53 | #endif |
duke@435 | 54 | // super call |
duke@435 | 55 | MacroAssembler::call_VM_leaf_base(entry_point, number_of_arguments); |
duke@435 | 56 | // interpreter specific |
ysr@777 | 57 | // Used to ASSERT that r13/r14 were equal to frame's bcp/locals |
ysr@777 | 58 | // but since they may not have been saved (and we don't want to |
ysr@777 | 59 | // save thme here (see note above) the assert is invalid. |
duke@435 | 60 | } |
duke@435 | 61 | |
duke@435 | 62 | void InterpreterMacroAssembler::call_VM_base(Register oop_result, |
duke@435 | 63 | Register java_thread, |
duke@435 | 64 | Register last_java_sp, |
duke@435 | 65 | address entry_point, |
duke@435 | 66 | int number_of_arguments, |
duke@435 | 67 | bool check_exceptions) { |
duke@435 | 68 | // interpreter specific |
duke@435 | 69 | // |
duke@435 | 70 | // Note: Could avoid restoring locals ptr (callee saved) - however doesn't |
duke@435 | 71 | // really make a difference for these runtime calls, since they are |
duke@435 | 72 | // slow anyway. Btw., bcp must be saved/restored since it may change |
duke@435 | 73 | // due to GC. |
duke@435 | 74 | // assert(java_thread == noreg , "not expecting a precomputed java thread"); |
duke@435 | 75 | save_bcp(); |
duke@435 | 76 | #ifdef ASSERT |
duke@435 | 77 | { |
duke@435 | 78 | Label L; |
duke@435 | 79 | cmpq(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int)NULL_WORD); |
duke@435 | 80 | jcc(Assembler::equal, L); |
duke@435 | 81 | stop("InterpreterMacroAssembler::call_VM_leaf_base:" |
duke@435 | 82 | " last_sp != NULL"); |
duke@435 | 83 | bind(L); |
duke@435 | 84 | } |
duke@435 | 85 | #endif /* ASSERT */ |
duke@435 | 86 | // super call |
duke@435 | 87 | MacroAssembler::call_VM_base(oop_result, noreg, last_java_sp, |
duke@435 | 88 | entry_point, number_of_arguments, |
duke@435 | 89 | check_exceptions); |
duke@435 | 90 | // interpreter specific |
duke@435 | 91 | restore_bcp(); |
duke@435 | 92 | restore_locals(); |
duke@435 | 93 | } |
duke@435 | 94 | |
duke@435 | 95 | |
duke@435 | 96 | void InterpreterMacroAssembler::check_and_handle_popframe(Register java_thread) { |
duke@435 | 97 | if (JvmtiExport::can_pop_frame()) { |
duke@435 | 98 | Label L; |
duke@435 | 99 | // Initiate popframe handling only if it is not already being |
duke@435 | 100 | // processed. If the flag has the popframe_processing bit set, it |
duke@435 | 101 | // means that this code is called *during* popframe handling - we |
duke@435 | 102 | // don't want to reenter. |
duke@435 | 103 | // This method is only called just after the call into the vm in |
duke@435 | 104 | // call_VM_base, so the arg registers are available. |
duke@435 | 105 | movl(c_rarg0, Address(r15_thread, JavaThread::popframe_condition_offset())); |
duke@435 | 106 | testl(c_rarg0, JavaThread::popframe_pending_bit); |
duke@435 | 107 | jcc(Assembler::zero, L); |
duke@435 | 108 | testl(c_rarg0, JavaThread::popframe_processing_bit); |
duke@435 | 109 | jcc(Assembler::notZero, L); |
duke@435 | 110 | // Call Interpreter::remove_activation_preserving_args_entry() to get the |
duke@435 | 111 | // address of the same-named entrypoint in the generated interpreter code. |
duke@435 | 112 | call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_preserving_args_entry)); |
duke@435 | 113 | jmp(rax); |
duke@435 | 114 | bind(L); |
duke@435 | 115 | } |
duke@435 | 116 | } |
duke@435 | 117 | |
duke@435 | 118 | |
duke@435 | 119 | void InterpreterMacroAssembler::load_earlyret_value(TosState state) { |
duke@435 | 120 | movq(rcx, Address(r15_thread, JavaThread::jvmti_thread_state_offset())); |
duke@435 | 121 | const Address tos_addr(rcx, JvmtiThreadState::earlyret_tos_offset()); |
duke@435 | 122 | const Address oop_addr(rcx, JvmtiThreadState::earlyret_oop_offset()); |
duke@435 | 123 | const Address val_addr(rcx, JvmtiThreadState::earlyret_value_offset()); |
duke@435 | 124 | switch (state) { |
duke@435 | 125 | case atos: movq(rax, oop_addr); |
duke@435 | 126 | movptr(oop_addr, NULL_WORD); |
duke@435 | 127 | verify_oop(rax, state); break; |
duke@435 | 128 | case ltos: movq(rax, val_addr); break; |
duke@435 | 129 | case btos: // fall through |
duke@435 | 130 | case ctos: // fall through |
duke@435 | 131 | case stos: // fall through |
duke@435 | 132 | case itos: movl(rax, val_addr); break; |
duke@435 | 133 | case ftos: movflt(xmm0, val_addr); break; |
duke@435 | 134 | case dtos: movdbl(xmm0, val_addr); break; |
duke@435 | 135 | case vtos: /* nothing to do */ break; |
duke@435 | 136 | default : ShouldNotReachHere(); |
duke@435 | 137 | } |
duke@435 | 138 | // Clean up tos value in the thread object |
duke@435 | 139 | movl(tos_addr, (int) ilgl); |
duke@435 | 140 | movl(val_addr, (int) NULL_WORD); |
duke@435 | 141 | } |
duke@435 | 142 | |
duke@435 | 143 | |
duke@435 | 144 | void InterpreterMacroAssembler::check_and_handle_earlyret(Register java_thread) { |
duke@435 | 145 | if (JvmtiExport::can_force_early_return()) { |
duke@435 | 146 | Label L; |
duke@435 | 147 | movq(c_rarg0, Address(r15_thread, JavaThread::jvmti_thread_state_offset())); |
duke@435 | 148 | testq(c_rarg0, c_rarg0); |
duke@435 | 149 | jcc(Assembler::zero, L); // if (thread->jvmti_thread_state() == NULL) exit; |
duke@435 | 150 | |
duke@435 | 151 | // Initiate earlyret handling only if it is not already being processed. |
duke@435 | 152 | // If the flag has the earlyret_processing bit set, it means that this code |
duke@435 | 153 | // is called *during* earlyret handling - we don't want to reenter. |
duke@435 | 154 | movl(c_rarg0, Address(c_rarg0, JvmtiThreadState::earlyret_state_offset())); |
duke@435 | 155 | cmpl(c_rarg0, JvmtiThreadState::earlyret_pending); |
duke@435 | 156 | jcc(Assembler::notEqual, L); |
duke@435 | 157 | |
duke@435 | 158 | // Call Interpreter::remove_activation_early_entry() to get the address of the |
duke@435 | 159 | // same-named entrypoint in the generated interpreter code. |
duke@435 | 160 | movq(c_rarg0, Address(r15_thread, JavaThread::jvmti_thread_state_offset())); |
duke@435 | 161 | movl(c_rarg0, Address(c_rarg0, JvmtiThreadState::earlyret_tos_offset())); |
duke@435 | 162 | call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry), c_rarg0); |
duke@435 | 163 | jmp(rax); |
duke@435 | 164 | bind(L); |
duke@435 | 165 | } |
duke@435 | 166 | } |
duke@435 | 167 | |
duke@435 | 168 | |
duke@435 | 169 | void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp( |
duke@435 | 170 | Register reg, |
duke@435 | 171 | int bcp_offset) { |
duke@435 | 172 | assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode"); |
duke@435 | 173 | movl(reg, Address(r13, bcp_offset)); |
duke@435 | 174 | bswapl(reg); |
duke@435 | 175 | shrl(reg, 16); |
duke@435 | 176 | } |
duke@435 | 177 | |
duke@435 | 178 | |
duke@435 | 179 | void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, |
duke@435 | 180 | Register index, |
duke@435 | 181 | int bcp_offset) { |
duke@435 | 182 | assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); |
duke@435 | 183 | assert(cache != index, "must use different registers"); |
duke@435 | 184 | load_unsigned_word(index, Address(r13, bcp_offset)); |
duke@435 | 185 | movq(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); |
duke@435 | 186 | assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below"); |
duke@435 | 187 | // convert from field index to ConstantPoolCacheEntry index |
duke@435 | 188 | shll(index, 2); |
duke@435 | 189 | } |
duke@435 | 190 | |
duke@435 | 191 | |
duke@435 | 192 | void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, |
duke@435 | 193 | Register tmp, |
duke@435 | 194 | int bcp_offset) { |
duke@435 | 195 | assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); |
duke@435 | 196 | assert(cache != tmp, "must use different register"); |
duke@435 | 197 | load_unsigned_word(tmp, Address(r13, bcp_offset)); |
duke@435 | 198 | assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below"); |
duke@435 | 199 | // convert from field index to ConstantPoolCacheEntry index |
duke@435 | 200 | // and from word offset to byte offset |
duke@435 | 201 | shll(tmp, 2 + LogBytesPerWord); |
duke@435 | 202 | movq(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); |
duke@435 | 203 | // skip past the header |
duke@435 | 204 | addq(cache, in_bytes(constantPoolCacheOopDesc::base_offset())); |
duke@435 | 205 | addq(cache, tmp); // construct pointer to cache entry |
duke@435 | 206 | } |
duke@435 | 207 | |
duke@435 | 208 | |
duke@435 | 209 | // Generate a subtype check: branch to ok_is_subtype if sub_klass is a |
duke@435 | 210 | // subtype of super_klass. |
duke@435 | 211 | // |
duke@435 | 212 | // Args: |
duke@435 | 213 | // rax: superklass |
duke@435 | 214 | // Rsub_klass: subklass |
duke@435 | 215 | // |
duke@435 | 216 | // Kills: |
duke@435 | 217 | // rcx, rdi |
duke@435 | 218 | void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, |
duke@435 | 219 | Label& ok_is_subtype) { |
duke@435 | 220 | assert(Rsub_klass != rax, "rax holds superklass"); |
duke@435 | 221 | assert(Rsub_klass != r14, "r14 holds locals"); |
duke@435 | 222 | assert(Rsub_klass != r13, "r13 holds bcp"); |
duke@435 | 223 | assert(Rsub_klass != rcx, "rcx holds 2ndary super array length"); |
duke@435 | 224 | assert(Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr"); |
duke@435 | 225 | |
duke@435 | 226 | Label not_subtype, loop; |
duke@435 | 227 | |
duke@435 | 228 | // Profile the not-null value's klass. |
duke@435 | 229 | profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, rdi |
duke@435 | 230 | |
duke@435 | 231 | // Load the super-klass's check offset into rcx |
duke@435 | 232 | movl(rcx, Address(rax, sizeof(oopDesc) + |
duke@435 | 233 | Klass::super_check_offset_offset_in_bytes())); |
duke@435 | 234 | // Load from the sub-klass's super-class display list, or a 1-word |
duke@435 | 235 | // cache of the secondary superclass list, or a failing value with a |
duke@435 | 236 | // sentinel offset if the super-klass is an interface or |
duke@435 | 237 | // exceptionally deep in the Java hierarchy and we have to scan the |
duke@435 | 238 | // secondary superclass list the hard way. See if we get an |
duke@435 | 239 | // immediate positive hit |
duke@435 | 240 | cmpq(rax, Address(Rsub_klass, rcx, Address::times_1)); |
duke@435 | 241 | jcc(Assembler::equal,ok_is_subtype); |
duke@435 | 242 | |
duke@435 | 243 | // Check for immediate negative hit |
duke@435 | 244 | cmpl(rcx, sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes()); |
duke@435 | 245 | jcc( Assembler::notEqual, not_subtype ); |
duke@435 | 246 | // Check for self |
duke@435 | 247 | cmpq(Rsub_klass, rax); |
duke@435 | 248 | jcc(Assembler::equal, ok_is_subtype); |
duke@435 | 249 | |
duke@435 | 250 | // Now do a linear scan of the secondary super-klass chain. |
duke@435 | 251 | movq(rdi, Address(Rsub_klass, sizeof(oopDesc) + |
duke@435 | 252 | Klass::secondary_supers_offset_in_bytes())); |
duke@435 | 253 | // rdi holds the objArrayOop of secondary supers. |
duke@435 | 254 | // Load the array length |
duke@435 | 255 | movl(rcx, Address(rdi, arrayOopDesc::length_offset_in_bytes())); |
duke@435 | 256 | // Skip to start of data; also clear Z flag incase rcx is zero |
duke@435 | 257 | addq(rdi, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); |
duke@435 | 258 | // Scan rcx words at [rdi] for occurance of rax |
duke@435 | 259 | // Set NZ/Z based on last compare |
coleenp@548 | 260 | |
coleenp@548 | 261 | // this part is kind tricky, as values in supers array could be 32 or 64 bit wide |
coleenp@548 | 262 | // and we store values in objArrays always encoded, thus we need to encode value |
coleenp@548 | 263 | // before repne |
coleenp@548 | 264 | if (UseCompressedOops) { |
coleenp@548 | 265 | encode_heap_oop(rax); |
coleenp@548 | 266 | repne_scanl(); |
coleenp@548 | 267 | // Not equal? |
coleenp@548 | 268 | jcc(Assembler::notEqual, not_subtype); |
coleenp@548 | 269 | // decode heap oop here for movq |
coleenp@548 | 270 | decode_heap_oop(rax); |
coleenp@548 | 271 | } else { |
coleenp@548 | 272 | repne_scanq(); |
coleenp@548 | 273 | jcc(Assembler::notEqual, not_subtype); |
coleenp@548 | 274 | } |
duke@435 | 275 | // Must be equal but missed in cache. Update cache. |
duke@435 | 276 | movq(Address(Rsub_klass, sizeof(oopDesc) + |
duke@435 | 277 | Klass::secondary_super_cache_offset_in_bytes()), rax); |
duke@435 | 278 | jmp(ok_is_subtype); |
duke@435 | 279 | |
duke@435 | 280 | bind(not_subtype); |
coleenp@548 | 281 | // decode heap oop here for miss |
coleenp@548 | 282 | if (UseCompressedOops) decode_heap_oop(rax); |
duke@435 | 283 | profile_typecheck_failed(rcx); // blows rcx |
duke@435 | 284 | } |
duke@435 | 285 | |
duke@435 | 286 | |
duke@435 | 287 | // Java Expression Stack |
duke@435 | 288 | |
duke@435 | 289 | #ifdef ASSERT |
duke@435 | 290 | // Verifies that the stack tag matches. Must be called before the stack |
duke@435 | 291 | // value is popped off the stack. |
duke@435 | 292 | void InterpreterMacroAssembler::verify_stack_tag(frame::Tag t) { |
duke@435 | 293 | if (TaggedStackInterpreter) { |
duke@435 | 294 | frame::Tag tag = t; |
duke@435 | 295 | if (t == frame::TagCategory2) { |
duke@435 | 296 | tag = frame::TagValue; |
duke@435 | 297 | Label hokay; |
duke@435 | 298 | cmpq(Address(rsp, 3*wordSize), (int)tag); |
duke@435 | 299 | jcc(Assembler::equal, hokay); |
duke@435 | 300 | stop("Java Expression stack tag high value is bad"); |
duke@435 | 301 | bind(hokay); |
duke@435 | 302 | } |
duke@435 | 303 | Label okay; |
duke@435 | 304 | cmpq(Address(rsp, wordSize), (int)tag); |
duke@435 | 305 | jcc(Assembler::equal, okay); |
duke@435 | 306 | // Also compare if the stack value is zero, then the tag might |
duke@435 | 307 | // not have been set coming from deopt. |
duke@435 | 308 | cmpq(Address(rsp, 0), 0); |
duke@435 | 309 | jcc(Assembler::equal, okay); |
duke@435 | 310 | stop("Java Expression stack tag value is bad"); |
duke@435 | 311 | bind(okay); |
duke@435 | 312 | } |
duke@435 | 313 | } |
duke@435 | 314 | #endif // ASSERT |
duke@435 | 315 | |
duke@435 | 316 | void InterpreterMacroAssembler::pop_ptr(Register r) { |
duke@435 | 317 | debug_only(verify_stack_tag(frame::TagReference)); |
duke@435 | 318 | popq(r); |
duke@435 | 319 | if (TaggedStackInterpreter) addq(rsp, 1 * wordSize); |
duke@435 | 320 | } |
duke@435 | 321 | |
duke@435 | 322 | void InterpreterMacroAssembler::pop_ptr(Register r, Register tag) { |
duke@435 | 323 | popq(r); |
duke@435 | 324 | if (TaggedStackInterpreter) popq(tag); |
duke@435 | 325 | } |
duke@435 | 326 | |
duke@435 | 327 | void InterpreterMacroAssembler::pop_i(Register r) { |
duke@435 | 328 | // XXX can't use popq currently, upper half non clean |
duke@435 | 329 | debug_only(verify_stack_tag(frame::TagValue)); |
duke@435 | 330 | movl(r, Address(rsp, 0)); |
duke@435 | 331 | addq(rsp, wordSize); |
duke@435 | 332 | if (TaggedStackInterpreter) addq(rsp, 1 * wordSize); |
duke@435 | 333 | } |
duke@435 | 334 | |
duke@435 | 335 | void InterpreterMacroAssembler::pop_l(Register r) { |
duke@435 | 336 | debug_only(verify_stack_tag(frame::TagCategory2)); |
duke@435 | 337 | movq(r, Address(rsp, 0)); |
duke@435 | 338 | addq(rsp, 2 * Interpreter::stackElementSize()); |
duke@435 | 339 | } |
duke@435 | 340 | |
duke@435 | 341 | void InterpreterMacroAssembler::pop_f(XMMRegister r) { |
duke@435 | 342 | debug_only(verify_stack_tag(frame::TagValue)); |
duke@435 | 343 | movflt(r, Address(rsp, 0)); |
duke@435 | 344 | addq(rsp, wordSize); |
duke@435 | 345 | if (TaggedStackInterpreter) addq(rsp, 1 * wordSize); |
duke@435 | 346 | } |
duke@435 | 347 | |
duke@435 | 348 | void InterpreterMacroAssembler::pop_d(XMMRegister r) { |
duke@435 | 349 | debug_only(verify_stack_tag(frame::TagCategory2)); |
duke@435 | 350 | movdbl(r, Address(rsp, 0)); |
duke@435 | 351 | addq(rsp, 2 * Interpreter::stackElementSize()); |
duke@435 | 352 | } |
duke@435 | 353 | |
duke@435 | 354 | void InterpreterMacroAssembler::push_ptr(Register r) { |
duke@435 | 355 | if (TaggedStackInterpreter) pushq(frame::TagReference); |
duke@435 | 356 | pushq(r); |
duke@435 | 357 | } |
duke@435 | 358 | |
duke@435 | 359 | void InterpreterMacroAssembler::push_ptr(Register r, Register tag) { |
duke@435 | 360 | if (TaggedStackInterpreter) pushq(tag); |
duke@435 | 361 | pushq(r); |
duke@435 | 362 | } |
duke@435 | 363 | |
duke@435 | 364 | void InterpreterMacroAssembler::push_i(Register r) { |
duke@435 | 365 | if (TaggedStackInterpreter) pushq(frame::TagValue); |
duke@435 | 366 | pushq(r); |
duke@435 | 367 | } |
duke@435 | 368 | |
duke@435 | 369 | void InterpreterMacroAssembler::push_l(Register r) { |
duke@435 | 370 | if (TaggedStackInterpreter) { |
duke@435 | 371 | pushq(frame::TagValue); |
duke@435 | 372 | subq(rsp, 1 * wordSize); |
duke@435 | 373 | pushq(frame::TagValue); |
duke@435 | 374 | subq(rsp, 1 * wordSize); |
duke@435 | 375 | } else { |
duke@435 | 376 | subq(rsp, 2 * wordSize); |
duke@435 | 377 | } |
duke@435 | 378 | movq(Address(rsp, 0), r); |
duke@435 | 379 | } |
duke@435 | 380 | |
duke@435 | 381 | void InterpreterMacroAssembler::push_f(XMMRegister r) { |
duke@435 | 382 | if (TaggedStackInterpreter) pushq(frame::TagValue); |
duke@435 | 383 | subq(rsp, wordSize); |
duke@435 | 384 | movflt(Address(rsp, 0), r); |
duke@435 | 385 | } |
duke@435 | 386 | |
duke@435 | 387 | void InterpreterMacroAssembler::push_d(XMMRegister r) { |
duke@435 | 388 | if (TaggedStackInterpreter) { |
duke@435 | 389 | pushq(frame::TagValue); |
duke@435 | 390 | subq(rsp, 1 * wordSize); |
duke@435 | 391 | pushq(frame::TagValue); |
duke@435 | 392 | subq(rsp, 1 * wordSize); |
duke@435 | 393 | } else { |
duke@435 | 394 | subq(rsp, 2 * wordSize); |
duke@435 | 395 | } |
duke@435 | 396 | movdbl(Address(rsp, 0), r); |
duke@435 | 397 | } |
duke@435 | 398 | |
duke@435 | 399 | void InterpreterMacroAssembler::pop(TosState state) { |
duke@435 | 400 | switch (state) { |
duke@435 | 401 | case atos: pop_ptr(); break; |
duke@435 | 402 | case btos: |
duke@435 | 403 | case ctos: |
duke@435 | 404 | case stos: |
duke@435 | 405 | case itos: pop_i(); break; |
duke@435 | 406 | case ltos: pop_l(); break; |
duke@435 | 407 | case ftos: pop_f(); break; |
duke@435 | 408 | case dtos: pop_d(); break; |
duke@435 | 409 | case vtos: /* nothing to do */ break; |
duke@435 | 410 | default: ShouldNotReachHere(); |
duke@435 | 411 | } |
duke@435 | 412 | verify_oop(rax, state); |
duke@435 | 413 | } |
duke@435 | 414 | |
duke@435 | 415 | void InterpreterMacroAssembler::push(TosState state) { |
duke@435 | 416 | verify_oop(rax, state); |
duke@435 | 417 | switch (state) { |
duke@435 | 418 | case atos: push_ptr(); break; |
duke@435 | 419 | case btos: |
duke@435 | 420 | case ctos: |
duke@435 | 421 | case stos: |
duke@435 | 422 | case itos: push_i(); break; |
duke@435 | 423 | case ltos: push_l(); break; |
duke@435 | 424 | case ftos: push_f(); break; |
duke@435 | 425 | case dtos: push_d(); break; |
duke@435 | 426 | case vtos: /* nothing to do */ break; |
duke@435 | 427 | default : ShouldNotReachHere(); |
duke@435 | 428 | } |
duke@435 | 429 | } |
duke@435 | 430 | |
duke@435 | 431 | |
duke@435 | 432 | // Tagged stack helpers for swap and dup |
duke@435 | 433 | void InterpreterMacroAssembler::load_ptr_and_tag(int n, Register val, |
duke@435 | 434 | Register tag) { |
duke@435 | 435 | movq(val, Address(rsp, Interpreter::expr_offset_in_bytes(n))); |
duke@435 | 436 | if (TaggedStackInterpreter) { |
duke@435 | 437 | movq(tag, Address(rsp, Interpreter::expr_tag_offset_in_bytes(n))); |
duke@435 | 438 | } |
duke@435 | 439 | } |
duke@435 | 440 | |
duke@435 | 441 | void InterpreterMacroAssembler::store_ptr_and_tag(int n, Register val, |
duke@435 | 442 | Register tag) { |
duke@435 | 443 | movq(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val); |
duke@435 | 444 | if (TaggedStackInterpreter) { |
duke@435 | 445 | movq(Address(rsp, Interpreter::expr_tag_offset_in_bytes(n)), tag); |
duke@435 | 446 | } |
duke@435 | 447 | } |
duke@435 | 448 | |
duke@435 | 449 | |
duke@435 | 450 | // Tagged local support |
duke@435 | 451 | void InterpreterMacroAssembler::tag_local(frame::Tag tag, int n) { |
duke@435 | 452 | if (TaggedStackInterpreter) { |
duke@435 | 453 | if (tag == frame::TagCategory2) { |
duke@435 | 454 | mov64(Address(r14, Interpreter::local_tag_offset_in_bytes(n+1)), |
duke@435 | 455 | (intptr_t)frame::TagValue); |
duke@435 | 456 | mov64(Address(r14, Interpreter::local_tag_offset_in_bytes(n)), |
duke@435 | 457 | (intptr_t)frame::TagValue); |
duke@435 | 458 | } else { |
duke@435 | 459 | mov64(Address(r14, Interpreter::local_tag_offset_in_bytes(n)), (intptr_t)tag); |
duke@435 | 460 | } |
duke@435 | 461 | } |
duke@435 | 462 | } |
duke@435 | 463 | |
duke@435 | 464 | void InterpreterMacroAssembler::tag_local(frame::Tag tag, Register idx) { |
duke@435 | 465 | if (TaggedStackInterpreter) { |
duke@435 | 466 | if (tag == frame::TagCategory2) { |
duke@435 | 467 | mov64(Address(r14, idx, Address::times_8, |
duke@435 | 468 | Interpreter::local_tag_offset_in_bytes(1)), (intptr_t)frame::TagValue); |
duke@435 | 469 | mov64(Address(r14, idx, Address::times_8, |
duke@435 | 470 | Interpreter::local_tag_offset_in_bytes(0)), (intptr_t)frame::TagValue); |
duke@435 | 471 | } else { |
duke@435 | 472 | mov64(Address(r14, idx, Address::times_8, Interpreter::local_tag_offset_in_bytes(0)), |
duke@435 | 473 | (intptr_t)tag); |
duke@435 | 474 | } |
duke@435 | 475 | } |
duke@435 | 476 | } |
duke@435 | 477 | |
duke@435 | 478 | void InterpreterMacroAssembler::tag_local(Register tag, Register idx) { |
duke@435 | 479 | if (TaggedStackInterpreter) { |
duke@435 | 480 | // can only be TagValue or TagReference |
duke@435 | 481 | movq(Address(r14, idx, Address::times_8, Interpreter::local_tag_offset_in_bytes(0)), tag); |
duke@435 | 482 | } |
duke@435 | 483 | } |
duke@435 | 484 | |
duke@435 | 485 | |
duke@435 | 486 | void InterpreterMacroAssembler::tag_local(Register tag, int n) { |
duke@435 | 487 | if (TaggedStackInterpreter) { |
duke@435 | 488 | // can only be TagValue or TagReference |
duke@435 | 489 | movq(Address(r14, Interpreter::local_tag_offset_in_bytes(n)), tag); |
duke@435 | 490 | } |
duke@435 | 491 | } |
duke@435 | 492 | |
duke@435 | 493 | #ifdef ASSERT |
duke@435 | 494 | void InterpreterMacroAssembler::verify_local_tag(frame::Tag tag, int n) { |
duke@435 | 495 | if (TaggedStackInterpreter) { |
duke@435 | 496 | frame::Tag t = tag; |
duke@435 | 497 | if (tag == frame::TagCategory2) { |
duke@435 | 498 | Label nbl; |
duke@435 | 499 | t = frame::TagValue; // change to what is stored in locals |
duke@435 | 500 | cmpq(Address(r14, Interpreter::local_tag_offset_in_bytes(n+1)), (int)t); |
duke@435 | 501 | jcc(Assembler::equal, nbl); |
duke@435 | 502 | stop("Local tag is bad for long/double"); |
duke@435 | 503 | bind(nbl); |
duke@435 | 504 | } |
duke@435 | 505 | Label notBad; |
duke@435 | 506 | cmpq(Address(r14, Interpreter::local_tag_offset_in_bytes(n)), (int)t); |
duke@435 | 507 | jcc(Assembler::equal, notBad); |
duke@435 | 508 | // Also compare if the local value is zero, then the tag might |
duke@435 | 509 | // not have been set coming from deopt. |
duke@435 | 510 | cmpq(Address(r14, Interpreter::local_offset_in_bytes(n)), 0); |
duke@435 | 511 | jcc(Assembler::equal, notBad); |
duke@435 | 512 | stop("Local tag is bad"); |
duke@435 | 513 | bind(notBad); |
duke@435 | 514 | } |
duke@435 | 515 | } |
duke@435 | 516 | |
duke@435 | 517 | void InterpreterMacroAssembler::verify_local_tag(frame::Tag tag, Register idx) { |
duke@435 | 518 | if (TaggedStackInterpreter) { |
duke@435 | 519 | frame::Tag t = tag; |
duke@435 | 520 | if (tag == frame::TagCategory2) { |
duke@435 | 521 | Label nbl; |
duke@435 | 522 | t = frame::TagValue; // change to what is stored in locals |
duke@435 | 523 | cmpq(Address(r14, idx, Address::times_8, Interpreter::local_tag_offset_in_bytes(1)), (int)t); |
duke@435 | 524 | jcc(Assembler::equal, nbl); |
duke@435 | 525 | stop("Local tag is bad for long/double"); |
duke@435 | 526 | bind(nbl); |
duke@435 | 527 | } |
duke@435 | 528 | Label notBad; |
duke@435 | 529 | cmpq(Address(r14, idx, Address::times_8, Interpreter::local_tag_offset_in_bytes(0)), (int)t); |
duke@435 | 530 | jcc(Assembler::equal, notBad); |
duke@435 | 531 | // Also compare if the local value is zero, then the tag might |
duke@435 | 532 | // not have been set coming from deopt. |
duke@435 | 533 | cmpq(Address(r14, idx, Address::times_8, Interpreter::local_offset_in_bytes(0)), 0); |
duke@435 | 534 | jcc(Assembler::equal, notBad); |
duke@435 | 535 | stop("Local tag is bad"); |
duke@435 | 536 | bind(notBad); |
duke@435 | 537 | } |
duke@435 | 538 | } |
duke@435 | 539 | #endif // ASSERT |
duke@435 | 540 | |
duke@435 | 541 | |
duke@435 | 542 | void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point) { |
duke@435 | 543 | MacroAssembler::call_VM_leaf_base(entry_point, 0); |
duke@435 | 544 | } |
duke@435 | 545 | |
duke@435 | 546 | |
duke@435 | 547 | void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, |
duke@435 | 548 | Register arg_1) { |
duke@435 | 549 | if (c_rarg0 != arg_1) { |
duke@435 | 550 | movq(c_rarg0, arg_1); |
duke@435 | 551 | } |
duke@435 | 552 | MacroAssembler::call_VM_leaf_base(entry_point, 1); |
duke@435 | 553 | } |
duke@435 | 554 | |
duke@435 | 555 | |
duke@435 | 556 | void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, |
duke@435 | 557 | Register arg_1, |
duke@435 | 558 | Register arg_2) { |
duke@435 | 559 | assert(c_rarg0 != arg_2, "smashed argument"); |
duke@435 | 560 | assert(c_rarg1 != arg_1, "smashed argument"); |
duke@435 | 561 | if (c_rarg0 != arg_1) { |
duke@435 | 562 | movq(c_rarg0, arg_1); |
duke@435 | 563 | } |
duke@435 | 564 | if (c_rarg1 != arg_2) { |
duke@435 | 565 | movq(c_rarg1, arg_2); |
duke@435 | 566 | } |
duke@435 | 567 | MacroAssembler::call_VM_leaf_base(entry_point, 2); |
duke@435 | 568 | } |
duke@435 | 569 | |
duke@435 | 570 | void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, |
duke@435 | 571 | Register arg_1, |
duke@435 | 572 | Register arg_2, |
duke@435 | 573 | Register arg_3) { |
duke@435 | 574 | assert(c_rarg0 != arg_2, "smashed argument"); |
duke@435 | 575 | assert(c_rarg0 != arg_3, "smashed argument"); |
duke@435 | 576 | assert(c_rarg1 != arg_1, "smashed argument"); |
duke@435 | 577 | assert(c_rarg1 != arg_3, "smashed argument"); |
duke@435 | 578 | assert(c_rarg2 != arg_1, "smashed argument"); |
duke@435 | 579 | assert(c_rarg2 != arg_2, "smashed argument"); |
duke@435 | 580 | if (c_rarg0 != arg_1) { |
duke@435 | 581 | movq(c_rarg0, arg_1); |
duke@435 | 582 | } |
duke@435 | 583 | if (c_rarg1 != arg_2) { |
duke@435 | 584 | movq(c_rarg1, arg_2); |
duke@435 | 585 | } |
duke@435 | 586 | if (c_rarg2 != arg_3) { |
duke@435 | 587 | movq(c_rarg2, arg_3); |
duke@435 | 588 | } |
duke@435 | 589 | MacroAssembler::call_VM_leaf_base(entry_point, 3); |
duke@435 | 590 | } |
duke@435 | 591 | |
duke@435 | 592 | // Jump to from_interpreted entry of a call unless single stepping is possible |
duke@435 | 593 | // in this thread in which case we must call the i2i entry |
duke@435 | 594 | void InterpreterMacroAssembler::jump_from_interpreted(Register method, Register temp) { |
duke@435 | 595 | // set sender sp |
duke@435 | 596 | leaq(r13, Address(rsp, wordSize)); |
duke@435 | 597 | // record last_sp |
duke@435 | 598 | movq(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), r13); |
duke@435 | 599 | |
duke@435 | 600 | if (JvmtiExport::can_post_interpreter_events()) { |
duke@435 | 601 | Label run_compiled_code; |
duke@435 | 602 | // JVMTI events, such as single-stepping, are implemented partly by avoiding running |
duke@435 | 603 | // compiled code in threads for which the event is enabled. Check here for |
duke@435 | 604 | // interp_only_mode if these events CAN be enabled. |
duke@435 | 605 | get_thread(temp); |
duke@435 | 606 | // interp_only is an int, on little endian it is sufficient to test the byte only |
duke@435 | 607 | // Is a cmpl faster (ce |
duke@435 | 608 | cmpb(Address(temp, JavaThread::interp_only_mode_offset()), 0); |
duke@435 | 609 | jcc(Assembler::zero, run_compiled_code); |
duke@435 | 610 | jmp(Address(method, methodOopDesc::interpreter_entry_offset())); |
duke@435 | 611 | bind(run_compiled_code); |
duke@435 | 612 | } |
duke@435 | 613 | |
duke@435 | 614 | jmp(Address(method, methodOopDesc::from_interpreted_offset())); |
duke@435 | 615 | |
duke@435 | 616 | } |
duke@435 | 617 | |
duke@435 | 618 | |
duke@435 | 619 | // The following two routines provide a hook so that an implementation |
duke@435 | 620 | // can schedule the dispatch in two parts. amd64 does not do this. |
duke@435 | 621 | void InterpreterMacroAssembler::dispatch_prolog(TosState state, int step) { |
duke@435 | 622 | // Nothing amd64 specific to be done here |
duke@435 | 623 | } |
duke@435 | 624 | |
duke@435 | 625 | void InterpreterMacroAssembler::dispatch_epilog(TosState state, int step) { |
duke@435 | 626 | dispatch_next(state, step); |
duke@435 | 627 | } |
duke@435 | 628 | |
duke@435 | 629 | void InterpreterMacroAssembler::dispatch_base(TosState state, |
duke@435 | 630 | address* table, |
duke@435 | 631 | bool verifyoop) { |
duke@435 | 632 | verify_FPU(1, state); |
duke@435 | 633 | if (VerifyActivationFrameSize) { |
duke@435 | 634 | Label L; |
duke@435 | 635 | movq(rcx, rbp); |
duke@435 | 636 | subq(rcx, rsp); |
duke@435 | 637 | int min_frame_size = |
duke@435 | 638 | (frame::link_offset - frame::interpreter_frame_initial_sp_offset) * |
duke@435 | 639 | wordSize; |
duke@435 | 640 | cmpq(rcx, min_frame_size); |
duke@435 | 641 | jcc(Assembler::greaterEqual, L); |
duke@435 | 642 | stop("broken stack frame"); |
duke@435 | 643 | bind(L); |
duke@435 | 644 | } |
duke@435 | 645 | if (verifyoop) { |
duke@435 | 646 | verify_oop(rax, state); |
duke@435 | 647 | } |
duke@435 | 648 | lea(rscratch1, ExternalAddress((address)table)); |
duke@435 | 649 | jmp(Address(rscratch1, rbx, Address::times_8)); |
duke@435 | 650 | } |
duke@435 | 651 | |
duke@435 | 652 | void InterpreterMacroAssembler::dispatch_only(TosState state) { |
duke@435 | 653 | dispatch_base(state, Interpreter::dispatch_table(state)); |
duke@435 | 654 | } |
duke@435 | 655 | |
duke@435 | 656 | void InterpreterMacroAssembler::dispatch_only_normal(TosState state) { |
duke@435 | 657 | dispatch_base(state, Interpreter::normal_table(state)); |
duke@435 | 658 | } |
duke@435 | 659 | |
duke@435 | 660 | void InterpreterMacroAssembler::dispatch_only_noverify(TosState state) { |
duke@435 | 661 | dispatch_base(state, Interpreter::normal_table(state), false); |
duke@435 | 662 | } |
duke@435 | 663 | |
duke@435 | 664 | |
duke@435 | 665 | void InterpreterMacroAssembler::dispatch_next(TosState state, int step) { |
duke@435 | 666 | // load next bytecode (load before advancing r13 to prevent AGI) |
duke@435 | 667 | load_unsigned_byte(rbx, Address(r13, step)); |
duke@435 | 668 | // advance r13 |
duke@435 | 669 | incrementq(r13, step); |
duke@435 | 670 | dispatch_base(state, Interpreter::dispatch_table(state)); |
duke@435 | 671 | } |
duke@435 | 672 | |
duke@435 | 673 | void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) { |
duke@435 | 674 | // load current bytecode |
duke@435 | 675 | load_unsigned_byte(rbx, Address(r13, 0)); |
duke@435 | 676 | dispatch_base(state, table); |
duke@435 | 677 | } |
duke@435 | 678 | |
duke@435 | 679 | // remove activation |
duke@435 | 680 | // |
duke@435 | 681 | // Unlock the receiver if this is a synchronized method. |
duke@435 | 682 | // Unlock any Java monitors from syncronized blocks. |
duke@435 | 683 | // Remove the activation from the stack. |
duke@435 | 684 | // |
duke@435 | 685 | // If there are locked Java monitors |
duke@435 | 686 | // If throw_monitor_exception |
duke@435 | 687 | // throws IllegalMonitorStateException |
duke@435 | 688 | // Else if install_monitor_exception |
duke@435 | 689 | // installs IllegalMonitorStateException |
duke@435 | 690 | // Else |
duke@435 | 691 | // no error processing |
duke@435 | 692 | void InterpreterMacroAssembler::remove_activation( |
duke@435 | 693 | TosState state, |
duke@435 | 694 | Register ret_addr, |
duke@435 | 695 | bool throw_monitor_exception, |
duke@435 | 696 | bool install_monitor_exception, |
duke@435 | 697 | bool notify_jvmdi) { |
duke@435 | 698 | // Note: Registers rdx xmm0 may be in use for the |
duke@435 | 699 | // result check if synchronized method |
duke@435 | 700 | Label unlocked, unlock, no_unlock; |
duke@435 | 701 | |
duke@435 | 702 | // get the value of _do_not_unlock_if_synchronized into rdx |
duke@435 | 703 | const Address do_not_unlock_if_synchronized(r15_thread, |
duke@435 | 704 | in_bytes(JavaThread::do_not_unlock_if_synchronized_offset())); |
duke@435 | 705 | movbool(rdx, do_not_unlock_if_synchronized); |
duke@435 | 706 | movbool(do_not_unlock_if_synchronized, false); // reset the flag |
duke@435 | 707 | |
duke@435 | 708 | // get method access flags |
duke@435 | 709 | movq(rbx, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); |
duke@435 | 710 | movl(rcx, Address(rbx, methodOopDesc::access_flags_offset())); |
duke@435 | 711 | testl(rcx, JVM_ACC_SYNCHRONIZED); |
duke@435 | 712 | jcc(Assembler::zero, unlocked); |
duke@435 | 713 | |
duke@435 | 714 | // Don't unlock anything if the _do_not_unlock_if_synchronized flag |
duke@435 | 715 | // is set. |
duke@435 | 716 | testbool(rdx); |
duke@435 | 717 | jcc(Assembler::notZero, no_unlock); |
duke@435 | 718 | |
duke@435 | 719 | // unlock monitor |
duke@435 | 720 | push(state); // save result |
duke@435 | 721 | |
duke@435 | 722 | // BasicObjectLock will be first in list, since this is a |
duke@435 | 723 | // synchronized method. However, need to check that the object has |
duke@435 | 724 | // not been unlocked by an explicit monitorexit bytecode. |
duke@435 | 725 | const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * |
duke@435 | 726 | wordSize - (int) sizeof(BasicObjectLock)); |
duke@435 | 727 | // We use c_rarg1 so that if we go slow path it will be the correct |
duke@435 | 728 | // register for unlock_object to pass to VM directly |
duke@435 | 729 | leaq(c_rarg1, monitor); // address of first monitor |
duke@435 | 730 | |
duke@435 | 731 | movq(rax, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes())); |
duke@435 | 732 | testq(rax, rax); |
duke@435 | 733 | jcc(Assembler::notZero, unlock); |
duke@435 | 734 | |
duke@435 | 735 | pop(state); |
duke@435 | 736 | if (throw_monitor_exception) { |
duke@435 | 737 | // Entry already unlocked, need to throw exception |
duke@435 | 738 | call_VM(noreg, CAST_FROM_FN_PTR(address, |
duke@435 | 739 | InterpreterRuntime::throw_illegal_monitor_state_exception)); |
duke@435 | 740 | should_not_reach_here(); |
duke@435 | 741 | } else { |
duke@435 | 742 | // Monitor already unlocked during a stack unroll. If requested, |
duke@435 | 743 | // install an illegal_monitor_state_exception. Continue with |
duke@435 | 744 | // stack unrolling. |
duke@435 | 745 | if (install_monitor_exception) { |
duke@435 | 746 | call_VM(noreg, CAST_FROM_FN_PTR(address, |
duke@435 | 747 | InterpreterRuntime::new_illegal_monitor_state_exception)); |
duke@435 | 748 | } |
duke@435 | 749 | jmp(unlocked); |
duke@435 | 750 | } |
duke@435 | 751 | |
duke@435 | 752 | bind(unlock); |
duke@435 | 753 | unlock_object(c_rarg1); |
duke@435 | 754 | pop(state); |
duke@435 | 755 | |
duke@435 | 756 | // Check that for block-structured locking (i.e., that all locked |
duke@435 | 757 | // objects has been unlocked) |
duke@435 | 758 | bind(unlocked); |
duke@435 | 759 | |
duke@435 | 760 | // rax: Might contain return value |
duke@435 | 761 | |
duke@435 | 762 | // Check that all monitors are unlocked |
duke@435 | 763 | { |
duke@435 | 764 | Label loop, exception, entry, restart; |
duke@435 | 765 | const int entry_size = frame::interpreter_frame_monitor_size() * wordSize; |
duke@435 | 766 | const Address monitor_block_top( |
duke@435 | 767 | rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize); |
duke@435 | 768 | const Address monitor_block_bot( |
duke@435 | 769 | rbp, frame::interpreter_frame_initial_sp_offset * wordSize); |
duke@435 | 770 | |
duke@435 | 771 | bind(restart); |
duke@435 | 772 | // We use c_rarg1 so that if we go slow path it will be the correct |
duke@435 | 773 | // register for unlock_object to pass to VM directly |
duke@435 | 774 | movq(c_rarg1, monitor_block_top); // points to current entry, starting |
duke@435 | 775 | // with top-most entry |
duke@435 | 776 | leaq(rbx, monitor_block_bot); // points to word before bottom of |
duke@435 | 777 | // monitor block |
duke@435 | 778 | jmp(entry); |
duke@435 | 779 | |
duke@435 | 780 | // Entry already locked, need to throw exception |
duke@435 | 781 | bind(exception); |
duke@435 | 782 | |
duke@435 | 783 | if (throw_monitor_exception) { |
duke@435 | 784 | // Throw exception |
duke@435 | 785 | MacroAssembler::call_VM(noreg, |
duke@435 | 786 | CAST_FROM_FN_PTR(address, InterpreterRuntime:: |
duke@435 | 787 | throw_illegal_monitor_state_exception)); |
duke@435 | 788 | should_not_reach_here(); |
duke@435 | 789 | } else { |
duke@435 | 790 | // Stack unrolling. Unlock object and install illegal_monitor_exception. |
duke@435 | 791 | // Unlock does not block, so don't have to worry about the frame. |
duke@435 | 792 | // We don't have to preserve c_rarg1 since we are going to throw an exception. |
duke@435 | 793 | |
duke@435 | 794 | push(state); |
duke@435 | 795 | unlock_object(c_rarg1); |
duke@435 | 796 | pop(state); |
duke@435 | 797 | |
duke@435 | 798 | if (install_monitor_exception) { |
duke@435 | 799 | call_VM(noreg, CAST_FROM_FN_PTR(address, |
duke@435 | 800 | InterpreterRuntime:: |
duke@435 | 801 | new_illegal_monitor_state_exception)); |
duke@435 | 802 | } |
duke@435 | 803 | |
duke@435 | 804 | jmp(restart); |
duke@435 | 805 | } |
duke@435 | 806 | |
duke@435 | 807 | bind(loop); |
duke@435 | 808 | // check if current entry is used |
duke@435 | 809 | cmpq(Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes()), (int) NULL); |
duke@435 | 810 | jcc(Assembler::notEqual, exception); |
duke@435 | 811 | |
duke@435 | 812 | addq(c_rarg1, entry_size); // otherwise advance to next entry |
duke@435 | 813 | bind(entry); |
duke@435 | 814 | cmpq(c_rarg1, rbx); // check if bottom reached |
duke@435 | 815 | jcc(Assembler::notEqual, loop); // if not at bottom then check this entry |
duke@435 | 816 | } |
duke@435 | 817 | |
duke@435 | 818 | bind(no_unlock); |
duke@435 | 819 | |
duke@435 | 820 | // jvmti support |
duke@435 | 821 | if (notify_jvmdi) { |
duke@435 | 822 | notify_method_exit(state, NotifyJVMTI); // preserve TOSCA |
duke@435 | 823 | } else { |
duke@435 | 824 | notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA |
duke@435 | 825 | } |
duke@435 | 826 | |
duke@435 | 827 | // remove activation |
duke@435 | 828 | // get sender sp |
duke@435 | 829 | movq(rbx, |
duke@435 | 830 | Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize)); |
duke@435 | 831 | leave(); // remove frame anchor |
duke@435 | 832 | popq(ret_addr); // get return address |
duke@435 | 833 | movq(rsp, rbx); // set sp to sender sp |
duke@435 | 834 | } |
duke@435 | 835 | |
duke@435 | 836 | // Lock object |
duke@435 | 837 | // |
duke@435 | 838 | // Args: |
duke@435 | 839 | // c_rarg1: BasicObjectLock to be used for locking |
duke@435 | 840 | // |
duke@435 | 841 | // Kills: |
duke@435 | 842 | // rax |
duke@435 | 843 | // c_rarg0, c_rarg1, c_rarg2, c_rarg3, .. (param regs) |
duke@435 | 844 | // rscratch1, rscratch2 (scratch regs) |
duke@435 | 845 | void InterpreterMacroAssembler::lock_object(Register lock_reg) { |
duke@435 | 846 | assert(lock_reg == c_rarg1, "The argument is only for looks. It must be c_rarg1"); |
duke@435 | 847 | |
duke@435 | 848 | if (UseHeavyMonitors) { |
duke@435 | 849 | call_VM(noreg, |
duke@435 | 850 | CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), |
duke@435 | 851 | lock_reg); |
duke@435 | 852 | } else { |
duke@435 | 853 | Label done; |
duke@435 | 854 | |
duke@435 | 855 | const Register swap_reg = rax; // Must use rax for cmpxchg instruction |
duke@435 | 856 | const Register obj_reg = c_rarg3; // Will contain the oop |
duke@435 | 857 | |
duke@435 | 858 | const int obj_offset = BasicObjectLock::obj_offset_in_bytes(); |
duke@435 | 859 | const int lock_offset = BasicObjectLock::lock_offset_in_bytes (); |
duke@435 | 860 | const int mark_offset = lock_offset + |
duke@435 | 861 | BasicLock::displaced_header_offset_in_bytes(); |
duke@435 | 862 | |
duke@435 | 863 | Label slow_case; |
duke@435 | 864 | |
duke@435 | 865 | // Load object pointer into obj_reg %c_rarg3 |
duke@435 | 866 | movq(obj_reg, Address(lock_reg, obj_offset)); |
duke@435 | 867 | |
duke@435 | 868 | if (UseBiasedLocking) { |
duke@435 | 869 | biased_locking_enter(lock_reg, obj_reg, swap_reg, rscratch1, false, done, &slow_case); |
duke@435 | 870 | } |
duke@435 | 871 | |
duke@435 | 872 | // Load immediate 1 into swap_reg %rax |
duke@435 | 873 | movl(swap_reg, 1); |
duke@435 | 874 | |
duke@435 | 875 | // Load (object->mark() | 1) into swap_reg %rax |
duke@435 | 876 | orq(swap_reg, Address(obj_reg, 0)); |
duke@435 | 877 | |
duke@435 | 878 | // Save (object->mark() | 1) into BasicLock's displaced header |
duke@435 | 879 | movq(Address(lock_reg, mark_offset), swap_reg); |
duke@435 | 880 | |
duke@435 | 881 | assert(lock_offset == 0, |
duke@435 | 882 | "displached header must be first word in BasicObjectLock"); |
duke@435 | 883 | |
duke@435 | 884 | if (os::is_MP()) lock(); |
duke@435 | 885 | cmpxchgq(lock_reg, Address(obj_reg, 0)); |
duke@435 | 886 | if (PrintBiasedLockingStatistics) { |
duke@435 | 887 | cond_inc32(Assembler::zero, |
duke@435 | 888 | ExternalAddress((address) BiasedLocking::fast_path_entry_count_addr())); |
duke@435 | 889 | } |
duke@435 | 890 | jcc(Assembler::zero, done); |
duke@435 | 891 | |
duke@435 | 892 | // Test if the oopMark is an obvious stack pointer, i.e., |
duke@435 | 893 | // 1) (mark & 7) == 0, and |
duke@435 | 894 | // 2) rsp <= mark < mark + os::pagesize() |
duke@435 | 895 | // |
duke@435 | 896 | // These 3 tests can be done by evaluating the following |
duke@435 | 897 | // expression: ((mark - rsp) & (7 - os::vm_page_size())), |
duke@435 | 898 | // assuming both stack pointer and pagesize have their |
duke@435 | 899 | // least significant 3 bits clear. |
duke@435 | 900 | // NOTE: the oopMark is in swap_reg %rax as the result of cmpxchg |
duke@435 | 901 | subq(swap_reg, rsp); |
duke@435 | 902 | andq(swap_reg, 7 - os::vm_page_size()); |
duke@435 | 903 | |
duke@435 | 904 | // Save the test result, for recursive case, the result is zero |
duke@435 | 905 | movq(Address(lock_reg, mark_offset), swap_reg); |
duke@435 | 906 | |
duke@435 | 907 | if (PrintBiasedLockingStatistics) { |
duke@435 | 908 | cond_inc32(Assembler::zero, |
duke@435 | 909 | ExternalAddress((address) BiasedLocking::fast_path_entry_count_addr())); |
duke@435 | 910 | } |
duke@435 | 911 | jcc(Assembler::zero, done); |
duke@435 | 912 | |
duke@435 | 913 | bind(slow_case); |
duke@435 | 914 | |
duke@435 | 915 | // Call the runtime routine for slow case |
duke@435 | 916 | call_VM(noreg, |
duke@435 | 917 | CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), |
duke@435 | 918 | lock_reg); |
duke@435 | 919 | |
duke@435 | 920 | bind(done); |
duke@435 | 921 | } |
duke@435 | 922 | } |
duke@435 | 923 | |
duke@435 | 924 | |
duke@435 | 925 | // Unlocks an object. Used in monitorexit bytecode and |
duke@435 | 926 | // remove_activation. Throws an IllegalMonitorException if object is |
duke@435 | 927 | // not locked by current thread. |
duke@435 | 928 | // |
duke@435 | 929 | // Args: |
duke@435 | 930 | // c_rarg1: BasicObjectLock for lock |
duke@435 | 931 | // |
duke@435 | 932 | // Kills: |
duke@435 | 933 | // rax |
duke@435 | 934 | // c_rarg0, c_rarg1, c_rarg2, c_rarg3, ... (param regs) |
duke@435 | 935 | // rscratch1, rscratch2 (scratch regs) |
duke@435 | 936 | void InterpreterMacroAssembler::unlock_object(Register lock_reg) { |
duke@435 | 937 | assert(lock_reg == c_rarg1, "The argument is only for looks. It must be rarg1"); |
duke@435 | 938 | |
duke@435 | 939 | if (UseHeavyMonitors) { |
duke@435 | 940 | call_VM(noreg, |
duke@435 | 941 | CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), |
duke@435 | 942 | lock_reg); |
duke@435 | 943 | } else { |
duke@435 | 944 | Label done; |
duke@435 | 945 | |
duke@435 | 946 | const Register swap_reg = rax; // Must use rax for cmpxchg instruction |
duke@435 | 947 | const Register header_reg = c_rarg2; // Will contain the old oopMark |
duke@435 | 948 | const Register obj_reg = c_rarg3; // Will contain the oop |
duke@435 | 949 | |
duke@435 | 950 | save_bcp(); // Save in case of exception |
duke@435 | 951 | |
duke@435 | 952 | // Convert from BasicObjectLock structure to object and BasicLock |
duke@435 | 953 | // structure Store the BasicLock address into %rax |
duke@435 | 954 | leaq(swap_reg, Address(lock_reg, BasicObjectLock::lock_offset_in_bytes())); |
duke@435 | 955 | |
duke@435 | 956 | // Load oop into obj_reg(%c_rarg3) |
duke@435 | 957 | movq(obj_reg, Address(lock_reg, BasicObjectLock::obj_offset_in_bytes())); |
duke@435 | 958 | |
duke@435 | 959 | // Free entry |
duke@435 | 960 | movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), NULL_WORD); |
duke@435 | 961 | |
duke@435 | 962 | if (UseBiasedLocking) { |
duke@435 | 963 | biased_locking_exit(obj_reg, header_reg, done); |
duke@435 | 964 | } |
duke@435 | 965 | |
duke@435 | 966 | // Load the old header from BasicLock structure |
duke@435 | 967 | movq(header_reg, Address(swap_reg, |
duke@435 | 968 | BasicLock::displaced_header_offset_in_bytes())); |
duke@435 | 969 | |
duke@435 | 970 | // Test for recursion |
duke@435 | 971 | testq(header_reg, header_reg); |
duke@435 | 972 | |
duke@435 | 973 | // zero for recursive case |
duke@435 | 974 | jcc(Assembler::zero, done); |
duke@435 | 975 | |
duke@435 | 976 | // Atomic swap back the old header |
duke@435 | 977 | if (os::is_MP()) lock(); |
duke@435 | 978 | cmpxchgq(header_reg, Address(obj_reg, 0)); |
duke@435 | 979 | |
duke@435 | 980 | // zero for recursive case |
duke@435 | 981 | jcc(Assembler::zero, done); |
duke@435 | 982 | |
duke@435 | 983 | // Call the runtime routine for slow case. |
duke@435 | 984 | movq(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), |
duke@435 | 985 | obj_reg); // restore obj |
duke@435 | 986 | call_VM(noreg, |
duke@435 | 987 | CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), |
duke@435 | 988 | lock_reg); |
duke@435 | 989 | |
duke@435 | 990 | bind(done); |
duke@435 | 991 | |
duke@435 | 992 | restore_bcp(); |
duke@435 | 993 | } |
duke@435 | 994 | } |
duke@435 | 995 | |
duke@435 | 996 | |
duke@435 | 997 | void InterpreterMacroAssembler::test_method_data_pointer(Register mdp, |
duke@435 | 998 | Label& zero_continue) { |
duke@435 | 999 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1000 | movq(mdp, Address(rbp, frame::interpreter_frame_mdx_offset * wordSize)); |
duke@435 | 1001 | testq(mdp, mdp); |
duke@435 | 1002 | jcc(Assembler::zero, zero_continue); |
duke@435 | 1003 | } |
duke@435 | 1004 | |
duke@435 | 1005 | |
duke@435 | 1006 | // Set the method data pointer for the current bcp. |
duke@435 | 1007 | void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { |
duke@435 | 1008 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1009 | Label zero_continue; |
duke@435 | 1010 | pushq(rax); |
duke@435 | 1011 | pushq(rbx); |
duke@435 | 1012 | |
duke@435 | 1013 | get_method(rbx); |
duke@435 | 1014 | // Test MDO to avoid the call if it is NULL. |
duke@435 | 1015 | movq(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); |
duke@435 | 1016 | testq(rax, rax); |
duke@435 | 1017 | jcc(Assembler::zero, zero_continue); |
duke@435 | 1018 | |
duke@435 | 1019 | // rbx: method |
duke@435 | 1020 | // r13: bcp |
duke@435 | 1021 | call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, r13); |
duke@435 | 1022 | // rax: mdi |
duke@435 | 1023 | |
duke@435 | 1024 | movq(rbx, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); |
duke@435 | 1025 | testq(rbx, rbx); |
duke@435 | 1026 | jcc(Assembler::zero, zero_continue); |
duke@435 | 1027 | addq(rbx, in_bytes(methodDataOopDesc::data_offset())); |
duke@435 | 1028 | addq(rbx, rax); |
duke@435 | 1029 | movq(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rbx); |
duke@435 | 1030 | |
duke@435 | 1031 | bind(zero_continue); |
duke@435 | 1032 | popq(rbx); |
duke@435 | 1033 | popq(rax); |
duke@435 | 1034 | } |
duke@435 | 1035 | |
duke@435 | 1036 | void InterpreterMacroAssembler::verify_method_data_pointer() { |
duke@435 | 1037 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1038 | #ifdef ASSERT |
duke@435 | 1039 | Label verify_continue; |
duke@435 | 1040 | pushq(rax); |
duke@435 | 1041 | pushq(rbx); |
duke@435 | 1042 | pushq(c_rarg3); |
duke@435 | 1043 | pushq(c_rarg2); |
duke@435 | 1044 | test_method_data_pointer(c_rarg3, verify_continue); // If mdp is zero, continue |
duke@435 | 1045 | get_method(rbx); |
duke@435 | 1046 | |
duke@435 | 1047 | // If the mdp is valid, it will point to a DataLayout header which is |
duke@435 | 1048 | // consistent with the bcp. The converse is highly probable also. |
duke@435 | 1049 | load_unsigned_word(c_rarg2, |
duke@435 | 1050 | Address(c_rarg3, in_bytes(DataLayout::bci_offset()))); |
duke@435 | 1051 | addq(c_rarg2, Address(rbx, methodOopDesc::const_offset())); |
duke@435 | 1052 | leaq(c_rarg2, Address(c_rarg2, constMethodOopDesc::codes_offset())); |
duke@435 | 1053 | cmpq(c_rarg2, r13); |
duke@435 | 1054 | jcc(Assembler::equal, verify_continue); |
duke@435 | 1055 | // rbx: method |
duke@435 | 1056 | // r13: bcp |
duke@435 | 1057 | // c_rarg3: mdp |
duke@435 | 1058 | call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::verify_mdp), |
duke@435 | 1059 | rbx, r13, c_rarg3); |
duke@435 | 1060 | bind(verify_continue); |
duke@435 | 1061 | popq(c_rarg2); |
duke@435 | 1062 | popq(c_rarg3); |
duke@435 | 1063 | popq(rbx); |
duke@435 | 1064 | popq(rax); |
duke@435 | 1065 | #endif // ASSERT |
duke@435 | 1066 | } |
duke@435 | 1067 | |
duke@435 | 1068 | |
duke@435 | 1069 | void InterpreterMacroAssembler::set_mdp_data_at(Register mdp_in, |
duke@435 | 1070 | int constant, |
duke@435 | 1071 | Register value) { |
duke@435 | 1072 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1073 | Address data(mdp_in, constant); |
duke@435 | 1074 | movq(data, value); |
duke@435 | 1075 | } |
duke@435 | 1076 | |
duke@435 | 1077 | |
duke@435 | 1078 | void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in, |
duke@435 | 1079 | int constant, |
duke@435 | 1080 | bool decrement) { |
duke@435 | 1081 | // Counter address |
duke@435 | 1082 | Address data(mdp_in, constant); |
duke@435 | 1083 | |
duke@435 | 1084 | increment_mdp_data_at(data, decrement); |
duke@435 | 1085 | } |
duke@435 | 1086 | |
duke@435 | 1087 | void InterpreterMacroAssembler::increment_mdp_data_at(Address data, |
duke@435 | 1088 | bool decrement) { |
duke@435 | 1089 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1090 | |
duke@435 | 1091 | if (decrement) { |
duke@435 | 1092 | // Decrement the register. Set condition codes. |
duke@435 | 1093 | addq(data, -DataLayout::counter_increment); |
duke@435 | 1094 | // If the decrement causes the counter to overflow, stay negative |
duke@435 | 1095 | Label L; |
duke@435 | 1096 | jcc(Assembler::negative, L); |
duke@435 | 1097 | addq(data, DataLayout::counter_increment); |
duke@435 | 1098 | bind(L); |
duke@435 | 1099 | } else { |
duke@435 | 1100 | assert(DataLayout::counter_increment == 1, |
duke@435 | 1101 | "flow-free idiom only works with 1"); |
duke@435 | 1102 | // Increment the register. Set carry flag. |
duke@435 | 1103 | addq(data, DataLayout::counter_increment); |
duke@435 | 1104 | // If the increment causes the counter to overflow, pull back by 1. |
duke@435 | 1105 | sbbq(data, 0); |
duke@435 | 1106 | } |
duke@435 | 1107 | } |
duke@435 | 1108 | |
duke@435 | 1109 | |
duke@435 | 1110 | void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in, |
duke@435 | 1111 | Register reg, |
duke@435 | 1112 | int constant, |
duke@435 | 1113 | bool decrement) { |
duke@435 | 1114 | Address data(mdp_in, reg, Address::times_1, constant); |
duke@435 | 1115 | |
duke@435 | 1116 | increment_mdp_data_at(data, decrement); |
duke@435 | 1117 | } |
duke@435 | 1118 | |
duke@435 | 1119 | void InterpreterMacroAssembler::set_mdp_flag_at(Register mdp_in, |
duke@435 | 1120 | int flag_byte_constant) { |
duke@435 | 1121 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1122 | int header_offset = in_bytes(DataLayout::header_offset()); |
duke@435 | 1123 | int header_bits = DataLayout::flag_mask_to_header_mask(flag_byte_constant); |
duke@435 | 1124 | // Set the flag |
duke@435 | 1125 | orl(Address(mdp_in, header_offset), header_bits); |
duke@435 | 1126 | } |
duke@435 | 1127 | |
duke@435 | 1128 | |
duke@435 | 1129 | |
duke@435 | 1130 | void InterpreterMacroAssembler::test_mdp_data_at(Register mdp_in, |
duke@435 | 1131 | int offset, |
duke@435 | 1132 | Register value, |
duke@435 | 1133 | Register test_value_out, |
duke@435 | 1134 | Label& not_equal_continue) { |
duke@435 | 1135 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1136 | if (test_value_out == noreg) { |
duke@435 | 1137 | cmpq(value, Address(mdp_in, offset)); |
duke@435 | 1138 | } else { |
duke@435 | 1139 | // Put the test value into a register, so caller can use it: |
duke@435 | 1140 | movq(test_value_out, Address(mdp_in, offset)); |
duke@435 | 1141 | cmpq(test_value_out, value); |
duke@435 | 1142 | } |
duke@435 | 1143 | jcc(Assembler::notEqual, not_equal_continue); |
duke@435 | 1144 | } |
duke@435 | 1145 | |
duke@435 | 1146 | |
duke@435 | 1147 | void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, |
duke@435 | 1148 | int offset_of_disp) { |
duke@435 | 1149 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1150 | Address disp_address(mdp_in, offset_of_disp); |
duke@435 | 1151 | addq(mdp_in, disp_address); |
duke@435 | 1152 | movq(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); |
duke@435 | 1153 | } |
duke@435 | 1154 | |
duke@435 | 1155 | |
duke@435 | 1156 | void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, |
duke@435 | 1157 | Register reg, |
duke@435 | 1158 | int offset_of_disp) { |
duke@435 | 1159 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1160 | Address disp_address(mdp_in, reg, Address::times_1, offset_of_disp); |
duke@435 | 1161 | addq(mdp_in, disp_address); |
duke@435 | 1162 | movq(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); |
duke@435 | 1163 | } |
duke@435 | 1164 | |
duke@435 | 1165 | |
duke@435 | 1166 | void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in, |
duke@435 | 1167 | int constant) { |
duke@435 | 1168 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1169 | addq(mdp_in, constant); |
duke@435 | 1170 | movq(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); |
duke@435 | 1171 | } |
duke@435 | 1172 | |
duke@435 | 1173 | |
duke@435 | 1174 | void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) { |
duke@435 | 1175 | assert(ProfileInterpreter, "must be profiling interpreter"); |
duke@435 | 1176 | pushq(return_bci); // save/restore across call_VM |
duke@435 | 1177 | call_VM(noreg, |
duke@435 | 1178 | CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret), |
duke@435 | 1179 | return_bci); |
duke@435 | 1180 | popq(return_bci); |
duke@435 | 1181 | } |
duke@435 | 1182 | |
duke@435 | 1183 | |
duke@435 | 1184 | void InterpreterMacroAssembler::profile_taken_branch(Register mdp, |
duke@435 | 1185 | Register bumped_count) { |
duke@435 | 1186 | if (ProfileInterpreter) { |
duke@435 | 1187 | Label profile_continue; |
duke@435 | 1188 | |
duke@435 | 1189 | // If no method data exists, go to profile_continue. |
duke@435 | 1190 | // Otherwise, assign to mdp |
duke@435 | 1191 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1192 | |
duke@435 | 1193 | // We are taking a branch. Increment the taken count. |
duke@435 | 1194 | // We inline increment_mdp_data_at to return bumped_count in a register |
duke@435 | 1195 | //increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset())); |
duke@435 | 1196 | Address data(mdp, in_bytes(JumpData::taken_offset())); |
duke@435 | 1197 | movq(bumped_count, data); |
duke@435 | 1198 | assert(DataLayout::counter_increment == 1, |
duke@435 | 1199 | "flow-free idiom only works with 1"); |
duke@435 | 1200 | addq(bumped_count, DataLayout::counter_increment); |
duke@435 | 1201 | sbbq(bumped_count, 0); |
duke@435 | 1202 | movq(data, bumped_count); // Store back out |
duke@435 | 1203 | |
duke@435 | 1204 | // The method data pointer needs to be updated to reflect the new target. |
duke@435 | 1205 | update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset())); |
duke@435 | 1206 | bind(profile_continue); |
duke@435 | 1207 | } |
duke@435 | 1208 | } |
duke@435 | 1209 | |
duke@435 | 1210 | |
duke@435 | 1211 | void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) { |
duke@435 | 1212 | if (ProfileInterpreter) { |
duke@435 | 1213 | Label profile_continue; |
duke@435 | 1214 | |
duke@435 | 1215 | // If no method data exists, go to profile_continue. |
duke@435 | 1216 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1217 | |
duke@435 | 1218 | // We are taking a branch. Increment the not taken count. |
duke@435 | 1219 | increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset())); |
duke@435 | 1220 | |
duke@435 | 1221 | // The method data pointer needs to be updated to correspond to |
duke@435 | 1222 | // the next bytecode |
duke@435 | 1223 | update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size())); |
duke@435 | 1224 | bind(profile_continue); |
duke@435 | 1225 | } |
duke@435 | 1226 | } |
duke@435 | 1227 | |
duke@435 | 1228 | |
duke@435 | 1229 | void InterpreterMacroAssembler::profile_call(Register mdp) { |
duke@435 | 1230 | if (ProfileInterpreter) { |
duke@435 | 1231 | Label profile_continue; |
duke@435 | 1232 | |
duke@435 | 1233 | // If no method data exists, go to profile_continue. |
duke@435 | 1234 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1235 | |
duke@435 | 1236 | // We are making a call. Increment the count. |
duke@435 | 1237 | increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
duke@435 | 1238 | |
duke@435 | 1239 | // The method data pointer needs to be updated to reflect the new target. |
duke@435 | 1240 | update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size())); |
duke@435 | 1241 | bind(profile_continue); |
duke@435 | 1242 | } |
duke@435 | 1243 | } |
duke@435 | 1244 | |
duke@435 | 1245 | |
duke@435 | 1246 | void InterpreterMacroAssembler::profile_final_call(Register mdp) { |
duke@435 | 1247 | if (ProfileInterpreter) { |
duke@435 | 1248 | Label profile_continue; |
duke@435 | 1249 | |
duke@435 | 1250 | // If no method data exists, go to profile_continue. |
duke@435 | 1251 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1252 | |
duke@435 | 1253 | // We are making a call. Increment the count. |
duke@435 | 1254 | increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
duke@435 | 1255 | |
duke@435 | 1256 | // The method data pointer needs to be updated to reflect the new target. |
duke@435 | 1257 | update_mdp_by_constant(mdp, |
duke@435 | 1258 | in_bytes(VirtualCallData:: |
duke@435 | 1259 | virtual_call_data_size())); |
duke@435 | 1260 | bind(profile_continue); |
duke@435 | 1261 | } |
duke@435 | 1262 | } |
duke@435 | 1263 | |
duke@435 | 1264 | |
duke@435 | 1265 | void InterpreterMacroAssembler::profile_virtual_call(Register receiver, |
duke@435 | 1266 | Register mdp, |
duke@435 | 1267 | Register reg2) { |
duke@435 | 1268 | if (ProfileInterpreter) { |
duke@435 | 1269 | Label profile_continue; |
duke@435 | 1270 | |
duke@435 | 1271 | // If no method data exists, go to profile_continue. |
duke@435 | 1272 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1273 | |
duke@435 | 1274 | // We are making a call. Increment the count. |
duke@435 | 1275 | increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
duke@435 | 1276 | |
duke@435 | 1277 | // Record the receiver type. |
duke@435 | 1278 | record_klass_in_profile(receiver, mdp, reg2); |
duke@435 | 1279 | |
duke@435 | 1280 | // The method data pointer needs to be updated to reflect the new target. |
duke@435 | 1281 | update_mdp_by_constant(mdp, |
duke@435 | 1282 | in_bytes(VirtualCallData:: |
duke@435 | 1283 | virtual_call_data_size())); |
duke@435 | 1284 | bind(profile_continue); |
duke@435 | 1285 | } |
duke@435 | 1286 | } |
duke@435 | 1287 | |
duke@435 | 1288 | // This routine creates a state machine for updating the multi-row |
duke@435 | 1289 | // type profile at a virtual call site (or other type-sensitive bytecode). |
duke@435 | 1290 | // The machine visits each row (of receiver/count) until the receiver type |
duke@435 | 1291 | // is found, or until it runs out of rows. At the same time, it remembers |
duke@435 | 1292 | // the location of the first empty row. (An empty row records null for its |
duke@435 | 1293 | // receiver, and can be allocated for a newly-observed receiver type.) |
duke@435 | 1294 | // Because there are two degrees of freedom in the state, a simple linear |
duke@435 | 1295 | // search will not work; it must be a decision tree. Hence this helper |
duke@435 | 1296 | // function is recursive, to generate the required tree structured code. |
duke@435 | 1297 | // It's the interpreter, so we are trading off code space for speed. |
duke@435 | 1298 | // See below for example code. |
duke@435 | 1299 | void InterpreterMacroAssembler::record_klass_in_profile_helper( |
duke@435 | 1300 | Register receiver, Register mdp, |
duke@435 | 1301 | Register reg2, |
duke@435 | 1302 | int start_row, Label& done) { |
duke@435 | 1303 | int last_row = VirtualCallData::row_limit() - 1; |
duke@435 | 1304 | assert(start_row <= last_row, "must be work left to do"); |
duke@435 | 1305 | // Test this row for both the receiver and for null. |
duke@435 | 1306 | // Take any of three different outcomes: |
duke@435 | 1307 | // 1. found receiver => increment count and goto done |
duke@435 | 1308 | // 2. found null => keep looking for case 1, maybe allocate this cell |
duke@435 | 1309 | // 3. found something else => keep looking for cases 1 and 2 |
duke@435 | 1310 | // Case 3 is handled by a recursive call. |
duke@435 | 1311 | for (int row = start_row; row <= last_row; row++) { |
duke@435 | 1312 | Label next_test; |
duke@435 | 1313 | bool test_for_null_also = (row == start_row); |
duke@435 | 1314 | |
duke@435 | 1315 | // See if the receiver is receiver[n]. |
duke@435 | 1316 | int recvr_offset = in_bytes(VirtualCallData::receiver_offset(row)); |
duke@435 | 1317 | test_mdp_data_at(mdp, recvr_offset, receiver, |
duke@435 | 1318 | (test_for_null_also ? reg2 : noreg), |
duke@435 | 1319 | next_test); |
duke@435 | 1320 | // (Reg2 now contains the receiver from the CallData.) |
duke@435 | 1321 | |
duke@435 | 1322 | // The receiver is receiver[n]. Increment count[n]. |
duke@435 | 1323 | int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row)); |
duke@435 | 1324 | increment_mdp_data_at(mdp, count_offset); |
duke@435 | 1325 | jmp(done); |
duke@435 | 1326 | bind(next_test); |
duke@435 | 1327 | |
duke@435 | 1328 | if (test_for_null_also) { |
duke@435 | 1329 | // Failed the equality check on receiver[n]... Test for null. |
duke@435 | 1330 | testq(reg2, reg2); |
duke@435 | 1331 | if (start_row == last_row) { |
duke@435 | 1332 | // The only thing left to do is handle the null case. |
duke@435 | 1333 | jcc(Assembler::notZero, done); |
duke@435 | 1334 | break; |
duke@435 | 1335 | } |
duke@435 | 1336 | // Since null is rare, make it be the branch-taken case. |
duke@435 | 1337 | Label found_null; |
duke@435 | 1338 | jcc(Assembler::zero, found_null); |
duke@435 | 1339 | |
duke@435 | 1340 | // Put all the "Case 3" tests here. |
duke@435 | 1341 | record_klass_in_profile_helper(receiver, mdp, reg2, start_row + 1, done); |
duke@435 | 1342 | |
duke@435 | 1343 | // Found a null. Keep searching for a matching receiver, |
duke@435 | 1344 | // but remember that this is an empty (unused) slot. |
duke@435 | 1345 | bind(found_null); |
duke@435 | 1346 | } |
duke@435 | 1347 | } |
duke@435 | 1348 | |
duke@435 | 1349 | // In the fall-through case, we found no matching receiver, but we |
duke@435 | 1350 | // observed the receiver[start_row] is NULL. |
duke@435 | 1351 | |
duke@435 | 1352 | // Fill in the receiver field and increment the count. |
duke@435 | 1353 | int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row)); |
duke@435 | 1354 | set_mdp_data_at(mdp, recvr_offset, receiver); |
duke@435 | 1355 | int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row)); |
duke@435 | 1356 | movl(reg2, DataLayout::counter_increment); |
duke@435 | 1357 | set_mdp_data_at(mdp, count_offset, reg2); |
duke@435 | 1358 | jmp(done); |
duke@435 | 1359 | } |
duke@435 | 1360 | |
duke@435 | 1361 | // Example state machine code for three profile rows: |
duke@435 | 1362 | // // main copy of decision tree, rooted at row[1] |
duke@435 | 1363 | // if (row[0].rec == rec) { row[0].incr(); goto done; } |
duke@435 | 1364 | // if (row[0].rec != NULL) { |
duke@435 | 1365 | // // inner copy of decision tree, rooted at row[1] |
duke@435 | 1366 | // if (row[1].rec == rec) { row[1].incr(); goto done; } |
duke@435 | 1367 | // if (row[1].rec != NULL) { |
duke@435 | 1368 | // // degenerate decision tree, rooted at row[2] |
duke@435 | 1369 | // if (row[2].rec == rec) { row[2].incr(); goto done; } |
duke@435 | 1370 | // if (row[2].rec != NULL) { goto done; } // overflow |
duke@435 | 1371 | // row[2].init(rec); goto done; |
duke@435 | 1372 | // } else { |
duke@435 | 1373 | // // remember row[1] is empty |
duke@435 | 1374 | // if (row[2].rec == rec) { row[2].incr(); goto done; } |
duke@435 | 1375 | // row[1].init(rec); goto done; |
duke@435 | 1376 | // } |
duke@435 | 1377 | // } else { |
duke@435 | 1378 | // // remember row[0] is empty |
duke@435 | 1379 | // if (row[1].rec == rec) { row[1].incr(); goto done; } |
duke@435 | 1380 | // if (row[2].rec == rec) { row[2].incr(); goto done; } |
duke@435 | 1381 | // row[0].init(rec); goto done; |
duke@435 | 1382 | // } |
duke@435 | 1383 | |
duke@435 | 1384 | void InterpreterMacroAssembler::record_klass_in_profile(Register receiver, |
duke@435 | 1385 | Register mdp, |
duke@435 | 1386 | Register reg2) { |
duke@435 | 1387 | assert(ProfileInterpreter, "must be profiling"); |
duke@435 | 1388 | Label done; |
duke@435 | 1389 | |
duke@435 | 1390 | record_klass_in_profile_helper(receiver, mdp, reg2, 0, done); |
duke@435 | 1391 | |
duke@435 | 1392 | bind (done); |
duke@435 | 1393 | } |
duke@435 | 1394 | |
duke@435 | 1395 | void InterpreterMacroAssembler::profile_ret(Register return_bci, |
duke@435 | 1396 | Register mdp) { |
duke@435 | 1397 | if (ProfileInterpreter) { |
duke@435 | 1398 | Label profile_continue; |
duke@435 | 1399 | uint row; |
duke@435 | 1400 | |
duke@435 | 1401 | // If no method data exists, go to profile_continue. |
duke@435 | 1402 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1403 | |
duke@435 | 1404 | // Update the total ret count. |
duke@435 | 1405 | increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
duke@435 | 1406 | |
duke@435 | 1407 | for (row = 0; row < RetData::row_limit(); row++) { |
duke@435 | 1408 | Label next_test; |
duke@435 | 1409 | |
duke@435 | 1410 | // See if return_bci is equal to bci[n]: |
duke@435 | 1411 | test_mdp_data_at(mdp, |
duke@435 | 1412 | in_bytes(RetData::bci_offset(row)), |
duke@435 | 1413 | return_bci, noreg, |
duke@435 | 1414 | next_test); |
duke@435 | 1415 | |
duke@435 | 1416 | // return_bci is equal to bci[n]. Increment the count. |
duke@435 | 1417 | increment_mdp_data_at(mdp, in_bytes(RetData::bci_count_offset(row))); |
duke@435 | 1418 | |
duke@435 | 1419 | // The method data pointer needs to be updated to reflect the new target. |
duke@435 | 1420 | update_mdp_by_offset(mdp, |
duke@435 | 1421 | in_bytes(RetData::bci_displacement_offset(row))); |
duke@435 | 1422 | jmp(profile_continue); |
duke@435 | 1423 | bind(next_test); |
duke@435 | 1424 | } |
duke@435 | 1425 | |
duke@435 | 1426 | update_mdp_for_ret(return_bci); |
duke@435 | 1427 | |
duke@435 | 1428 | bind(profile_continue); |
duke@435 | 1429 | } |
duke@435 | 1430 | } |
duke@435 | 1431 | |
duke@435 | 1432 | |
duke@435 | 1433 | void InterpreterMacroAssembler::profile_null_seen(Register mdp) { |
duke@435 | 1434 | if (ProfileInterpreter) { |
duke@435 | 1435 | Label profile_continue; |
duke@435 | 1436 | |
duke@435 | 1437 | // If no method data exists, go to profile_continue. |
duke@435 | 1438 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1439 | |
duke@435 | 1440 | // The method data pointer needs to be updated. |
duke@435 | 1441 | int mdp_delta = in_bytes(BitData::bit_data_size()); |
duke@435 | 1442 | if (TypeProfileCasts) { |
duke@435 | 1443 | mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); |
duke@435 | 1444 | } |
duke@435 | 1445 | update_mdp_by_constant(mdp, mdp_delta); |
duke@435 | 1446 | |
duke@435 | 1447 | bind(profile_continue); |
duke@435 | 1448 | } |
duke@435 | 1449 | } |
duke@435 | 1450 | |
duke@435 | 1451 | |
duke@435 | 1452 | void InterpreterMacroAssembler::profile_typecheck_failed(Register mdp) { |
duke@435 | 1453 | if (ProfileInterpreter && TypeProfileCasts) { |
duke@435 | 1454 | Label profile_continue; |
duke@435 | 1455 | |
duke@435 | 1456 | // If no method data exists, go to profile_continue. |
duke@435 | 1457 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1458 | |
duke@435 | 1459 | int count_offset = in_bytes(CounterData::count_offset()); |
duke@435 | 1460 | // Back up the address, since we have already bumped the mdp. |
duke@435 | 1461 | count_offset -= in_bytes(VirtualCallData::virtual_call_data_size()); |
duke@435 | 1462 | |
duke@435 | 1463 | // *Decrement* the counter. We expect to see zero or small negatives. |
duke@435 | 1464 | increment_mdp_data_at(mdp, count_offset, true); |
duke@435 | 1465 | |
duke@435 | 1466 | bind (profile_continue); |
duke@435 | 1467 | } |
duke@435 | 1468 | } |
duke@435 | 1469 | |
duke@435 | 1470 | |
duke@435 | 1471 | void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass, Register reg2) { |
duke@435 | 1472 | if (ProfileInterpreter) { |
duke@435 | 1473 | Label profile_continue; |
duke@435 | 1474 | |
duke@435 | 1475 | // If no method data exists, go to profile_continue. |
duke@435 | 1476 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1477 | |
duke@435 | 1478 | // The method data pointer needs to be updated. |
duke@435 | 1479 | int mdp_delta = in_bytes(BitData::bit_data_size()); |
duke@435 | 1480 | if (TypeProfileCasts) { |
duke@435 | 1481 | mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); |
duke@435 | 1482 | |
duke@435 | 1483 | // Record the object type. |
duke@435 | 1484 | record_klass_in_profile(klass, mdp, reg2); |
duke@435 | 1485 | } |
duke@435 | 1486 | update_mdp_by_constant(mdp, mdp_delta); |
duke@435 | 1487 | |
duke@435 | 1488 | bind(profile_continue); |
duke@435 | 1489 | } |
duke@435 | 1490 | } |
duke@435 | 1491 | |
duke@435 | 1492 | |
duke@435 | 1493 | void InterpreterMacroAssembler::profile_switch_default(Register mdp) { |
duke@435 | 1494 | if (ProfileInterpreter) { |
duke@435 | 1495 | Label profile_continue; |
duke@435 | 1496 | |
duke@435 | 1497 | // If no method data exists, go to profile_continue. |
duke@435 | 1498 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1499 | |
duke@435 | 1500 | // Update the default case count |
duke@435 | 1501 | increment_mdp_data_at(mdp, |
duke@435 | 1502 | in_bytes(MultiBranchData::default_count_offset())); |
duke@435 | 1503 | |
duke@435 | 1504 | // The method data pointer needs to be updated. |
duke@435 | 1505 | update_mdp_by_offset(mdp, |
duke@435 | 1506 | in_bytes(MultiBranchData:: |
duke@435 | 1507 | default_displacement_offset())); |
duke@435 | 1508 | |
duke@435 | 1509 | bind(profile_continue); |
duke@435 | 1510 | } |
duke@435 | 1511 | } |
duke@435 | 1512 | |
duke@435 | 1513 | |
duke@435 | 1514 | void InterpreterMacroAssembler::profile_switch_case(Register index, |
duke@435 | 1515 | Register mdp, |
duke@435 | 1516 | Register reg2) { |
duke@435 | 1517 | if (ProfileInterpreter) { |
duke@435 | 1518 | Label profile_continue; |
duke@435 | 1519 | |
duke@435 | 1520 | // If no method data exists, go to profile_continue. |
duke@435 | 1521 | test_method_data_pointer(mdp, profile_continue); |
duke@435 | 1522 | |
duke@435 | 1523 | // Build the base (index * per_case_size_in_bytes()) + |
duke@435 | 1524 | // case_array_offset_in_bytes() |
duke@435 | 1525 | movl(reg2, in_bytes(MultiBranchData::per_case_size())); |
duke@435 | 1526 | imulq(index, reg2); // XXX l ? |
duke@435 | 1527 | addq(index, in_bytes(MultiBranchData::case_array_offset())); // XXX l ? |
duke@435 | 1528 | |
duke@435 | 1529 | // Update the case count |
duke@435 | 1530 | increment_mdp_data_at(mdp, |
duke@435 | 1531 | index, |
duke@435 | 1532 | in_bytes(MultiBranchData::relative_count_offset())); |
duke@435 | 1533 | |
duke@435 | 1534 | // The method data pointer needs to be updated. |
duke@435 | 1535 | update_mdp_by_offset(mdp, |
duke@435 | 1536 | index, |
duke@435 | 1537 | in_bytes(MultiBranchData:: |
duke@435 | 1538 | relative_displacement_offset())); |
duke@435 | 1539 | |
duke@435 | 1540 | bind(profile_continue); |
duke@435 | 1541 | } |
duke@435 | 1542 | } |
duke@435 | 1543 | |
duke@435 | 1544 | |
duke@435 | 1545 | void InterpreterMacroAssembler::verify_oop(Register reg, TosState state) { |
duke@435 | 1546 | if (state == atos) { |
duke@435 | 1547 | MacroAssembler::verify_oop(reg); |
duke@435 | 1548 | } |
duke@435 | 1549 | } |
duke@435 | 1550 | |
duke@435 | 1551 | void InterpreterMacroAssembler::verify_FPU(int stack_depth, TosState state) { |
duke@435 | 1552 | } |
duke@435 | 1553 | |
duke@435 | 1554 | |
duke@435 | 1555 | void InterpreterMacroAssembler::notify_method_entry() { |
duke@435 | 1556 | // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to |
duke@435 | 1557 | // track stack depth. If it is possible to enter interp_only_mode we add |
duke@435 | 1558 | // the code to check if the event should be sent. |
duke@435 | 1559 | if (JvmtiExport::can_post_interpreter_events()) { |
duke@435 | 1560 | Label L; |
duke@435 | 1561 | movl(rdx, Address(r15_thread, JavaThread::interp_only_mode_offset())); |
duke@435 | 1562 | testl(rdx, rdx); |
duke@435 | 1563 | jcc(Assembler::zero, L); |
duke@435 | 1564 | call_VM(noreg, CAST_FROM_FN_PTR(address, |
duke@435 | 1565 | InterpreterRuntime::post_method_entry)); |
duke@435 | 1566 | bind(L); |
duke@435 | 1567 | } |
duke@435 | 1568 | |
duke@435 | 1569 | { |
duke@435 | 1570 | SkipIfEqual skip(this, &DTraceMethodProbes, false); |
duke@435 | 1571 | get_method(c_rarg1); |
duke@435 | 1572 | call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), |
duke@435 | 1573 | r15_thread, c_rarg1); |
duke@435 | 1574 | } |
duke@435 | 1575 | } |
duke@435 | 1576 | |
duke@435 | 1577 | |
duke@435 | 1578 | void InterpreterMacroAssembler::notify_method_exit( |
duke@435 | 1579 | TosState state, NotifyMethodExitMode mode) { |
duke@435 | 1580 | // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to |
duke@435 | 1581 | // track stack depth. If it is possible to enter interp_only_mode we add |
duke@435 | 1582 | // the code to check if the event should be sent. |
duke@435 | 1583 | if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events()) { |
duke@435 | 1584 | Label L; |
duke@435 | 1585 | // Note: frame::interpreter_frame_result has a dependency on how the |
duke@435 | 1586 | // method result is saved across the call to post_method_exit. If this |
duke@435 | 1587 | // is changed then the interpreter_frame_result implementation will |
duke@435 | 1588 | // need to be updated too. |
duke@435 | 1589 | push(state); |
duke@435 | 1590 | movl(rdx, Address(r15_thread, JavaThread::interp_only_mode_offset())); |
duke@435 | 1591 | testl(rdx, rdx); |
duke@435 | 1592 | jcc(Assembler::zero, L); |
duke@435 | 1593 | call_VM(noreg, |
duke@435 | 1594 | CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit)); |
duke@435 | 1595 | bind(L); |
duke@435 | 1596 | pop(state); |
duke@435 | 1597 | } |
duke@435 | 1598 | |
duke@435 | 1599 | { |
duke@435 | 1600 | SkipIfEqual skip(this, &DTraceMethodProbes, false); |
duke@435 | 1601 | push(state); |
duke@435 | 1602 | get_method(c_rarg1); |
duke@435 | 1603 | call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), |
duke@435 | 1604 | r15_thread, c_rarg1); |
duke@435 | 1605 | pop(state); |
duke@435 | 1606 | } |
duke@435 | 1607 | } |