2151
2152 // Hmm should this move to the slow path code area???
2153
2154 // Test if the oopMark is an obvious stack pointer, i.e.,
2155 // 1) (mark & 3) == 0, and
2156 // 2) rsp <= mark < mark + os::pagesize()
2157 // These 3 tests can be done by evaluating the following
2158 // expression: ((mark - rsp) & (3 - os::vm_page_size())),
2159 // assuming both stack pointer and pagesize have their
2160 // least significant 2 bits clear.
2161 // NOTE: the oopMark is in swap_reg %rax as the result of cmpxchg
2162
2163 __ subptr(swap_reg, rsp);
2164 __ andptr(swap_reg, 3 - (int)os::vm_page_size());
2165
2166 // Save the test result, for recursive case, the result is zero
2167 __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
2168 __ jcc(Assembler::notEqual, slow_path_lock);
2169 } else {
2170 assert(LockingMode == LM_LIGHTWEIGHT, "must be");
2171 __ lightweight_lock(obj_reg, swap_reg, r15_thread, rscratch1, slow_path_lock);
2172 }
2173 __ bind(count_mon);
2174 __ inc_held_monitor_count();
2175
2176 // Slow path will re-enter here
2177 __ bind(lock_done);
2178 }
2179
2180 // Finally just about ready to make the JNI call
2181
2182 // get JNIEnv* which is first argument to native
2183 __ lea(c_rarg0, Address(r15_thread, in_bytes(JavaThread::jni_environment_offset())));
2184
2185 // Now set thread in native
2186 __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native);
2187
2188 __ call(RuntimeAddress(native_func));
2189
2190 // Verify or restore cpu control state after JNI call
2191 __ restore_cpu_control_state_after_jni(rscratch1);
|
2151
2152 // Hmm should this move to the slow path code area???
2153
2154 // Test if the oopMark is an obvious stack pointer, i.e.,
2155 // 1) (mark & 3) == 0, and
2156 // 2) rsp <= mark < mark + os::pagesize()
2157 // These 3 tests can be done by evaluating the following
2158 // expression: ((mark - rsp) & (3 - os::vm_page_size())),
2159 // assuming both stack pointer and pagesize have their
2160 // least significant 2 bits clear.
2161 // NOTE: the oopMark is in swap_reg %rax as the result of cmpxchg
2162
2163 __ subptr(swap_reg, rsp);
2164 __ andptr(swap_reg, 3 - (int)os::vm_page_size());
2165
2166 // Save the test result, for recursive case, the result is zero
2167 __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
2168 __ jcc(Assembler::notEqual, slow_path_lock);
2169 } else {
2170 assert(LockingMode == LM_LIGHTWEIGHT, "must be");
2171 __ lightweight_lock(lock_reg, obj_reg, swap_reg, r15_thread, rscratch1, slow_path_lock);
2172 }
2173 __ bind(count_mon);
2174 __ inc_held_monitor_count();
2175
2176 // Slow path will re-enter here
2177 __ bind(lock_done);
2178 }
2179
2180 // Finally just about ready to make the JNI call
2181
2182 // get JNIEnv* which is first argument to native
2183 __ lea(c_rarg0, Address(r15_thread, in_bytes(JavaThread::jni_environment_offset())));
2184
2185 // Now set thread in native
2186 __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native);
2187
2188 __ call(RuntimeAddress(native_func));
2189
2190 // Verify or restore cpu control state after JNI call
2191 __ restore_cpu_control_state_after_jni(rscratch1);
|