< prev index next >

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp

rename things

9  * This code is distributed in the hope that it will be useful, but WITHOUT                                                          
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or                                                             
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License                                                             
12  * version 2 for more details (a copy is included in the LICENSE file that                                                           
13  * accompanied this code).                                                                                                           
14  *                                                                                                                                   
15  * You should have received a copy of the GNU General Public License version                                                         
16  * 2 along with this work; if not, write to the Free Software Foundation,                                                            
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.                                                                     
18  *                                                                                                                                   
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA                                                           
20  * or visit www.oracle.com if you need additional information or have any                                                            
21  * questions.                                                                                                                        
22  *                                                                                                                                   
23  */                                                                                                                                  
24 
25 #include "precompiled.hpp"                                                                                                           
26 #include "asm/macroAssembler.hpp"                                                                                                    
27 #include "asm/macroAssembler.inline.hpp"                                                                                             
28 #include "gc/shared/barrierSet.hpp"                                                                                                  
29 #include "gc/shared/barrierSetCodeGen.hpp"                                                                                           
30 #include "interpreter/interpreter.hpp"                                                                                               
31 #include "nativeInst_aarch64.hpp"                                                                                                    
32 #include "oops/instanceOop.hpp"                                                                                                      
33 #include "oops/method.hpp"                                                                                                           
34 #include "oops/objArrayKlass.hpp"                                                                                                    
35 #include "oops/oop.inline.hpp"                                                                                                       
36 #include "prims/methodHandles.hpp"                                                                                                   
37 #include "runtime/frame.inline.hpp"                                                                                                  
38 #include "runtime/handles.inline.hpp"                                                                                                
39 #include "runtime/sharedRuntime.hpp"                                                                                                 
40 #include "runtime/stubCodeGenerator.hpp"                                                                                             
41 #include "runtime/stubRoutines.hpp"                                                                                                  
42 #include "runtime/thread.inline.hpp"                                                                                                 
43 #include "utilities/align.hpp"                                                                                                       
44 #ifdef COMPILER2                                                                                                                     
45 #include "opto/runtime.hpp"                                                                                                          
46 #endif                                                                                                                               
47 
48 #ifdef BUILTIN_SIM                                                                                                                   

9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "gc/shared/barrierSet.hpp"
29 #include "gc/shared/barrierSetAssembler.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "nativeInst_aarch64.hpp"
32 #include "oops/instanceOop.hpp"
33 #include "oops/method.hpp"
34 #include "oops/objArrayKlass.hpp"
35 #include "oops/oop.inline.hpp"
36 #include "prims/methodHandles.hpp"
37 #include "runtime/frame.inline.hpp"
38 #include "runtime/handles.inline.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/stubCodeGenerator.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "runtime/thread.inline.hpp"
43 #include "utilities/align.hpp"
44 #ifdef COMPILER2
45 #include "opto/runtime.hpp"
46 #endif
47 
48 #ifdef BUILTIN_SIM

1341     RegSet saved_reg = RegSet::of(s, d, count);                                                                                      
1342     __ align(CodeEntryAlignment);                                                                                                    
1343     StubCodeMark mark(this, "StubRoutines", name);                                                                                   
1344     address start = __ pc();                                                                                                         
1345     __ enter();                                                                                                                      
1346 
1347     if (entry != NULL) {                                                                                                             
1348       *entry = __ pc();                                                                                                              
1349       // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)                                                           
1350       BLOCK_COMMENT("Entry:");                                                                                                       
1351     }                                                                                                                                
1352 
1353     DecoratorSet decorators = ARRAYCOPY_DISJOINT;                                                                                    
1354     if (dest_uninitialized) {                                                                                                        
1355       decorators |= AS_DEST_NOT_INITIALIZED;                                                                                         
1356     }                                                                                                                                
1357     if (aligned) {                                                                                                                   
1358       decorators |= ARRAYCOPY_ALIGNED;                                                                                               
1359     }                                                                                                                                
1360 
1361     BarrierSetCodeGen *bs = Universe::heap()->barrier_set()->code_gen();                                                             
1362     bs->arraycopy_prologue(_masm, decorators, is_oop, d, count, saved_reg);                                                          
1363 
1364     if (is_oop) {                                                                                                                    
1365       // save regs before copy_memory                                                                                                
1366       __ push(RegSet::of(d, count), sp);                                                                                             
1367     }                                                                                                                                
1368     copy_memory(aligned, s, d, count, rscratch1, size);                                                                              
1369 
1370     if (is_oop) {                                                                                                                    
1371       __ pop(RegSet::of(d, count), sp);                                                                                              
1372       if (VerifyOops)                                                                                                                
1373         verify_oop_array(size, d, count, r16);                                                                                       
1374       __ sub(count, count, 1); // make an inclusive end pointer                                                                      
1375       __ lea(count, Address(d, count, Address::lsl(exact_log2(size))));                                                              
1376     }                                                                                                                                
1377 
1378     bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());                                                
1379 
1380     __ leave();                                                                                                                      

1341     RegSet saved_reg = RegSet::of(s, d, count);
1342     __ align(CodeEntryAlignment);
1343     StubCodeMark mark(this, "StubRoutines", name);
1344     address start = __ pc();
1345     __ enter();
1346 
1347     if (entry != NULL) {
1348       *entry = __ pc();
1349       // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
1350       BLOCK_COMMENT("Entry:");
1351     }
1352 
1353     DecoratorSet decorators = ARRAYCOPY_DISJOINT;
1354     if (dest_uninitialized) {
1355       decorators |= AS_DEST_NOT_INITIALIZED;
1356     }
1357     if (aligned) {
1358       decorators |= ARRAYCOPY_ALIGNED;
1359     }
1360 
1361     BarrierSetAssembler *bs = Universe::heap()->barrier_set()->barrier_set_assembler();
1362     bs->arraycopy_prologue(_masm, decorators, is_oop, d, count, saved_reg);
1363 
1364     if (is_oop) {
1365       // save regs before copy_memory
1366       __ push(RegSet::of(d, count), sp);
1367     }
1368     copy_memory(aligned, s, d, count, rscratch1, size);
1369 
1370     if (is_oop) {
1371       __ pop(RegSet::of(d, count), sp);
1372       if (VerifyOops)
1373         verify_oop_array(size, d, count, r16);
1374       __ sub(count, count, 1); // make an inclusive end pointer
1375       __ lea(count, Address(d, count, Address::lsl(exact_log2(size))));
1376     }
1377 
1378     bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());
1379 
1380     __ leave();

1415 
1416     if (entry != NULL) {                                                                                                             
1417       *entry = __ pc();                                                                                                              
1418       // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)                                                           
1419       BLOCK_COMMENT("Entry:");                                                                                                       
1420     }                                                                                                                                
1421 
1422     // use fwd copy when (d-s) above_equal (count*size)                                                                              
1423     __ sub(rscratch1, d, s);                                                                                                         
1424     __ cmp(rscratch1, count, Assembler::LSL, exact_log2(size));                                                                      
1425     __ br(Assembler::HS, nooverlap_target);                                                                                          
1426 
1427     DecoratorSet decorators = 0;                                                                                                     
1428     if (dest_uninitialized) {                                                                                                        
1429       decorators |= AS_DEST_NOT_INITIALIZED;                                                                                         
1430     }                                                                                                                                
1431     if (aligned) {                                                                                                                   
1432       decorators |= ARRAYCOPY_ALIGNED;                                                                                               
1433     }                                                                                                                                
1434 
1435     BarrierSetCodeGen *bs = Universe::heap()->barrier_set()->code_gen();                                                             
1436     bs->arraycopy_prologue(_masm, decorators, is_oop, d, count, saved_regs);                                                         
1437 
1438     if (is_oop) {                                                                                                                    
1439       // save regs before copy_memory                                                                                                
1440       __ push(RegSet::of(d, count), sp);                                                                                             
1441     }                                                                                                                                
1442     copy_memory(aligned, s, d, count, rscratch1, -size);                                                                             
1443     if (is_oop) {                                                                                                                    
1444       __ pop(RegSet::of(d, count), sp);                                                                                              
1445       if (VerifyOops)                                                                                                                
1446         verify_oop_array(size, d, count, r16);                                                                                       
1447       __ sub(count, count, 1); // make an inclusive end pointer                                                                      
1448       __ lea(count, Address(d, count, Address::lsl(exact_log2(size))));                                                              
1449     }                                                                                                                                
1450     bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());                                                
1451     __ leave();                                                                                                                      
1452     __ mov(r0, zr); // return 0                                                                                                      
1453     __ ret(lr);                                                                                                                      
1454 #ifdef BUILTIN_SIM                                                                                                                   

1415 
1416     if (entry != NULL) {
1417       *entry = __ pc();
1418       // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
1419       BLOCK_COMMENT("Entry:");
1420     }
1421 
1422     // use fwd copy when (d-s) above_equal (count*size)
1423     __ sub(rscratch1, d, s);
1424     __ cmp(rscratch1, count, Assembler::LSL, exact_log2(size));
1425     __ br(Assembler::HS, nooverlap_target);
1426 
1427     DecoratorSet decorators = 0;
1428     if (dest_uninitialized) {
1429       decorators |= AS_DEST_NOT_INITIALIZED;
1430     }
1431     if (aligned) {
1432       decorators |= ARRAYCOPY_ALIGNED;
1433     }
1434 
1435     BarrierSetAssembler *bs = Universe::heap()->barrier_set()->barrier_set_assembler();
1436     bs->arraycopy_prologue(_masm, decorators, is_oop, d, count, saved_regs);
1437 
1438     if (is_oop) {
1439       // save regs before copy_memory
1440       __ push(RegSet::of(d, count), sp);
1441     }
1442     copy_memory(aligned, s, d, count, rscratch1, -size);
1443     if (is_oop) {
1444       __ pop(RegSet::of(d, count), sp);
1445       if (VerifyOops)
1446         verify_oop_array(size, d, count, r16);
1447       __ sub(count, count, 1); // make an inclusive end pointer
1448       __ lea(count, Address(d, count, Address::lsl(exact_log2(size))));
1449     }
1450     bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());
1451     __ leave();
1452     __ mov(r0, zr); // return 0
1453     __ ret(lr);
1454 #ifdef BUILTIN_SIM

1777 #ifdef ASSERT                                                                                                                        
1778     BLOCK_COMMENT("assert consistent ckoff/ckval");                                                                                  
1779     // The ckoff and ckval must be mutually consistent,                                                                              
1780     // even though caller generates both.                                                                                            
1781     { Label L;                                                                                                                       
1782       int sco_offset = in_bytes(Klass::super_check_offset_offset());                                                                 
1783       __ ldrw(start_to, Address(ckval, sco_offset));                                                                                 
1784       __ cmpw(ckoff, start_to);                                                                                                      
1785       __ br(Assembler::EQ, L);                                                                                                       
1786       __ stop("super_check_offset inconsistent");                                                                                    
1787       __ bind(L);                                                                                                                    
1788     }                                                                                                                                
1789 #endif //ASSERT                                                                                                                      
1790 
1791     DecoratorSet decorators = ARRAYCOPY_CHECKCAST;                                                                                   
1792     bool is_oop = true;                                                                                                              
1793     if (dest_uninitialized) {                                                                                                        
1794       decorators |= AS_DEST_NOT_INITIALIZED;                                                                                         
1795     }                                                                                                                                
1796 
1797     BarrierSetCodeGen *bs = Universe::heap()->barrier_set()->code_gen();                                                             
1798     bs->arraycopy_prologue(_masm, decorators, is_oop, to, count, wb_pre_saved_regs);                                                 
1799 
1800     // save the original count                                                                                                       
1801     __ mov(count_save, count);                                                                                                       
1802 
1803     // Copy from low to high addresses                                                                                               
1804     __ mov(start_to, to);              // Save destination array start address                                                       
1805     __ b(L_load_element);                                                                                                            
1806 
1807     // ======== begin loop ========                                                                                                  
1808     // (Loop is rotated; its entry is L_load_element.)                                                                               
1809     // Loop control:                                                                                                                 
1810     //   for (; count != 0; count--) {                                                                                               
1811     //     copied_oop = load_heap_oop(from++);                                                                                       
1812     //     ... generate_type_check ...;                                                                                              
1813     //     store_heap_oop(to++, copied_oop);                                                                                         
1814     //   }                                                                                                                           
1815     __ align(OptoLoopAlignment);                                                                                                     
1816 

1777 #ifdef ASSERT
1778     BLOCK_COMMENT("assert consistent ckoff/ckval");
1779     // The ckoff and ckval must be mutually consistent,
1780     // even though caller generates both.
1781     { Label L;
1782       int sco_offset = in_bytes(Klass::super_check_offset_offset());
1783       __ ldrw(start_to, Address(ckval, sco_offset));
1784       __ cmpw(ckoff, start_to);
1785       __ br(Assembler::EQ, L);
1786       __ stop("super_check_offset inconsistent");
1787       __ bind(L);
1788     }
1789 #endif //ASSERT
1790 
1791     DecoratorSet decorators = ARRAYCOPY_CHECKCAST;
1792     bool is_oop = true;
1793     if (dest_uninitialized) {
1794       decorators |= AS_DEST_NOT_INITIALIZED;
1795     }
1796 
1797     BarrierSetAssembler *bs = Universe::heap()->barrier_set()->barrier_set_assembler();
1798     bs->arraycopy_prologue(_masm, decorators, is_oop, to, count, wb_pre_saved_regs);
1799 
1800     // save the original count
1801     __ mov(count_save, count);
1802 
1803     // Copy from low to high addresses
1804     __ mov(start_to, to);              // Save destination array start address
1805     __ b(L_load_element);
1806 
1807     // ======== begin loop ========
1808     // (Loop is rotated; its entry is L_load_element.)
1809     // Loop control:
1810     //   for (; count != 0; count--) {
1811     //     copied_oop = load_heap_oop(from++);
1812     //     ... generate_type_check ...;
1813     //     store_heap_oop(to++, copied_oop);
1814     //   }
1815     __ align(OptoLoopAlignment);
1816 
< prev index next >