< prev index next >

src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp

BarrierSetC1_v3

BarrierSetC1_v2

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 "gc/shared/c1/modRefBarrierSetC1.hpp"                                                                                       
26 #include "utilities/macros.hpp"                                                                                                      
27 
28 #ifdef ASSERT                                                                                                                        
29 #define __ lir_generator->lir(__FILE__, __LINE__)->                                                                                  
30 #else                                                                                                                                
31 #define __ lir_generator->lir()->                                                                                                    
32 #endif                                                                                                                               
33 
34 void ModRefBarrierSetC1::store_at_resolved(LIRGenerator *lir_generator, DecoratorSet decorators, BasicType type,                     
35                                            LIR_Opr addr, LIRItem& base, LIR_Opr offset, LIR_Opr value,                               
36                                            CodeEmitInfo* patch_info, CodeEmitInfo* store_emit_info) {                                
37   bool is_oop = type == T_OBJECT || type == T_ARRAY;                                                                                 
38   bool on_array = (decorators & IN_HEAP_ARRAY) != 0;                                                                                 
39   bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;                                                                        
40 
41   if (is_oop) {                                                                                                                      
42     pre_barrier(lir_generator, decorators, addr, LIR_OprFact::illegalOpr /* pre_val */, patch_info);                                 
                                                                                                                                     
43   }                                                                                                                                  
44 
45   BarrierSetC1::store_at_resolved(lir_generator, decorators, type, addr, base, offset, value, patch_info, store_emit_info);          
46 
47   if (is_oop) {                                                                                                                      
48     bool precise = on_array || on_anonymous;                                                                                         
49     LIR_Opr post_addr = precise ? addr : base.result();                                                                              
50     post_barrier(lir_generator, decorators, post_addr, value);                                                                       
51   }                                                                                                                                  
52 }                                                                                                                                    
53 
54 LIR_Opr ModRefBarrierSetC1::atomic_cmpxchg_resolved(LIRGenerator *lir_generator, DecoratorSet decorators, BasicType type,            
55                                             LIR_Opr addr, LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value) {  
56   bool is_oop = type == T_OBJECT || type == T_ARRAY;                                                                                 
57                                                                                                                                      
58   if (is_oop) {                                                                                                                      
59     pre_barrier(lir_generator, decorators, addr, LIR_OprFact::illegalOpr /* pre_val */, NULL);                                       
60   }                                                                                                                                  
61 
62   LIR_Opr result = BarrierSetC1::atomic_cmpxchg_resolved(lir_generator, decorators, type, addr, base, offset, cmp_value, new_value); 
63 
64   if (is_oop) {                                                                                                                      
65     post_barrier(lir_generator, decorators, addr, new_value.result());                                                               
66   }                                                                                                                                  
67 
68   return result;                                                                                                                     
69 }                                                                                                                                    
70 
71 LIR_Opr ModRefBarrierSetC1::atomic_xchg_resolved(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,               
72                                              LIR_Opr addr, LIRItem& base, LIRItem& offset, LIRItem& value) {                         
73   bool is_oop = type == T_OBJECT || type == T_ARRAY;                                                                                 
74                                                                                                                                      
75   if (is_oop) {                                                                                                                      
76     pre_barrier(lir_generator, decorators, addr, LIR_OprFact::illegalOpr /* pre_val */, NULL);                                       
77   }                                                                                                                                  
78 
79   LIR_Opr result = BarrierSetC1::atomic_xchg_resolved(lir_generator, decorators, type, addr, base, offset, value);                   
80 
81   if (is_oop) {                                                                                                                      
82     post_barrier(lir_generator, decorators, addr, value.result());                                                                   
83   }                                                                                                                                  
84 
85   return result;                                                                                                                     
86 }                                                                                                                                    
87 
88 // This overrides the default to resolve the address into a register, assuming it will be used by a write barrier                    
89 void ModRefBarrierSetC1::store_at(LIRGenerator *lir_generator, DecoratorSet decorators, BasicType type,                              
90                                   LIRItem& base, LIR_Opr offset, LIR_Opr value,                                                      
91                                   CodeEmitInfo* patch_info, CodeEmitInfo* store_emit_info) {                                         
92   bool is_oop = type == T_OBJECT || type == T_ARRAY;                                                                                 
93   bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0;                                                                       
94   LIR_Opr addr = resolve_address(lir_generator, decorators, type, base, offset, !needs_patching && is_oop);                          
95   store_at_resolved(lir_generator, decorators, type, addr, base, offset, value, patch_info, store_emit_info);                        
96 }                                                                                                                                    

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 "gc/shared/c1/modRefBarrierSetC1.hpp"
26 #include "utilities/macros.hpp"
27 
28 #ifdef ASSERT
29 #define __ gen->lir(__FILE__, __LINE__)->
30 #else
31 #define __ gen->lir()->
32 #endif
33 
34 void ModRefBarrierSetC1::store_at_resolved(LIRAccess& access, LIR_Opr value) {
35   DecoratorSet decorators = access.decorators();


36   bool on_array = (decorators & IN_HEAP_ARRAY) != 0;
37   bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
38 
39   if (access.is_oop()) {
40     pre_barrier(access, access.resolved_addr(),
41                 LIR_OprFact::illegalOpr /* pre_val */, access.patch_info());
42   }
43 
44   BarrierSetC1::store_at_resolved(access, value);
45 
46   if (access.is_oop()) {
47     bool precise = on_array || on_anonymous;
48     LIR_Opr post_addr = precise ? access.resolved_addr() : access.base().opr();
49     post_barrier(access, post_addr, value);
50   }
51 }
52 
53 LIR_Opr ModRefBarrierSetC1::atomic_cmpxchg_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value) {
54   if (access.is_oop()) {
55     pre_barrier(access, access.resolved_addr(),
56                 LIR_OprFact::illegalOpr /* pre_val */, NULL);


57   }
58 
59   LIR_Opr result = BarrierSetC1::atomic_cmpxchg_resolved(access, cmp_value, new_value);
60 
61   if (access.is_oop()) {
62     post_barrier(access, access.resolved_addr(), new_value.result());
63   }
64 
65   return result;
66 }
67 
68 LIR_Opr ModRefBarrierSetC1::atomic_xchg_resolved(LIRAccess& access, LIRItem& value) {
69   if (access.is_oop()) {
70     pre_barrier(access, access.resolved_addr(),
71                 LIR_OprFact::illegalOpr /* pre_val */, NULL);


72   }
73 
74   LIR_Opr result = BarrierSetC1::atomic_xchg_resolved(access, value);
75 
76   if (access.is_oop()) {
77     post_barrier(access, access.resolved_addr(), value.result());
78   }
79 
80   return result;
81 }
82 
83 // This overrides the default to resolve the address into a register,
84 // assuming it will be used by a write barrier anyway.
85 LIR_Opr ModRefBarrierSetC1::resolve_address(LIRAccess& access, bool resolve_in_register) {
86   DecoratorSet decorators = access.decorators();

87   bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0;
88   resolve_in_register |= !needs_patching && access.is_oop();
89   return BarrierSetC1::resolve_address(access, resolve_in_register);
90 }
< prev index next >