< prev index next >

src/hotspot/cpu/sparc/macroAssembler_sparc.cpp

G1BarrierSet_merge

27 #include "compiler/disassembler.hpp"                                                                                                 
28 #include "gc/shared/cardTable.hpp"                                                                                                   
29 #include "gc/shared/cardTableModRefBS.hpp"                                                                                           
30 #include "gc/shared/collectedHeap.inline.hpp"                                                                                        
31 #include "interpreter/interpreter.hpp"                                                                                               
32 #include "memory/resourceArea.hpp"                                                                                                   
33 #include "memory/universe.hpp"                                                                                                       
34 #include "oops/klass.inline.hpp"                                                                                                     
35 #include "prims/methodHandles.hpp"                                                                                                   
36 #include "runtime/biasedLocking.hpp"                                                                                                 
37 #include "runtime/interfaceSupport.hpp"                                                                                              
38 #include "runtime/objectMonitor.hpp"                                                                                                 
39 #include "runtime/os.inline.hpp"                                                                                                     
40 #include "runtime/safepoint.hpp"                                                                                                     
41 #include "runtime/safepointMechanism.hpp"                                                                                            
42 #include "runtime/sharedRuntime.hpp"                                                                                                 
43 #include "runtime/stubRoutines.hpp"                                                                                                  
44 #include "utilities/align.hpp"                                                                                                       
45 #include "utilities/macros.hpp"                                                                                                      
46 #if INCLUDE_ALL_GCS                                                                                                                  
                                                                                                                                     
47 #include "gc/g1/g1CardTable.hpp"                                                                                                     
48 #include "gc/g1/g1CollectedHeap.inline.hpp"                                                                                          
49 #include "gc/g1/g1SATBCardTableModRefBS.hpp"                                                                                         
50 #include "gc/g1/heapRegion.hpp"                                                                                                      
51 #endif // INCLUDE_ALL_GCS                                                                                                            
52 #ifdef COMPILER2                                                                                                                     
53 #include "opto/intrinsicnode.hpp"                                                                                                    
54 #endif                                                                                                                               
55 
56 #ifdef PRODUCT                                                                                                                       
57 #define BLOCK_COMMENT(str) /* nothing */                                                                                             
58 #define STOP(error) stop(error)                                                                                                      
59 #else                                                                                                                                
60 #define BLOCK_COMMENT(str) block_comment(str)                                                                                        
61 #define STOP(error) block_comment(error); stop(error)                                                                                
62 #endif                                                                                                                               
63 
64 // Convert the raw encoding form into the form expected by the                                                                       
65 // constructor for Address.                                                                                                          
66 Address Address::make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc) {                               
67   assert(scale == 0, "not supported");                                                                                               
68   RelocationHolder rspec;                                                                                                            

27 #include "compiler/disassembler.hpp"
28 #include "gc/shared/cardTable.hpp"
29 #include "gc/shared/cardTableModRefBS.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "memory/universe.hpp"
34 #include "oops/klass.inline.hpp"
35 #include "prims/methodHandles.hpp"
36 #include "runtime/biasedLocking.hpp"
37 #include "runtime/interfaceSupport.hpp"
38 #include "runtime/objectMonitor.hpp"
39 #include "runtime/os.inline.hpp"
40 #include "runtime/safepoint.hpp"
41 #include "runtime/safepointMechanism.hpp"
42 #include "runtime/sharedRuntime.hpp"
43 #include "runtime/stubRoutines.hpp"
44 #include "utilities/align.hpp"
45 #include "utilities/macros.hpp"
46 #if INCLUDE_ALL_GCS
47 #include "gc/g1/g1BarrierSet.hpp"
48 #include "gc/g1/g1CardTable.hpp"
49 #include "gc/g1/g1CollectedHeap.inline.hpp"

50 #include "gc/g1/heapRegion.hpp"
51 #endif // INCLUDE_ALL_GCS
52 #ifdef COMPILER2
53 #include "opto/intrinsicnode.hpp"
54 #endif
55 
56 #ifdef PRODUCT
57 #define BLOCK_COMMENT(str) /* nothing */
58 #define STOP(error) stop(error)
59 #else
60 #define BLOCK_COMMENT(str) block_comment(str)
61 #define STOP(error) block_comment(error); stop(error)
62 #endif
63 
64 // Convert the raw encoding form into the form expected by the
65 // constructor for Address.
66 Address Address::make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc) {
67   assert(scale == 0, "not supported");
68   RelocationHolder rspec;

3646   __ mov(L6, O3);                                                                                                                    
3647   __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);                                                                  
3648   __ delayed()->mov(L4, O7);                                                                                                         
3649 
3650   dirty_card_log_enqueue = start;                                                                                                    
3651   dirty_card_log_enqueue_end = __ pc();                                                                                              
3652   // XXX Should have a guarantee here about not going off the end!                                                                   
3653   // Does it already do so?  Do an experiment...                                                                                     
3654 
3655 #undef __                                                                                                                            
3656 
3657 }                                                                                                                                    
3658 
3659 void MacroAssembler::g1_write_barrier_post(Register store_addr, Register new_val, Register tmp) {                                    
3660 
3661   Label filtered;                                                                                                                    
3662   MacroAssembler* post_filter_masm = this;                                                                                           
3663 
3664   if (new_val == G0) return;                                                                                                         
3665 
3666   G1SATBCardTableLoggingModRefBS* bs =                                                                                               
3667     barrier_set_cast<G1SATBCardTableLoggingModRefBS>(Universe::heap()->barrier_set());                                               
3668   CardTable* ct = bs->card_table();                                                                                                  
3669 
3670   if (G1RSBarrierRegionFilter) {                                                                                                     
3671     xor3(store_addr, new_val, tmp);                                                                                                  
3672     srlx(tmp, HeapRegion::LogOfHRGrainBytes, tmp);                                                                                   
3673 
3674     // XXX Should I predict this taken or not?  Does it matter?                                                                      
3675     cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);                                                           
3676   }                                                                                                                                  
3677 
3678   // If the "store_addr" register is an "in" or "local" register, move it to                                                         
3679   // a scratch reg so we can pass it as an argument.                                                                                 
3680   bool use_scr = !(store_addr->is_global() || store_addr->is_out());                                                                 
3681   // Pick a scratch register different from "tmp".                                                                                   
3682   Register scr = (tmp == G1_scratch ? G3_scratch : G1_scratch);                                                                      
3683   // Make sure we use up the delay slot!                                                                                             
3684   if (use_scr) {                                                                                                                     
3685     post_filter_masm->mov(store_addr, scr);                                                                                          
3686   } else {                                                                                                                           
3687     post_filter_masm->nop();                                                                                                         
3688   }                                                                                                                                  
3689   save_frame(0);                                                                                                                     
3690   call(dirty_card_log_enqueue);                                                                                                      
3691   if (use_scr) {                                                                                                                     
3692     delayed()->mov(scr, O0);                                                                                                         
3693   } else {                                                                                                                           
3694     delayed()->mov(store_addr->after_save(), O0);                                                                                    
3695   }                                                                                                                                  
3696   restore();                                                                                                                         
3697 
3698   bind(filtered);                                                                                                                    
3699 }                                                                                                                                    
3700 
3701 // Called from init_globals() after universe_init() and before interpreter_init()                                                    
3702 void g1_barrier_stubs_init() {                                                                                                       
3703   CollectedHeap* heap = Universe::heap();                                                                                            
3704   if (heap->kind() == CollectedHeap::G1CollectedHeap) {                                                                              
3705     // Only needed for G1                                                                                                            
3706     if (dirty_card_log_enqueue == 0) {                                                                                               
3707       G1SATBCardTableLoggingModRefBS* bs =                                                                                           
3708         barrier_set_cast<G1SATBCardTableLoggingModRefBS>(heap->barrier_set());                                                       
3709       CardTable *ct = bs->card_table();                                                                                              
3710       generate_dirty_card_log_enqueue(ct->byte_map_base());                                                                          
3711       assert(dirty_card_log_enqueue != 0, "postcondition.");                                                                         
3712     }                                                                                                                                
3713     if (satb_log_enqueue_with_frame == 0) {                                                                                          
3714       generate_satb_log_enqueue(true);                                                                                               
3715       assert(satb_log_enqueue_with_frame != 0, "postcondition.");                                                                    
3716     }                                                                                                                                
3717     if (satb_log_enqueue_frameless == 0) {                                                                                           
3718       generate_satb_log_enqueue(false);                                                                                              
3719       assert(satb_log_enqueue_frameless != 0, "postcondition.");                                                                     
3720     }                                                                                                                                
3721   }                                                                                                                                  
3722 }                                                                                                                                    
3723 
3724 #endif // INCLUDE_ALL_GCS                                                                                                            
3725 ///////////////////////////////////////////////////////////////////////////////////                                                  
3726 
3727 void MacroAssembler::card_write_barrier_post(Register store_addr, Register new_val, Register tmp) {                                  

3646   __ mov(L6, O3);
3647   __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
3648   __ delayed()->mov(L4, O7);
3649 
3650   dirty_card_log_enqueue = start;
3651   dirty_card_log_enqueue_end = __ pc();
3652   // XXX Should have a guarantee here about not going off the end!
3653   // Does it already do so?  Do an experiment...
3654 
3655 #undef __
3656 
3657 }
3658 
3659 void MacroAssembler::g1_write_barrier_post(Register store_addr, Register new_val, Register tmp) {
3660 
3661   Label filtered;
3662   MacroAssembler* post_filter_masm = this;
3663 
3664   if (new_val == G0) return;
3665 
3666   G1BarrierSet* bs =
3667     barrier_set_cast<G1BarrierSet>(Universe::heap()->barrier_set());
3668   CardTable* ct = bs->card_table();
3669 
3670   if (G1RSBarrierRegionFilter) {
3671     xor3(store_addr, new_val, tmp);
3672     srlx(tmp, HeapRegion::LogOfHRGrainBytes, tmp);
3673 
3674     // XXX Should I predict this taken or not?  Does it matter?
3675     cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
3676   }
3677 
3678   // If the "store_addr" register is an "in" or "local" register, move it to
3679   // a scratch reg so we can pass it as an argument.
3680   bool use_scr = !(store_addr->is_global() || store_addr->is_out());
3681   // Pick a scratch register different from "tmp".
3682   Register scr = (tmp == G1_scratch ? G3_scratch : G1_scratch);
3683   // Make sure we use up the delay slot!
3684   if (use_scr) {
3685     post_filter_masm->mov(store_addr, scr);
3686   } else {
3687     post_filter_masm->nop();
3688   }
3689   save_frame(0);
3690   call(dirty_card_log_enqueue);
3691   if (use_scr) {
3692     delayed()->mov(scr, O0);
3693   } else {
3694     delayed()->mov(store_addr->after_save(), O0);
3695   }
3696   restore();
3697 
3698   bind(filtered);
3699 }
3700 
3701 // Called from init_globals() after universe_init() and before interpreter_init()
3702 void g1_barrier_stubs_init() {
3703   CollectedHeap* heap = Universe::heap();
3704   if (heap->kind() == CollectedHeap::G1CollectedHeap) {
3705     // Only needed for G1
3706     if (dirty_card_log_enqueue == 0) {
3707       G1BarrierSet* bs =
3708         barrier_set_cast<G1BarrierSet>(heap->barrier_set());
3709       CardTable *ct = bs->card_table();
3710       generate_dirty_card_log_enqueue(ct->byte_map_base());
3711       assert(dirty_card_log_enqueue != 0, "postcondition.");
3712     }
3713     if (satb_log_enqueue_with_frame == 0) {
3714       generate_satb_log_enqueue(true);
3715       assert(satb_log_enqueue_with_frame != 0, "postcondition.");
3716     }
3717     if (satb_log_enqueue_frameless == 0) {
3718       generate_satb_log_enqueue(false);
3719       assert(satb_log_enqueue_frameless != 0, "postcondition.");
3720     }
3721   }
3722 }
3723 
3724 #endif // INCLUDE_ALL_GCS
3725 ///////////////////////////////////////////////////////////////////////////////////
3726 
3727 void MacroAssembler::card_write_barrier_post(Register store_addr, Register new_val, Register tmp) {
< prev index next >