< prev index next >

src/hotspot/cpu/s390/c1_Runtime1_s390.cpp

G1BarrierSet_merge

25 #include "precompiled.hpp"                                                                                                           
26 #include "c1/c1_Defs.hpp"                                                                                                            
27 #include "c1/c1_MacroAssembler.hpp"                                                                                                  
28 #include "c1/c1_Runtime1.hpp"                                                                                                        
29 #include "ci/ciUtilities.hpp"                                                                                                        
30 #include "gc/shared/cardTable.hpp"                                                                                                   
31 #include "gc/shared/cardTableModRefBS.hpp"                                                                                           
32 #include "interpreter/interpreter.hpp"                                                                                               
33 #include "nativeInst_s390.hpp"                                                                                                       
34 #include "oops/compiledICHolder.hpp"                                                                                                 
35 #include "oops/oop.inline.hpp"                                                                                                       
36 #include "prims/jvmtiExport.hpp"                                                                                                     
37 #include "register_s390.hpp"                                                                                                         
38 #include "runtime/sharedRuntime.hpp"                                                                                                 
39 #include "runtime/signature.hpp"                                                                                                     
40 #include "runtime/vframeArray.hpp"                                                                                                   
41 #include "utilities/macros.hpp"                                                                                                      
42 #include "vmreg_s390.inline.hpp"                                                                                                     
43 #include "registerSaver_s390.hpp"                                                                                                    
44 #if INCLUDE_ALL_GCS                                                                                                                  
                                                                                                                                     
45 #include "gc/g1/g1CardTable.hpp"                                                                                                     
46 #include "gc/g1/g1SATBCardTableModRefBS.hpp"                                                                                         
47 #endif                                                                                                                               
48 
49 // Implementation of StubAssembler                                                                                                   
50 
51 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) {           
52   set_num_rt_args(0); // Nothing on stack.                                                                                           
53   assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
54 
55   // We cannot trust that code generated by the C++ compiler saves R14                                                               
56   // to z_abi_160.return_pc, because sometimes it spills R14 using stmg at                                                           
57   // z_abi_160.gpr14 (e.g. InterpreterRuntime::_new()).                                                                              
58   // Therefore we load the PC into Z_R1_scratch and let set_last_Java_frame() save                                                   
59   // it into the frame anchor.                                                                                                       
60   address pc = get_PC(Z_R1_scratch);                                                                                                 
61   int call_offset = (int)(pc - addr_at(0));                                                                                          
62   set_last_Java_frame(Z_SP, Z_R1_scratch);                                                                                           
63 
64   // ARG1 must hold thread address.                                                                                                  
65   z_lgr(Z_ARG1, Z_thread);                                                                                                           

25 #include "precompiled.hpp"
26 #include "c1/c1_Defs.hpp"
27 #include "c1/c1_MacroAssembler.hpp"
28 #include "c1/c1_Runtime1.hpp"
29 #include "ci/ciUtilities.hpp"
30 #include "gc/shared/cardTable.hpp"
31 #include "gc/shared/cardTableModRefBS.hpp"
32 #include "interpreter/interpreter.hpp"
33 #include "nativeInst_s390.hpp"
34 #include "oops/compiledICHolder.hpp"
35 #include "oops/oop.inline.hpp"
36 #include "prims/jvmtiExport.hpp"
37 #include "register_s390.hpp"
38 #include "runtime/sharedRuntime.hpp"
39 #include "runtime/signature.hpp"
40 #include "runtime/vframeArray.hpp"
41 #include "utilities/macros.hpp"
42 #include "vmreg_s390.inline.hpp"
43 #include "registerSaver_s390.hpp"
44 #if INCLUDE_ALL_GCS
45 #include "gc/g1/g1BarrierSet.hpp"
46 #include "gc/g1/g1CardTable.hpp"

47 #endif
48 
49 // Implementation of StubAssembler
50 
51 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) {
52   set_num_rt_args(0); // Nothing on stack.
53   assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
54 
55   // We cannot trust that code generated by the C++ compiler saves R14
56   // to z_abi_160.return_pc, because sometimes it spills R14 using stmg at
57   // z_abi_160.gpr14 (e.g. InterpreterRuntime::_new()).
58   // Therefore we load the PC into Z_R1_scratch and let set_last_Java_frame() save
59   // it into the frame anchor.
60   address pc = get_PC(Z_R1_scratch);
61   int call_offset = (int)(pc - addr_at(0));
62   set_last_Java_frame(Z_SP, Z_R1_scratch);
63 
64   // ARG1 must hold thread address.
65   z_lgr(Z_ARG1, Z_thread);

750 
751         __ bind(return0);                                                                                                            
752         __ fpop();                                                                                                                   
753         __ xorptr(rax, rax);                                                                                                         
754 
755         __ bind(do_return);                                                                                                          
756         __ addptr(rsp, 32);                                                                                                          
757         LP64_ONLY(__ pop(rdx);)                                                                                                      
758         __ pop(rcx);                                                                                                                 
759         __ pop(rsi);                                                                                                                 
760         __ ret(0);                                                                                                                   
761       }                                                                                                                              
762       break;                                                                                                                         
763 #endif // TODO                                                                                                                       
764 
765 #if INCLUDE_ALL_GCS                                                                                                                  
766     case g1_pre_barrier_slow_id:                                                                                                     
767       { // Z_R1_scratch: previous value of memory                                                                                    
768 
769         BarrierSet* bs = Universe::heap()->barrier_set();                                                                            
770         if (bs->kind() != BarrierSet::G1SATBCTLogging) {                                                                             
771           __ should_not_reach_here(FILE_AND_LINE);                                                                                   
772           break;                                                                                                                     
773         }                                                                                                                            
774 
775         __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);                                                                    
776 
777         Register pre_val = Z_R1_scratch;                                                                                             
778         Register tmp  = Z_R6; // Must be non-volatile because it is used to save pre_val.                                            
779         Register tmp2 = Z_R7;                                                                                                        
780 
781         Label refill, restart, marking_not_active;                                                                                   
782         int satb_q_active_byte_offset =                                                                                              
783           in_bytes(JavaThread::satb_mark_queue_offset() +                                                                            
784                    SATBMarkQueue::byte_offset_of_active());                                                                          
785         int satb_q_index_byte_offset =                                                                                               
786           in_bytes(JavaThread::satb_mark_queue_offset() +                                                                            
787                    SATBMarkQueue::byte_offset_of_index());                                                                           
788         int satb_q_buf_byte_offset =                                                                                                 
789           in_bytes(JavaThread::satb_mark_queue_offset() +                                                                            

750 
751         __ bind(return0);
752         __ fpop();
753         __ xorptr(rax, rax);
754 
755         __ bind(do_return);
756         __ addptr(rsp, 32);
757         LP64_ONLY(__ pop(rdx);)
758         __ pop(rcx);
759         __ pop(rsi);
760         __ ret(0);
761       }
762       break;
763 #endif // TODO
764 
765 #if INCLUDE_ALL_GCS
766     case g1_pre_barrier_slow_id:
767       { // Z_R1_scratch: previous value of memory
768 
769         BarrierSet* bs = Universe::heap()->barrier_set();
770         if (bs->kind() != BarrierSet::G1BarrierSet) {
771           __ should_not_reach_here(FILE_AND_LINE);
772           break;
773         }
774 
775         __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
776 
777         Register pre_val = Z_R1_scratch;
778         Register tmp  = Z_R6; // Must be non-volatile because it is used to save pre_val.
779         Register tmp2 = Z_R7;
780 
781         Label refill, restart, marking_not_active;
782         int satb_q_active_byte_offset =
783           in_bytes(JavaThread::satb_mark_queue_offset() +
784                    SATBMarkQueue::byte_offset_of_active());
785         int satb_q_index_byte_offset =
786           in_bytes(JavaThread::satb_mark_queue_offset() +
787                    SATBMarkQueue::byte_offset_of_index());
788         int satb_q_buf_byte_offset =
789           in_bytes(JavaThread::satb_mark_queue_offset() +

819         __ bind(marking_not_active);                                                                                                 
820         // Restore tmp registers (see assertion in G1PreBarrierStub::emit_code()).                                                   
821         __ z_lg(tmp,  0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);                                                 
822         __ z_lg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);                                                 
823         __ z_br(Z_R14);                                                                                                              
824 
825         __ bind(refill);                                                                                                             
826         save_volatile_registers(sasm);                                                                                               
827         __ z_lgr(tmp, pre_val); // save pre_val                                                                                      
828         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread),                                   
829                         Z_thread);                                                                                                   
830         __ z_lgr(pre_val, tmp); // restore pre_val                                                                                   
831         restore_volatile_registers(sasm);                                                                                            
832         __ z_bru(restart);                                                                                                           
833       }                                                                                                                              
834       break;                                                                                                                         
835 
836     case g1_post_barrier_slow_id:                                                                                                    
837       { // Z_R1_scratch: oop address, address of updated memory slot                                                                 
838         BarrierSet* bs = Universe::heap()->barrier_set();                                                                            
839         if (bs->kind() != BarrierSet::G1SATBCTLogging) {                                                                             
840           __ should_not_reach_here(FILE_AND_LINE);                                                                                   
841           break;                                                                                                                     
842         }                                                                                                                            
843 
844         __ set_info("g1_post_barrier_slow_id", dont_gc_arguments);                                                                   
845 
846         Register addr_oop  = Z_R1_scratch;                                                                                           
847         Register addr_card = Z_R1_scratch;                                                                                           
848         Register r1        = Z_R6; // Must be saved/restored.                                                                        
849         Register r2        = Z_R7; // Must be saved/restored.                                                                        
850         Register cardtable = r1;   // Must be non-volatile, because it is used to save addr_card.                                    
851         jbyte* byte_map_base = ci_card_table_address();                                                                              
852 
853         // Save registers used below (see assertion in G1PreBarrierStub::emit_code()).                                               
854         __ z_stg(r1, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);                                                  
855 
856         Label not_already_dirty, restart, refill, young_card;                                                                        
857 
858         // Calculate address of card corresponding to the updated oop slot.                                                          

819         __ bind(marking_not_active);
820         // Restore tmp registers (see assertion in G1PreBarrierStub::emit_code()).
821         __ z_lg(tmp,  0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
822         __ z_lg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
823         __ z_br(Z_R14);
824 
825         __ bind(refill);
826         save_volatile_registers(sasm);
827         __ z_lgr(tmp, pre_val); // save pre_val
828         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread),
829                         Z_thread);
830         __ z_lgr(pre_val, tmp); // restore pre_val
831         restore_volatile_registers(sasm);
832         __ z_bru(restart);
833       }
834       break;
835 
836     case g1_post_barrier_slow_id:
837       { // Z_R1_scratch: oop address, address of updated memory slot
838         BarrierSet* bs = Universe::heap()->barrier_set();
839         if (bs->kind() != BarrierSet::G1BarrierSet) {
840           __ should_not_reach_here(FILE_AND_LINE);
841           break;
842         }
843 
844         __ set_info("g1_post_barrier_slow_id", dont_gc_arguments);
845 
846         Register addr_oop  = Z_R1_scratch;
847         Register addr_card = Z_R1_scratch;
848         Register r1        = Z_R6; // Must be saved/restored.
849         Register r2        = Z_R7; // Must be saved/restored.
850         Register cardtable = r1;   // Must be non-volatile, because it is used to save addr_card.
851         jbyte* byte_map_base = ci_card_table_address();
852 
853         // Save registers used below (see assertion in G1PreBarrierStub::emit_code()).
854         __ z_stg(r1, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
855 
856         Label not_already_dirty, restart, refill, young_card;
857 
858         // Calculate address of card corresponding to the updated oop slot.
< prev index next >