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