< prev index next >

src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp

Print this page
rev 57113 : 8230765: Implement nmethod barrier for x86_32 platforms
Reviewed-by: rkennke, eosterlund


 958 
 959   {
 960 
 961     Label missed;
 962     __ movptr(temp, Address(receiver, oopDesc::klass_offset_in_bytes()));
 963     __ cmpptr(temp, Address(holder, CompiledICHolder::holder_klass_offset()));
 964     __ movptr(rbx, Address(holder, CompiledICHolder::holder_metadata_offset()));
 965     __ jcc(Assembler::notEqual, missed);
 966     // Method might have been compiled since the call site was patched to
 967     // interpreted if that is the case treat it as a miss so we can get
 968     // the call site corrected.
 969     __ cmpptr(Address(rbx, in_bytes(Method::code_offset())), (int32_t)NULL_WORD);
 970     __ jcc(Assembler::equal, skip_fixup);
 971 
 972     __ bind(missed);
 973     __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
 974   }
 975 
 976   address c2i_entry = __ pc();
 977 



 978   gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
 979 
 980   __ flush();
 981   return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry);
 982 }
 983 
 984 int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
 985                                          VMRegPair *regs,
 986                                          VMRegPair *regs2,
 987                                          int total_args_passed) {
 988   assert(regs2 == NULL, "not needed on x86");
 989 // We return the amount of VMRegImpl stack slots we need to reserve for all
 990 // the arguments NOT counting out_preserve_stack_slots.
 991 
 992   uint    stack = 0;        // All arguments on stack
 993 
 994   for( int i = 0; i < total_args_passed; i++) {
 995     // From the type and the argument number (count) compute the location
 996     switch( sig_bt[i] ) {
 997     case T_BOOLEAN:


1869 #endif // COMPILER1
1870 
1871   // The instruction at the verified entry point must be 5 bytes or longer
1872   // because it can be patched on the fly by make_non_entrant. The stack bang
1873   // instruction fits that requirement.
1874 
1875   // Generate stack overflow check
1876 
1877   if (UseStackBanging) {
1878     __ bang_stack_with_offset((int)JavaThread::stack_shadow_zone_size());
1879   } else {
1880     // need a 5 byte instruction to allow MT safe patching to non-entrant
1881     __ fat_nop();
1882   }
1883 
1884   // Generate a new frame for the wrapper.
1885   __ enter();
1886   // -2 because return address is already present and so is saved rbp
1887   __ subptr(rsp, stack_size - 2*wordSize);
1888 




1889   // Frame is now completed as far as size and linkage.
1890   int frame_complete = ((intptr_t)__ pc()) - start;
1891 
1892   if (UseRTMLocking) {
1893     // Abort RTM transaction before calling JNI
1894     // because critical section will be large and will be
1895     // aborted anyway. Also nmethod could be deoptimized.
1896     __ xabort(0);
1897   }
1898 
1899   // Calculate the difference between rsp and rbp,. We need to know it
1900   // after the native call because on windows Java Natives will pop
1901   // the arguments and it is painful to do rsp relative addressing
1902   // in a platform independent way. So after the call we switch to
1903   // rbp, relative addressing.
1904 
1905   int fp_adjustment = stack_size - 2*wordSize;
1906 
1907 #ifdef COMPILER2
1908   // C2 may leave the stack dirty if not in SSE2+ mode




 958 
 959   {
 960 
 961     Label missed;
 962     __ movptr(temp, Address(receiver, oopDesc::klass_offset_in_bytes()));
 963     __ cmpptr(temp, Address(holder, CompiledICHolder::holder_klass_offset()));
 964     __ movptr(rbx, Address(holder, CompiledICHolder::holder_metadata_offset()));
 965     __ jcc(Assembler::notEqual, missed);
 966     // Method might have been compiled since the call site was patched to
 967     // interpreted if that is the case treat it as a miss so we can get
 968     // the call site corrected.
 969     __ cmpptr(Address(rbx, in_bytes(Method::code_offset())), (int32_t)NULL_WORD);
 970     __ jcc(Assembler::equal, skip_fixup);
 971 
 972     __ bind(missed);
 973     __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
 974   }
 975 
 976   address c2i_entry = __ pc();
 977 
 978   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
 979   bs->c2i_entry_barrier(masm);
 980 
 981   gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
 982 
 983   __ flush();
 984   return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry);
 985 }
 986 
 987 int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
 988                                          VMRegPair *regs,
 989                                          VMRegPair *regs2,
 990                                          int total_args_passed) {
 991   assert(regs2 == NULL, "not needed on x86");
 992 // We return the amount of VMRegImpl stack slots we need to reserve for all
 993 // the arguments NOT counting out_preserve_stack_slots.
 994 
 995   uint    stack = 0;        // All arguments on stack
 996 
 997   for( int i = 0; i < total_args_passed; i++) {
 998     // From the type and the argument number (count) compute the location
 999     switch( sig_bt[i] ) {
1000     case T_BOOLEAN:


1872 #endif // COMPILER1
1873 
1874   // The instruction at the verified entry point must be 5 bytes or longer
1875   // because it can be patched on the fly by make_non_entrant. The stack bang
1876   // instruction fits that requirement.
1877 
1878   // Generate stack overflow check
1879 
1880   if (UseStackBanging) {
1881     __ bang_stack_with_offset((int)JavaThread::stack_shadow_zone_size());
1882   } else {
1883     // need a 5 byte instruction to allow MT safe patching to non-entrant
1884     __ fat_nop();
1885   }
1886 
1887   // Generate a new frame for the wrapper.
1888   __ enter();
1889   // -2 because return address is already present and so is saved rbp
1890   __ subptr(rsp, stack_size - 2*wordSize);
1891 
1892 
1893   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
1894   bs->nmethod_entry_barrier(masm);
1895 
1896   // Frame is now completed as far as size and linkage.
1897   int frame_complete = ((intptr_t)__ pc()) - start;
1898 
1899   if (UseRTMLocking) {
1900     // Abort RTM transaction before calling JNI
1901     // because critical section will be large and will be
1902     // aborted anyway. Also nmethod could be deoptimized.
1903     __ xabort(0);
1904   }
1905 
1906   // Calculate the difference between rsp and rbp,. We need to know it
1907   // after the native call because on windows Java Natives will pop
1908   // the arguments and it is painful to do rsp relative addressing
1909   // in a platform independent way. So after the call we switch to
1910   // rbp, relative addressing.
1911 
1912   int fp_adjustment = stack_size - 2*wordSize;
1913 
1914 #ifdef COMPILER2
1915   // C2 may leave the stack dirty if not in SSE2+ mode


< prev index next >