src/cpu/x86/vm/stubGenerator_x86_64.cpp

Print this page




 455     {
 456       Label L;
 457       __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL);
 458       __ jcc(Assembler::notEqual, L);
 459       __ stop("StubRoutines::forward exception: no pending exception (1)");
 460       __ bind(L);
 461     }
 462 #endif
 463 
 464     // compute exception handler into rbx
 465     __ movptr(c_rarg0, Address(rsp, 0));
 466     BLOCK_COMMENT("call exception_handler_for_return_address");
 467     __ call_VM_leaf(CAST_FROM_FN_PTR(address,
 468                          SharedRuntime::exception_handler_for_return_address),
 469                     c_rarg0);
 470     __ mov(rbx, rax);
 471 
 472     // setup rax & rdx, remove return address & clear pending exception
 473     __ pop(rdx);
 474     __ movptr(rax, Address(r15_thread, Thread::pending_exception_offset()));
 475     __ movptr(Address(r15_thread, Thread::pending_exception_offset()), (int)NULL_WORD);
 476 
 477 #ifdef ASSERT
 478     // make sure exception is set
 479     {
 480       Label L;
 481       __ testptr(rax, rax);
 482       __ jcc(Assembler::notEqual, L);
 483       __ stop("StubRoutines::forward exception: no pending exception (2)");
 484       __ bind(L);
 485     }
 486 #endif
 487 
 488     // continue at exception handler (return address removed)
 489     // rax: exception
 490     // rbx: exception handler
 491     // rdx: throwing pc
 492     __ verify_oop(rax);
 493     __ jmp(rbx);
 494 
 495     return start;


 937     __ push(c_rarg3);
 938 
 939     enum {
 940            // After previous pushes.
 941            oop_to_verify = 6 * wordSize,
 942            saved_rax     = 7 * wordSize,
 943 
 944            // Before the call to MacroAssembler::debug(), see below.
 945            return_addr   = 16 * wordSize,
 946            error_msg     = 17 * wordSize
 947     };
 948 
 949     // get object
 950     __ movptr(rax, Address(rsp, oop_to_verify));
 951 
 952     // make sure object is 'reasonable'
 953     __ testptr(rax, rax);
 954     __ jcc(Assembler::zero, exit); // if obj is NULL it is OK
 955     // Check if the oop is in the right area of memory
 956     __ movptr(c_rarg2, rax);
 957     __ movptr(c_rarg3, (int64_t) Universe::verify_oop_mask());
 958     __ andptr(c_rarg2, c_rarg3);
 959     __ movptr(c_rarg3, (int64_t) Universe::verify_oop_bits());
 960     __ cmpptr(c_rarg2, c_rarg3);
 961     __ jcc(Assembler::notZero, error);
 962 
 963     // set r12 to heapbase for load_klass()
 964     __ reinit_heapbase();
 965 
 966     // make sure klass is 'reasonable'
 967     __ load_klass(rax, rax);  // get klass
 968     __ testptr(rax, rax);
 969     __ jcc(Assembler::zero, error); // if klass is NULL it is broken
 970     // Check if the klass is in the right area of memory
 971     __ mov(c_rarg2, rax);
 972     __ movptr(c_rarg3, (int64_t) Universe::verify_klass_mask());
 973     __ andptr(c_rarg2, c_rarg3);
 974     __ movptr(c_rarg3, (int64_t) Universe::verify_klass_bits());
 975     __ cmpptr(c_rarg2, c_rarg3);
 976     __ jcc(Assembler::notZero, error);
 977 
 978     // make sure klass' klass is 'reasonable'
 979     __ load_klass(rax, rax);
 980     __ testptr(rax, rax);
 981     __ jcc(Assembler::zero, error); // if klass' klass is NULL it is broken
 982     // Check if the klass' klass is in the right area of memory
 983     __ movptr(c_rarg3, (int64_t) Universe::verify_klass_mask());
 984     __ andptr(rax, c_rarg3);
 985     __ movptr(c_rarg3, (int64_t) Universe::verify_klass_bits());
 986     __ cmpptr(rax, c_rarg3);
 987     __ jcc(Assembler::notZero, error);
 988 
 989     // return if everything seems ok
 990     __ bind(exit);
 991     __ movptr(rax, Address(rsp, saved_rax));     // get saved rax back
 992     __ pop(c_rarg3);                             // restore c_rarg3
 993     __ pop(c_rarg2);                             // restore c_rarg2
 994     __ pop(r12);                                 // restore r12
 995     __ popf();                                   // restore flags
 996     __ ret(3 * wordSize);                        // pop caller saved stuff
 997 
 998     // handle errors
 999     __ bind(error);
1000     __ movptr(rax, Address(rsp, saved_rax));     // get saved rax back
1001     __ pop(c_rarg3);                             // get saved c_rarg3 back
1002     __ pop(c_rarg2);                             // get saved c_rarg2 back
1003     __ pop(r12);                                 // get saved r12 back
1004     __ popf();                                   // get saved flags off stack --
1005                                                  // will be ignored




 455     {
 456       Label L;
 457       __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL);
 458       __ jcc(Assembler::notEqual, L);
 459       __ stop("StubRoutines::forward exception: no pending exception (1)");
 460       __ bind(L);
 461     }
 462 #endif
 463 
 464     // compute exception handler into rbx
 465     __ movptr(c_rarg0, Address(rsp, 0));
 466     BLOCK_COMMENT("call exception_handler_for_return_address");
 467     __ call_VM_leaf(CAST_FROM_FN_PTR(address,
 468                          SharedRuntime::exception_handler_for_return_address),
 469                     c_rarg0);
 470     __ mov(rbx, rax);
 471 
 472     // setup rax & rdx, remove return address & clear pending exception
 473     __ pop(rdx);
 474     __ movptr(rax, Address(r15_thread, Thread::pending_exception_offset()));
 475     __ movptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
 476 
 477 #ifdef ASSERT
 478     // make sure exception is set
 479     {
 480       Label L;
 481       __ testptr(rax, rax);
 482       __ jcc(Assembler::notEqual, L);
 483       __ stop("StubRoutines::forward exception: no pending exception (2)");
 484       __ bind(L);
 485     }
 486 #endif
 487 
 488     // continue at exception handler (return address removed)
 489     // rax: exception
 490     // rbx: exception handler
 491     // rdx: throwing pc
 492     __ verify_oop(rax);
 493     __ jmp(rbx);
 494 
 495     return start;


 937     __ push(c_rarg3);
 938 
 939     enum {
 940            // After previous pushes.
 941            oop_to_verify = 6 * wordSize,
 942            saved_rax     = 7 * wordSize,
 943 
 944            // Before the call to MacroAssembler::debug(), see below.
 945            return_addr   = 16 * wordSize,
 946            error_msg     = 17 * wordSize
 947     };
 948 
 949     // get object
 950     __ movptr(rax, Address(rsp, oop_to_verify));
 951 
 952     // make sure object is 'reasonable'
 953     __ testptr(rax, rax);
 954     __ jcc(Assembler::zero, exit); // if obj is NULL it is OK
 955     // Check if the oop is in the right area of memory
 956     __ movptr(c_rarg2, rax);
 957     __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_mask());
 958     __ andptr(c_rarg2, c_rarg3);
 959     __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_bits());
 960     __ cmpptr(c_rarg2, c_rarg3);
 961     __ jcc(Assembler::notZero, error);
 962 
 963     // set r12 to heapbase for load_klass()
 964     __ reinit_heapbase();
 965 
 966     // make sure klass is 'reasonable'
 967     __ load_klass(rax, rax);  // get klass
 968     __ testptr(rax, rax);
 969     __ jcc(Assembler::zero, error); // if klass is NULL it is broken
 970     // Check if the klass is in the right area of memory
 971     __ mov(c_rarg2, rax);
 972     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask());
 973     __ andptr(c_rarg2, c_rarg3);
 974     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits());
 975     __ cmpptr(c_rarg2, c_rarg3);
 976     __ jcc(Assembler::notZero, error);
 977 
 978     // make sure klass' klass is 'reasonable'
 979     __ load_klass(rax, rax);
 980     __ testptr(rax, rax);
 981     __ jcc(Assembler::zero, error); // if klass' klass is NULL it is broken
 982     // Check if the klass' klass is in the right area of memory
 983     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask());
 984     __ andptr(rax, c_rarg3);
 985     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits());
 986     __ cmpptr(rax, c_rarg3);
 987     __ jcc(Assembler::notZero, error);
 988 
 989     // return if everything seems ok
 990     __ bind(exit);
 991     __ movptr(rax, Address(rsp, saved_rax));     // get saved rax back
 992     __ pop(c_rarg3);                             // restore c_rarg3
 993     __ pop(c_rarg2);                             // restore c_rarg2
 994     __ pop(r12);                                 // restore r12
 995     __ popf();                                   // restore flags
 996     __ ret(3 * wordSize);                        // pop caller saved stuff
 997 
 998     // handle errors
 999     __ bind(error);
1000     __ movptr(rax, Address(rsp, saved_rax));     // get saved rax back
1001     __ pop(c_rarg3);                             // get saved c_rarg3 back
1002     __ pop(c_rarg2);                             // get saved c_rarg2 back
1003     __ pop(r12);                                 // get saved r12 back
1004     __ popf();                                   // get saved flags off stack --
1005                                                  // will be ignored