< prev index next >

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp

G1BarrierSet_merge

1183   void restore_arg_regs() {                                                                                                          
1184     const Register saved_rdi = r9;                                                                                                   
1185     const Register saved_rsi = r10;                                                                                                  
1186 #ifdef _WIN64                                                                                                                        
1187     __ movptr(rdi, saved_rdi);                                                                                                       
1188     __ movptr(rsi, saved_rsi);                                                                                                       
1189 #endif                                                                                                                               
1190   }                                                                                                                                  
1191 
1192   // Generate code for an array write pre barrier                                                                                    
1193   //                                                                                                                                 
1194   //     addr    -  starting address                                                                                                 
1195   //     count   -  element count                                                                                                    
1196   //     tmp     - scratch register                                                                                                  
1197   //                                                                                                                                 
1198   //     Destroy no registers!                                                                                                       
1199   //                                                                                                                                 
1200   void  gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {                                    
1201     BarrierSet* bs = Universe::heap()->barrier_set();                                                                                
1202     switch (bs->kind()) {                                                                                                            
1203       case BarrierSet::G1SATBCTLogging:                                                                                              
1204         // With G1, don't generate the call if we statically know that the target in uninitialized                                   
1205         if (!dest_uninitialized) {                                                                                                   
1206           Label filtered;                                                                                                            
1207           Address in_progress(r15_thread, in_bytes(JavaThread::satb_mark_queue_offset() +                                            
1208                                                    SATBMarkQueue::byte_offset_of_active()));                                         
1209           // Is marking active?                                                                                                      
1210           if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {                                                                
1211             __ cmpl(in_progress, 0);                                                                                                 
1212           } else {                                                                                                                   
1213             assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");                                              
1214             __ cmpb(in_progress, 0);                                                                                                 
1215           }                                                                                                                          
1216           __ jcc(Assembler::equal, filtered);                                                                                        
1217 
1218            __ pusha();                      // push registers                                                                        
1219            if (count == c_rarg0) {                                                                                                   
1220              if (addr == c_rarg1) {                                                                                                  
1221                // exactly backwards!!                                                                                                
1222                __ xchgptr(c_rarg1, c_rarg0);                                                                                         

1183   void restore_arg_regs() {
1184     const Register saved_rdi = r9;
1185     const Register saved_rsi = r10;
1186 #ifdef _WIN64
1187     __ movptr(rdi, saved_rdi);
1188     __ movptr(rsi, saved_rsi);
1189 #endif
1190   }
1191 
1192   // Generate code for an array write pre barrier
1193   //
1194   //     addr    -  starting address
1195   //     count   -  element count
1196   //     tmp     - scratch register
1197   //
1198   //     Destroy no registers!
1199   //
1200   void  gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
1201     BarrierSet* bs = Universe::heap()->barrier_set();
1202     switch (bs->kind()) {
1203       case BarrierSet::G1BarrierSet:
1204         // With G1, don't generate the call if we statically know that the target in uninitialized
1205         if (!dest_uninitialized) {
1206           Label filtered;
1207           Address in_progress(r15_thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1208                                                    SATBMarkQueue::byte_offset_of_active()));
1209           // Is marking active?
1210           if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
1211             __ cmpl(in_progress, 0);
1212           } else {
1213             assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
1214             __ cmpb(in_progress, 0);
1215           }
1216           __ jcc(Assembler::equal, filtered);
1217 
1218            __ pusha();                      // push registers
1219            if (count == c_rarg0) {
1220              if (addr == c_rarg1) {
1221                // exactly backwards!!
1222                __ xchgptr(c_rarg1, c_rarg0);

1239       default:                                                                                                                       
1240         ShouldNotReachHere();                                                                                                        
1241 
1242     }                                                                                                                                
1243   }                                                                                                                                  
1244 
1245   //                                                                                                                                 
1246   // Generate code for an array write post barrier                                                                                   
1247   //                                                                                                                                 
1248   //  Input:                                                                                                                         
1249   //     start    - register containing starting address of destination array                                                        
1250   //     count    - elements count                                                                                                   
1251   //     scratch  - scratch register                                                                                                 
1252   //                                                                                                                                 
1253   //  The input registers are overwritten.                                                                                           
1254   //                                                                                                                                 
1255   void  gen_write_ref_array_post_barrier(Register start, Register count, Register scratch) {                                         
1256     assert_different_registers(start, count, scratch);                                                                               
1257     BarrierSet* bs = Universe::heap()->barrier_set();                                                                                
1258     switch (bs->kind()) {                                                                                                            
1259       case BarrierSet::G1SATBCTLogging:                                                                                              
1260         {                                                                                                                            
1261           __ pusha();             // push registers (overkill)                                                                       
1262           if (c_rarg0 == count) { // On win64 c_rarg0 == rcx                                                                         
1263             assert_different_registers(c_rarg1, start);                                                                              
1264             __ mov(c_rarg1, count);                                                                                                  
1265             __ mov(c_rarg0, start);                                                                                                  
1266           } else {                                                                                                                   
1267             assert_different_registers(c_rarg0, count);                                                                              
1268             __ mov(c_rarg0, start);                                                                                                  
1269             __ mov(c_rarg1, count);                                                                                                  
1270           }                                                                                                                          
1271           __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), 2);                                    
1272           __ popa();                                                                                                                 
1273         }                                                                                                                            
1274         break;                                                                                                                       
1275       case BarrierSet::CardTableModRef:                                                                                              
1276         {                                                                                                                            
1277           Label L_loop, L_done;                                                                                                      
1278           const Register end = count;                                                                                                

1239       default:
1240         ShouldNotReachHere();
1241 
1242     }
1243   }
1244 
1245   //
1246   // Generate code for an array write post barrier
1247   //
1248   //  Input:
1249   //     start    - register containing starting address of destination array
1250   //     count    - elements count
1251   //     scratch  - scratch register
1252   //
1253   //  The input registers are overwritten.
1254   //
1255   void  gen_write_ref_array_post_barrier(Register start, Register count, Register scratch) {
1256     assert_different_registers(start, count, scratch);
1257     BarrierSet* bs = Universe::heap()->barrier_set();
1258     switch (bs->kind()) {
1259       case BarrierSet::G1BarrierSet:
1260         {
1261           __ pusha();             // push registers (overkill)
1262           if (c_rarg0 == count) { // On win64 c_rarg0 == rcx
1263             assert_different_registers(c_rarg1, start);
1264             __ mov(c_rarg1, count);
1265             __ mov(c_rarg0, start);
1266           } else {
1267             assert_different_registers(c_rarg0, count);
1268             __ mov(c_rarg0, start);
1269             __ mov(c_rarg1, count);
1270           }
1271           __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), 2);
1272           __ popa();
1273         }
1274         break;
1275       case BarrierSet::CardTableModRef:
1276         {
1277           Label L_loop, L_done;
1278           const Register end = count;
< prev index next >