340 } 341 set(os::get_memory_serialize_page(), tmp1); 342 st(G0, tmp1, tmp2); 343 } 344 345 346 347 void MacroAssembler::enter() { 348 Unimplemented(); 349 } 350 351 void MacroAssembler::leave() { 352 Unimplemented(); 353 } 354 355 // Calls to C land 356 357 #ifdef ASSERT 358 // a hook for debugging 359 static Thread* reinitialize_thread() { 360 return ThreadLocalStorage::thread(); 361 } 362 #else 363 #define reinitialize_thread ThreadLocalStorage::thread 364 #endif 365 366 #ifdef ASSERT 367 address last_get_thread = NULL; 368 #endif 369 370 // call this when G2_thread is not known to be valid 371 void MacroAssembler::get_thread() { 372 save_frame(0); // to avoid clobbering O0 373 mov(G1, L0); // avoid clobbering G1 374 mov(G5_method, L1); // avoid clobbering G5 375 mov(G3, L2); // avoid clobbering G3 also 376 mov(G4, L5); // avoid clobbering G4 377 #ifdef ASSERT 378 AddressLiteral last_get_thread_addrlit(&last_get_thread); 379 set(last_get_thread_addrlit, L3); 380 rdpc(L4); 381 inc(L4, 3 * BytesPerInstWord); // skip rdpc + inc + st_ptr to point L4 at call st_ptr(L4, L3, 0); 382 #endif 383 call(CAST_FROM_FN_PTR(address, reinitialize_thread), relocInfo::runtime_call_type); 384 delayed()->nop(); 385 mov(L0, G1); 386 mov(L1, G5_method); 387 mov(L2, G3); 388 mov(L5, G4); 389 restore(O0, 0, G2_thread); 390 } 391 392 static Thread* verify_thread_subroutine(Thread* gthread_value) { 393 Thread* correct_value = ThreadLocalStorage::thread(); 394 guarantee(gthread_value == correct_value, "G2_thread value must be the thread"); 395 return correct_value; 396 } 397 398 void MacroAssembler::verify_thread() { 399 if (VerifyThread) { 400 // NOTE: this chops off the heads of the 64-bit O registers. 401 #ifdef CC_INTERP 402 save_frame(0); 403 #else 404 // make sure G2_thread contains the right value 405 save_frame_and_mov(0, Lmethod, Lmethod); // to avoid clobbering O0 (and propagate Lmethod for -Xprof) 406 mov(G1, L1); // avoid clobbering G1 407 // G2 saved below 408 mov(G3, L3); // avoid clobbering G3 409 mov(G4, L4); // avoid clobbering G4 410 mov(G5_method, L5); // avoid clobbering G5_method 411 #endif /* CC_INTERP */ 412 #if defined(COMPILER2) && !defined(_LP64) 413 // Save & restore possible 64-bit Long arguments in G-regs | 340 } 341 set(os::get_memory_serialize_page(), tmp1); 342 st(G0, tmp1, tmp2); 343 } 344 345 346 347 void MacroAssembler::enter() { 348 Unimplemented(); 349 } 350 351 void MacroAssembler::leave() { 352 Unimplemented(); 353 } 354 355 // Calls to C land 356 357 #ifdef ASSERT 358 // a hook for debugging 359 static Thread* reinitialize_thread() { 360 return Thread::current(); 361 } 362 #else 363 #define reinitialize_thread Thread::current 364 #endif 365 366 #ifdef ASSERT 367 address last_get_thread = NULL; 368 #endif 369 370 // call this when G2_thread is not known to be valid 371 void MacroAssembler::get_thread() { 372 save_frame(0); // to avoid clobbering O0 373 mov(G1, L0); // avoid clobbering G1 374 mov(G5_method, L1); // avoid clobbering G5 375 mov(G3, L2); // avoid clobbering G3 also 376 mov(G4, L5); // avoid clobbering G4 377 #ifdef ASSERT 378 AddressLiteral last_get_thread_addrlit(&last_get_thread); 379 set(last_get_thread_addrlit, L3); 380 rdpc(L4); 381 inc(L4, 3 * BytesPerInstWord); // skip rdpc + inc + st_ptr to point L4 at call st_ptr(L4, L3, 0); 382 #endif 383 call(CAST_FROM_FN_PTR(address, reinitialize_thread), relocInfo::runtime_call_type); 384 delayed()->nop(); 385 mov(L0, G1); 386 mov(L1, G5_method); 387 mov(L2, G3); 388 mov(L5, G4); 389 restore(O0, 0, G2_thread); 390 } 391 392 static Thread* verify_thread_subroutine(Thread* gthread_value) { 393 Thread* correct_value = Thread::current(); 394 guarantee(gthread_value == correct_value, "G2_thread value must be the thread"); 395 return correct_value; 396 } 397 398 void MacroAssembler::verify_thread() { 399 if (VerifyThread) { 400 // NOTE: this chops off the heads of the 64-bit O registers. 401 #ifdef CC_INTERP 402 save_frame(0); 403 #else 404 // make sure G2_thread contains the right value 405 save_frame_and_mov(0, Lmethod, Lmethod); // to avoid clobbering O0 (and propagate Lmethod for -Xprof) 406 mov(G1, L1); // avoid clobbering G1 407 // G2 saved below 408 mov(G3, L3); // avoid clobbering G3 409 mov(G4, L4); // avoid clobbering G4 410 mov(G5_method, L5); // avoid clobbering G5_method 411 #endif /* CC_INTERP */ 412 #if defined(COMPILER2) && !defined(_LP64) 413 // Save & restore possible 64-bit Long arguments in G-regs |