< prev index next >

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

remove c1 runtime1 medium slowpath

3039   // if we don't know anything, just go through the generic arraycopy                                                                
3040   if (default_type == NULL) {                                                                                                        
3041     Label done;                                                                                                                      
3042     // save outgoing arguments on stack in case call to System.arraycopy is needed                                                   
3043     // HACK ALERT. This code used to push the parameters in a hardwired fashion                                                      
3044     // for interpreter calling conventions. Now we have to do it in new style conventions.                                           
3045     // For the moment until C1 gets the new register allocator I just force all the                                                  
3046     // args to the right place (except the register args) and then on the back side                                                  
3047     // reload the register args properly if we go slow path. Yuck                                                                    
3048 
3049     // These are proper for the calling convention                                                                                   
3050     store_parameter(length, 2);                                                                                                      
3051     store_parameter(dst_pos, 1);                                                                                                     
3052     store_parameter(dst, 0);                                                                                                         
3053 
3054     // these are just temporary placements until we need to reload                                                                   
3055     store_parameter(src_pos, 3);                                                                                                     
3056     store_parameter(src, 4);                                                                                                         
3057     NOT_LP64(assert(src == rcx && src_pos == rdx, "mismatch in calling convention");)                                                
3058 
3059     address C_entry = CAST_FROM_FN_PTR(address, Runtime1::arraycopy);                                                                
3060                                                                                                                                      
3061     address copyfunc_addr = StubRoutines::generic_arraycopy();                                                                       
                                                                                                                                     
3062 
3063     // pass arguments: may push as this is not a safepoint; SP must be fix at each safepoint                                         
3064 #ifdef _LP64                                                                                                                         
3065     // The arguments are in java calling convention so we can trivially shift them to C                                              
3066     // convention                                                                                                                    
3067     assert_different_registers(c_rarg0, j_rarg1, j_rarg2, j_rarg3, j_rarg4);                                                         
3068     __ mov(c_rarg0, j_rarg0);                                                                                                        
3069     assert_different_registers(c_rarg1, j_rarg2, j_rarg3, j_rarg4);                                                                  
3070     __ mov(c_rarg1, j_rarg1);                                                                                                        
3071     assert_different_registers(c_rarg2, j_rarg3, j_rarg4);                                                                           
3072     __ mov(c_rarg2, j_rarg2);                                                                                                        
3073     assert_different_registers(c_rarg3, j_rarg4);                                                                                    
3074     __ mov(c_rarg3, j_rarg3);                                                                                                        
3075 #ifdef _WIN64                                                                                                                        
3076     // Allocate abi space for args but be sure to keep stack aligned                                                                 
3077     __ subptr(rsp, 6*wordSize);                                                                                                      
3078     store_parameter(j_rarg4, 4);                                                                                                     
3079     if (copyfunc_addr == NULL) { // Use C version if stub was not generated                                                          
3080       __ call(RuntimeAddress(C_entry));                                                                                              
3081     } else {                                                                                                                         
3082 #ifndef PRODUCT                                                                                                                      
3083       if (PrintC1Statistics) {                                                                                                       
3084         __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));                                              
3085       }                                                                                                                              
3086 #endif                                                                                                                               
3087       __ call(RuntimeAddress(copyfunc_addr));                                                                                        
3088     }                                                                                                                                
                                                                                                                                     
                                                                                                                                     
3089     __ addptr(rsp, 6*wordSize);                                                                                                      
3090 #else                                                                                                                                
3091     __ mov(c_rarg4, j_rarg4);                                                                                                        
3092     if (copyfunc_addr == NULL) { // Use C version if stub was not generated                                                          
3093       __ call(RuntimeAddress(C_entry));                                                                                              
3094     } else {                                                                                                                         
3095 #ifndef PRODUCT                                                                                                                      
3096       if (PrintC1Statistics) {                                                                                                       
3097         __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));                                              
3098       }                                                                                                                              
3099 #endif                                                                                                                               
3100       __ call(RuntimeAddress(copyfunc_addr));                                                                                        
3101     }                                                                                                                                
                                                                                                                                     
                                                                                                                                     
3102 #endif // _WIN64                                                                                                                     
3103 #else                                                                                                                                
3104     __ push(length);                                                                                                                 
3105     __ push(dst_pos);                                                                                                                
3106     __ push(dst);                                                                                                                    
3107     __ push(src_pos);                                                                                                                
3108     __ push(src);                                                                                                                    
3109 
3110     if (copyfunc_addr == NULL) { // Use C version if stub was not generated                                                          
3111       __ call_VM_leaf(C_entry, 5); // removes pushed parameter from the stack                                                        
3112     } else {                                                                                                                         
3113 #ifndef PRODUCT                                                                                                                      
3114       if (PrintC1Statistics) {                                                                                                       
3115         __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));                                              
3116       }                                                                                                                              
3117 #endif                                                                                                                               
3118       __ call_VM_leaf(copyfunc_addr, 5); // removes pushed parameter from the stack                                                  
3119     }                                                                                                                                
                                                                                                                                     
                                                                                                                                     
3120 
3121 #endif // _LP64                                                                                                                      
3122 
3123     __ cmpl(rax, 0);                                                                                                                 
3124     __ jcc(Assembler::equal, *stub->continuation());                                                                                 
3125 
3126     if (copyfunc_addr != NULL) {                                                                                                     
3127       __ mov(tmp, rax);                                                                                                              
3128       __ xorl(tmp, -1);                                                                                                              
3129     }                                                                                                                                
3130 
3131     // Reload values from the stack so they are where the stub                                                                       
3132     // expects them.                                                                                                                 
3133     __ movptr   (dst,     Address(rsp, 0*BytesPerWord));                                                                             
3134     __ movptr   (dst_pos, Address(rsp, 1*BytesPerWord));                                                                             
3135     __ movptr   (length,  Address(rsp, 2*BytesPerWord));                                                                             
3136     __ movptr   (src_pos, Address(rsp, 3*BytesPerWord));                                                                             
3137     __ movptr   (src,     Address(rsp, 4*BytesPerWord));                                                                             
3138 
3139     if (copyfunc_addr != NULL) {                                                                                                     
3140       __ subl(length, tmp);                                                                                                          
3141       __ addl(src_pos, tmp);                                                                                                         
3142       __ addl(dst_pos, tmp);                                                                                                         
3143     }                                                                                                                                
3144     __ jmp(*stub->entry());                                                                                                          
3145 
3146     __ bind(*stub->continuation());                                                                                                  
3147     return;                                                                                                                          
3148   }                                                                                                                                  
3149 
3150   assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point");         
3151 
3152   int elem_size = type2aelembytes(basic_type);                                                                                       
3153   Address::ScaleFactor scale;                                                                                                        
3154 
3155   switch (elem_size) {                                                                                                               
3156     case 1 :                                                                                                                         
3157       scale = Address::times_1;                                                                                                      
3158       break;                                                                                                                         
3159     case 2 :                                                                                                                         
3160       scale = Address::times_2;                                                                                                      
3161       break;                                                                                                                         
3162     case 4 :                                                                                                                         

3039   // if we don't know anything, just go through the generic arraycopy
3040   if (default_type == NULL) {
3041     Label done;
3042     // save outgoing arguments on stack in case call to System.arraycopy is needed
3043     // HACK ALERT. This code used to push the parameters in a hardwired fashion
3044     // for interpreter calling conventions. Now we have to do it in new style conventions.
3045     // For the moment until C1 gets the new register allocator I just force all the
3046     // args to the right place (except the register args) and then on the back side
3047     // reload the register args properly if we go slow path. Yuck
3048 
3049     // These are proper for the calling convention
3050     store_parameter(length, 2);
3051     store_parameter(dst_pos, 1);
3052     store_parameter(dst, 0);
3053 
3054     // these are just temporary placements until we need to reload
3055     store_parameter(src_pos, 3);
3056     store_parameter(src, 4);
3057     NOT_LP64(assert(src == rcx && src_pos == rdx, "mismatch in calling convention");)
3058 


3059     address copyfunc_addr = StubRoutines::generic_arraycopy();
3060     assert(copyfunc_addr != NULL, "generic arraycopy stub required");
3061 
3062     // pass arguments: may push as this is not a safepoint; SP must be fix at each safepoint
3063 #ifdef _LP64
3064     // The arguments are in java calling convention so we can trivially shift them to C
3065     // convention
3066     assert_different_registers(c_rarg0, j_rarg1, j_rarg2, j_rarg3, j_rarg4);
3067     __ mov(c_rarg0, j_rarg0);
3068     assert_different_registers(c_rarg1, j_rarg2, j_rarg3, j_rarg4);
3069     __ mov(c_rarg1, j_rarg1);
3070     assert_different_registers(c_rarg2, j_rarg3, j_rarg4);
3071     __ mov(c_rarg2, j_rarg2);
3072     assert_different_registers(c_rarg3, j_rarg4);
3073     __ mov(c_rarg3, j_rarg3);
3074 #ifdef _WIN64
3075     // Allocate abi space for args but be sure to keep stack aligned
3076     __ subptr(rsp, 6*wordSize);
3077     store_parameter(j_rarg4, 4);



3078 #ifndef PRODUCT
3079     if (PrintC1Statistics) {
3080       __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));



3081     }
3082 #endif
3083     __ call(RuntimeAddress(copyfunc_addr));
3084     __ addptr(rsp, 6*wordSize);
3085 #else
3086     __ mov(c_rarg4, j_rarg4);



3087 #ifndef PRODUCT
3088     if (PrintC1Statistics) {
3089       __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));



3090     }
3091 #endif
3092     __ call(RuntimeAddress(copyfunc_addr));
3093 #endif // _WIN64
3094 #else
3095     __ push(length);
3096     __ push(dst_pos);
3097     __ push(dst);
3098     __ push(src_pos);
3099     __ push(src);
3100 



3101 #ifndef PRODUCT
3102     if (PrintC1Statistics) {
3103       __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));



3104     }
3105 #endif
3106     __ call_VM_leaf(copyfunc_addr, 5); // removes pushed parameter from the stack
3107 
3108 #endif // _LP64
3109 
3110     __ cmpl(rax, 0);
3111     __ jcc(Assembler::equal, *stub->continuation());
3112 
3113     __ mov(tmp, rax);
3114     __ xorl(tmp, -1);


3115 
3116     // Reload values from the stack so they are where the stub
3117     // expects them.
3118     __ movptr   (dst,     Address(rsp, 0*BytesPerWord));
3119     __ movptr   (dst_pos, Address(rsp, 1*BytesPerWord));
3120     __ movptr   (length,  Address(rsp, 2*BytesPerWord));
3121     __ movptr   (src_pos, Address(rsp, 3*BytesPerWord));
3122     __ movptr   (src,     Address(rsp, 4*BytesPerWord));
3123 
3124     __ subl(length, tmp);
3125     __ addl(src_pos, tmp);
3126     __ addl(dst_pos, tmp);


3127     __ jmp(*stub->entry());
3128 
3129     __ bind(*stub->continuation());
3130     return;
3131   }
3132 
3133   assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point");
3134 
3135   int elem_size = type2aelembytes(basic_type);
3136   Address::ScaleFactor scale;
3137 
3138   switch (elem_size) {
3139     case 1 :
3140       scale = Address::times_1;
3141       break;
3142     case 2 :
3143       scale = Address::times_2;
3144       break;
3145     case 4 :
< prev index next >