< prev index next >

src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp

remove c1 runtime1 medium slowpath

1877 
1878   __ branch_optimized(Assembler::bcondAlways, _unwind_handler_entry);                                                                
1879 }                                                                                                                                    
1880 
1881 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {                                                                            
1882   ciArrayKlass* default_type = op->expected_type();                                                                                  
1883   Register src = op->src()->as_register();                                                                                           
1884   Register dst = op->dst()->as_register();                                                                                           
1885   Register src_pos = op->src_pos()->as_register();                                                                                   
1886   Register dst_pos = op->dst_pos()->as_register();                                                                                   
1887   Register length  = op->length()->as_register();                                                                                    
1888   Register tmp = op->tmp()->as_register();                                                                                           
1889 
1890   CodeStub* stub = op->stub();                                                                                                       
1891   int flags = op->flags();                                                                                                           
1892   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;                              
1893   if (basic_type == T_ARRAY) basic_type = T_OBJECT;                                                                                  
1894 
1895   // If we don't know anything, just go through the generic arraycopy.                                                               
1896   if (default_type == NULL) {                                                                                                        
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
1897     Label done;                                                                                                                      
1898     // Save outgoing arguments in callee saved registers (C convention) in case                                                      
1899     // a call to System.arraycopy is needed.                                                                                         
1900     Register callee_saved_src     = Z_R10;                                                                                           
1901     Register callee_saved_src_pos = Z_R11;                                                                                           
1902     Register callee_saved_dst     = Z_R12;                                                                                           
1903     Register callee_saved_dst_pos = Z_R13;                                                                                           
1904     Register callee_saved_length  = Z_ARG5; // Z_ARG5 == Z_R6 is callee saved.                                                       
1905 
1906     __ lgr_if_needed(callee_saved_src, src);                                                                                         
1907     __ lgr_if_needed(callee_saved_src_pos, src_pos);                                                                                 
1908     __ lgr_if_needed(callee_saved_dst, dst);                                                                                         
1909     __ lgr_if_needed(callee_saved_dst_pos, dst_pos);                                                                                 
1910     __ lgr_if_needed(callee_saved_length, length);                                                                                   
1911 
1912     // C function requires 64 bit values.                                                                                            
1913     __ z_lgfr(src_pos, src_pos);                                                                                                     
1914     __ z_lgfr(dst_pos, dst_pos);                                                                                                     
1915     __ z_lgfr(length, length);                                                                                                       
1916 
1917     address C_entry = CAST_FROM_FN_PTR(address, Runtime1::arraycopy);                                                                
1918                                                                                                                                      
1919     address copyfunc_addr = StubRoutines::generic_arraycopy();                                                                       
1920                                                                                                                                      
1921     // Pass arguments: may push as this is not a safepoint; SP must be fix at each safepoint.                                        
1922 
1923     // The arguments are in the corresponding registers.                                                                             
1924     assert(Z_ARG1 == src,     "assumption");                                                                                         
1925     assert(Z_ARG2 == src_pos, "assumption");                                                                                         
1926     assert(Z_ARG3 == dst,     "assumption");                                                                                         
1927     assert(Z_ARG4 == dst_pos, "assumption");                                                                                         
1928     assert(Z_ARG5 == length,  "assumption");                                                                                         
1929     if (copyfunc_addr == NULL) { // Use C version if stub was not generated.                                                         
1930       emit_call_c(C_entry);                                                                                                          
1931     } else {                                                                                                                         
1932 #ifndef PRODUCT                                                                                                                      
1933       if (PrintC1Statistics) {                                                                                                       
1934         __ load_const_optimized(Z_R1_scratch, (address)&Runtime1::_generic_arraycopystub_cnt);                                       
1935         __ add2mem_32(Address(Z_R1_scratch), 1, Z_R0_scratch);                                                                       
1936       }                                                                                                                              
1937 #endif                                                                                                                               
1938       emit_call_c(copyfunc_addr);                                                                                                    
1939     }                                                                                                                                
                                                                                                                                     
                                                                                                                                     
1940     CHECK_BAILOUT();                                                                                                                 
1941 
1942     __ compare32_and_branch(Z_RET, (intptr_t)0, Assembler::bcondEqual, *stub->continuation());                                       
1943 
1944     if (copyfunc_addr != NULL) {                                                                                                     
1945       __ z_lgr(tmp, Z_RET);                                                                                                          
1946       __ z_xilf(tmp, -1);                                                                                                            
1947     }                                                                                                                                
1948 
1949     // Restore values from callee saved registers so they are where the stub                                                         
1950     // expects them.                                                                                                                 
1951     __ lgr_if_needed(src, callee_saved_src);                                                                                         
1952     __ lgr_if_needed(src_pos, callee_saved_src_pos);                                                                                 
1953     __ lgr_if_needed(dst, callee_saved_dst);                                                                                         
1954     __ lgr_if_needed(dst_pos, callee_saved_dst_pos);                                                                                 
1955     __ lgr_if_needed(length, callee_saved_length);                                                                                   
1956 
1957     if (copyfunc_addr != NULL) {                                                                                                     
1958       __ z_sr(length, tmp);                                                                                                          
1959       __ z_ar(src_pos, tmp);                                                                                                         
1960       __ z_ar(dst_pos, tmp);                                                                                                         
1961     }                                                                                                                                
1962     __ branch_optimized(Assembler::bcondAlways, *stub->entry());                                                                     
1963 
1964     __ bind(*stub->continuation());                                                                                                  
1965     return;                                                                                                                          
1966   }                                                                                                                                  
1967 
1968   assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point");         
1969 
1970   int elem_size = type2aelembytes(basic_type);                                                                                       
1971   int shift_amount;                                                                                                                  
1972 
1973   switch (elem_size) {                                                                                                               
1974     case 1 :                                                                                                                         
1975       shift_amount = 0;                                                                                                              
1976       break;                                                                                                                         
1977     case 2 :                                                                                                                         
1978       shift_amount = 1;                                                                                                              
1979       break;                                                                                                                         
1980     case 4 :                                                                                                                         

1877 
1878   __ branch_optimized(Assembler::bcondAlways, _unwind_handler_entry);
1879 }
1880 
1881 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
1882   ciArrayKlass* default_type = op->expected_type();
1883   Register src = op->src()->as_register();
1884   Register dst = op->dst()->as_register();
1885   Register src_pos = op->src_pos()->as_register();
1886   Register dst_pos = op->dst_pos()->as_register();
1887   Register length  = op->length()->as_register();
1888   Register tmp = op->tmp()->as_register();
1889 
1890   CodeStub* stub = op->stub();
1891   int flags = op->flags();
1892   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
1893   if (basic_type == T_ARRAY) basic_type = T_OBJECT;
1894 
1895   // If we don't know anything, just go through the generic arraycopy.
1896   if (default_type == NULL) {
1897     address copyfunc_addr = StubRoutines::generic_arraycopy();
1898 
1899     if (copyfunc_addr == NULL) {
1900       // Take a slow path for generic arraycopy.
1901       __ branch_optimized(Assembler::bcondAlways, *stub->entry());
1902       __ bind(*stub->continuation());
1903       return;
1904     }
1905 
1906     Label done;
1907     // Save outgoing arguments in callee saved registers (C convention) in case
1908     // a call to System.arraycopy is needed.
1909     Register callee_saved_src     = Z_R10;
1910     Register callee_saved_src_pos = Z_R11;
1911     Register callee_saved_dst     = Z_R12;
1912     Register callee_saved_dst_pos = Z_R13;
1913     Register callee_saved_length  = Z_ARG5; // Z_ARG5 == Z_R6 is callee saved.
1914 
1915     __ lgr_if_needed(callee_saved_src, src);
1916     __ lgr_if_needed(callee_saved_src_pos, src_pos);
1917     __ lgr_if_needed(callee_saved_dst, dst);
1918     __ lgr_if_needed(callee_saved_dst_pos, dst_pos);
1919     __ lgr_if_needed(callee_saved_length, length);
1920 
1921     // C function requires 64 bit values.
1922     __ z_lgfr(src_pos, src_pos);
1923     __ z_lgfr(dst_pos, dst_pos);
1924     __ z_lgfr(length, length);
1925 




1926     // Pass arguments: may push as this is not a safepoint; SP must be fix at each safepoint.
1927 
1928     // The arguments are in the corresponding registers.
1929     assert(Z_ARG1 == src,     "assumption");
1930     assert(Z_ARG2 == src_pos, "assumption");
1931     assert(Z_ARG3 == dst,     "assumption");
1932     assert(Z_ARG4 == dst_pos, "assumption");
1933     assert(Z_ARG5 == length,  "assumption");



1934 #ifndef PRODUCT
1935     if (PrintC1Statistics) {
1936       __ load_const_optimized(Z_R1_scratch, (address)&Runtime1::_generic_arraycopystub_cnt);
1937       __ add2mem_32(Address(Z_R1_scratch), 1, Z_R0_scratch);



1938     }
1939 #endif
1940     emit_call_c(copyfunc_addr);
1941     CHECK_BAILOUT();
1942 
1943     __ compare32_and_branch(Z_RET, (intptr_t)0, Assembler::bcondEqual, *stub->continuation());
1944 
1945     __ z_lgr(tmp, Z_RET);
1946     __ z_xilf(tmp, -1);


1947 
1948     // Restore values from callee saved registers so they are where the stub
1949     // expects them.
1950     __ lgr_if_needed(src, callee_saved_src);
1951     __ lgr_if_needed(src_pos, callee_saved_src_pos);
1952     __ lgr_if_needed(dst, callee_saved_dst);
1953     __ lgr_if_needed(dst_pos, callee_saved_dst_pos);
1954     __ lgr_if_needed(length, callee_saved_length);
1955 
1956     __ z_sr(length, tmp);
1957     __ z_ar(src_pos, tmp);
1958     __ z_ar(dst_pos, tmp);


1959     __ branch_optimized(Assembler::bcondAlways, *stub->entry());
1960 
1961     __ bind(*stub->continuation());
1962     return;
1963   }
1964 
1965   assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point");
1966 
1967   int elem_size = type2aelembytes(basic_type);
1968   int shift_amount;
1969 
1970   switch (elem_size) {
1971     case 1 :
1972       shift_amount = 0;
1973       break;
1974     case 2 :
1975       shift_amount = 1;
1976       break;
1977     case 4 :
< prev index next >