< prev index next >

src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp

Print this page

2183 
2184       // Hmm should this move to the slow path code area???
2185 
2186       // Test if the oopMark is an obvious stack pointer, i.e.,
2187       //  1) (mark & 3) == 0, and
2188       //  2) rsp <= mark < mark + os::pagesize()
2189       // These 3 tests can be done by evaluating the following
2190       // expression: ((mark - rsp) & (3 - os::vm_page_size())),
2191       // assuming both stack pointer and pagesize have their
2192       // least significant 2 bits clear.
2193       // NOTE: the oopMark is in swap_reg %rax as the result of cmpxchg
2194 
2195       __ subptr(swap_reg, rsp);
2196       __ andptr(swap_reg, 3 - (int)os::vm_page_size());
2197 
2198       // Save the test result, for recursive case, the result is zero
2199       __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
2200       __ jcc(Assembler::notEqual, slow_path_lock);
2201     } else {
2202       assert(LockingMode == LM_LIGHTWEIGHT, "must be");
2203       __ lightweight_lock(obj_reg, swap_reg, r15_thread, rscratch1, slow_path_lock);
2204     }
2205     __ bind(count_mon);
2206     __ inc_held_monitor_count();
2207 
2208     // Slow path will re-enter here
2209     __ bind(lock_done);
2210   }
2211 
2212   // Finally just about ready to make the JNI call
2213 
2214   // get JNIEnv* which is first argument to native
2215   __ lea(c_rarg0, Address(r15_thread, in_bytes(JavaThread::jni_environment_offset())));
2216 
2217   // Now set thread in native
2218   __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native);
2219 
2220   __ call(RuntimeAddress(native_func));
2221 
2222   // Verify or restore cpu control state after JNI call
2223   __ restore_cpu_control_state_after_jni(rscratch1);

2183 
2184       // Hmm should this move to the slow path code area???
2185 
2186       // Test if the oopMark is an obvious stack pointer, i.e.,
2187       //  1) (mark & 3) == 0, and
2188       //  2) rsp <= mark < mark + os::pagesize()
2189       // These 3 tests can be done by evaluating the following
2190       // expression: ((mark - rsp) & (3 - os::vm_page_size())),
2191       // assuming both stack pointer and pagesize have their
2192       // least significant 2 bits clear.
2193       // NOTE: the oopMark is in swap_reg %rax as the result of cmpxchg
2194 
2195       __ subptr(swap_reg, rsp);
2196       __ andptr(swap_reg, 3 - (int)os::vm_page_size());
2197 
2198       // Save the test result, for recursive case, the result is zero
2199       __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
2200       __ jcc(Assembler::notEqual, slow_path_lock);
2201     } else {
2202       assert(LockingMode == LM_LIGHTWEIGHT, "must be");
2203       __ lightweight_lock(lock_reg, obj_reg, swap_reg, r15_thread, rscratch1, slow_path_lock);
2204     }
2205     __ bind(count_mon);
2206     __ inc_held_monitor_count();
2207 
2208     // Slow path will re-enter here
2209     __ bind(lock_done);
2210   }
2211 
2212   // Finally just about ready to make the JNI call
2213 
2214   // get JNIEnv* which is first argument to native
2215   __ lea(c_rarg0, Address(r15_thread, in_bytes(JavaThread::jni_environment_offset())));
2216 
2217   // Now set thread in native
2218   __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native);
2219 
2220   __ call(RuntimeAddress(native_func));
2221 
2222   // Verify or restore cpu control state after JNI call
2223   __ restore_cpu_control_state_after_jni(rscratch1);
< prev index next >