< prev index next >

src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp

rename things

7  *                                                                                                                                   
8  * This code is distributed in the hope that it will be useful, but WITHOUT                                                          
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or                                                             
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License                                                             
11  * version 2 for more details (a copy is included in the LICENSE file that                                                           
12  * accompanied this code).                                                                                                           
13  *                                                                                                                                   
14  * You should have received a copy of the GNU General Public License version                                                         
15  * 2 along with this work; if not, write to the Free Software Foundation,                                                            
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.                                                                     
17  *                                                                                                                                   
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA                                                           
19  * or visit www.oracle.com if you need additional information or have any                                                            
20  * questions.                                                                                                                        
21  *                                                                                                                                   
22  */                                                                                                                                  
23 
24 #include "precompiled.hpp"                                                                                                           
25 #include "asm/macroAssembler.inline.hpp"                                                                                             
26 #include "gc/g1/g1BarrierSet.hpp"                                                                                                    
27 #include "gc/g1/g1BarrierSetCodeGen.hpp"                                                                                             
28 #include "gc/g1/g1CardTable.hpp"                                                                                                     
29 #include "gc/g1/heapRegion.hpp"                                                                                                      
30 #include "gc/shared/collectedHeap.hpp"                                                                                               
31 #include "interpreter/interp_masm.hpp"                                                                                               
32 #include "runtime/sharedRuntime.hpp"                                                                                                 
33 #include "runtime/thread.hpp"                                                                                                        
34 #include "utilities/macros.hpp"                                                                                                      
35 
36 #define __ masm->                                                                                                                    
37 
38 void G1BarrierSetCodeGen::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators, Register addr, Register coun
                                                                                                                                     
39   bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;                                                             
40 
41   if (!dest_uninitialized) {                                                                                                         
42     Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);                                                                           
43 #ifndef _LP64                                                                                                                        
44     __ push(thread);                                                                                                                 
45     __ get_thread(thread);                                                                                                           
46 #endif                                                                                                                               
47 
48     Label filtered;                                                                                                                  
49     Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +                                                      
50                                          SATBMarkQueue::byte_offset_of_active()));                                                   
51     // Is marking active?                                                                                                            
52     if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {                                                                      
53       __ cmpl(in_progress, 0);                                                                                                       
54     } else {                                                                                                                         
55       assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");                                                    
56       __ cmpb(in_progress, 0);                                                                                                       
57     }                                                                                                                                

7  *
8  * This code is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * version 2 for more details (a copy is included in the LICENSE file that
12  * accompanied this code).
13  *
14  * You should have received a copy of the GNU General Public License version
15  * 2 along with this work; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19  * or visit www.oracle.com if you need additional information or have any
20  * questions.
21  *
22  */
23 
24 #include "precompiled.hpp"
25 #include "asm/macroAssembler.inline.hpp"
26 #include "gc/g1/g1BarrierSet.hpp"
27 #include "gc/g1/g1BarrierSetAssembler.hpp"
28 #include "gc/g1/g1CardTable.hpp"
29 #include "gc/g1/heapRegion.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "interpreter/interp_masm.hpp"
32 #include "runtime/sharedRuntime.hpp"
33 #include "runtime/thread.hpp"
34 #include "utilities/macros.hpp"
35 
36 #define __ masm->
37 
38 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
39                                                             Register addr, Register count) {
40   bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
41 
42   if (!dest_uninitialized) {
43     Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
44 #ifndef _LP64
45     __ push(thread);
46     __ get_thread(thread);
47 #endif
48 
49     Label filtered;
50     Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
51                                          SATBMarkQueue::byte_offset_of_active()));
52     // Is marking active?
53     if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
54       __ cmpl(in_progress, 0);
55     } else {
56       assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
57       __ cmpb(in_progress, 0);
58     }

72       }                                                                                                                              
73     } else {                                                                                                                         
74       __ movptr(c_rarg0, addr);                                                                                                      
75       __ movptr(c_rarg1, count);                                                                                                     
76     }                                                                                                                                
77     if (UseCompressedOops) {                                                                                                         
78       __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), 2);                             
79     } else {                                                                                                                         
80       __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), 2);                                    
81     }                                                                                                                                
82 #else                                                                                                                                
83     __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry),                                          
84                     addr, count);                                                                                                    
85 #endif                                                                                                                               
86     __ popa();                                                                                                                       
87 
88     __ bind(filtered);                                                                                                               
89   }                                                                                                                                  
90 }                                                                                                                                    
91 
92 void G1BarrierSetCodeGen::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators, Register addr, Register cou
                                                                                                                                     
93   __ pusha();             // push registers (overkill)                                                                               
94 #ifdef _LP64                                                                                                                         
95   if (c_rarg0 == count) { // On win64 c_rarg0 == rcx                                                                                 
96     assert_different_registers(c_rarg1, addr);                                                                                       
97     __ mov(c_rarg1, count);                                                                                                          
98     __ mov(c_rarg0, addr);                                                                                                           
99   } else {                                                                                                                           
100     assert_different_registers(c_rarg0, count);                                                                                      
101     __ mov(c_rarg0, addr);                                                                                                           
102     __ mov(c_rarg1, count);                                                                                                          
103   }                                                                                                                                  
104   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), 2);                                           
105 #else                                                                                                                                
106   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry),                                               
107                   addr, count);                                                                                                      
108 #endif                                                                                                                               
109   __ popa();                                                                                                                         
110 }                                                                                                                                    

73       }
74     } else {
75       __ movptr(c_rarg0, addr);
76       __ movptr(c_rarg1, count);
77     }
78     if (UseCompressedOops) {
79       __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), 2);
80     } else {
81       __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), 2);
82     }
83 #else
84     __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry),
85                     addr, count);
86 #endif
87     __ popa();
88 
89     __ bind(filtered);
90   }
91 }
92 
93 void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
94                                                              Register addr, Register count, Register tmp) {
95   __ pusha();             // push registers (overkill)
96 #ifdef _LP64
97   if (c_rarg0 == count) { // On win64 c_rarg0 == rcx
98     assert_different_registers(c_rarg1, addr);
99     __ mov(c_rarg1, count);
100     __ mov(c_rarg0, addr);
101   } else {
102     assert_different_registers(c_rarg0, count);
103     __ mov(c_rarg0, addr);
104     __ mov(c_rarg1, count);
105   }
106   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), 2);
107 #else
108   __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry),
109                   addr, count);
110 #endif
111   __ popa();
112 }
< prev index next >