< prev index next >

src/hotspot/share/oops/cpCache.cpp

Print this page

115   Atomic::release_store(&_f1, f1);
116 }
117 
118 void ConstantPoolCacheEntry::set_indy_resolution_failed() {
119   Atomic::release_store(&_flags, _flags | (1 << indy_resolution_failed_shift));
120 }
121 
122 // Note that concurrent update of both bytecodes can leave one of them
123 // reset to zero.  This is harmless; the interpreter will simply re-resolve
124 // the damaged entry.  More seriously, the memory synchronization is needed
125 // to flush other fields (f1, f2) completely to memory before the bytecodes
126 // are updated, lest other processors see a non-zero bytecode but zero f1/f2.
127 void ConstantPoolCacheEntry::set_field(Bytecodes::Code get_code,
128                                        Bytecodes::Code put_code,
129                                        Klass* field_holder,
130                                        int field_index,
131                                        int field_offset,
132                                        TosState field_type,
133                                        bool is_final,
134                                        bool is_volatile,

135                                        Klass* root_klass) {
136   set_f1(field_holder);
137   set_f2(field_offset);
138   assert((field_index & field_index_mask) == field_index,
139          "field index does not fit in low flag bits");
140   set_field_flags(field_type,
141                   ((is_volatile ? 1 : 0) << is_volatile_shift) |
142                   ((is_final    ? 1 : 0) << is_final_shift),

143                   field_index);
144   set_bytecode_1(get_code);
145   set_bytecode_2(put_code);
146   NOT_PRODUCT(verify(tty));
147 }
148 
149 void ConstantPoolCacheEntry::set_parameter_size(int value) {
150   // This routine is called only in corner cases where the CPCE is not yet initialized.
151   // See AbstractInterpreter::deopt_continue_after_entry.
152   assert(_flags == 0 || parameter_size() == 0 || parameter_size() == value,
153          "size must not change: parameter_size=%d, value=%d", parameter_size(), value);
154   // Setting the parameter size by itself is only safe if the
155   // current value of _flags is 0, otherwise another thread may have
156   // updated it and we don't want to overwrite that value.  Don't
157   // bother trying to update it once it's nonzero but always make
158   // sure that the final parameter size agrees with what was passed.
159   if (_flags == 0) {
160     intx newflags = (value & parameter_size_mask);
161     Atomic::cmpxchg(&_flags, (intx)0, newflags);
162   }

115   Atomic::release_store(&_f1, f1);
116 }
117 
118 void ConstantPoolCacheEntry::set_indy_resolution_failed() {
119   Atomic::release_store(&_flags, _flags | (1 << indy_resolution_failed_shift));
120 }
121 
122 // Note that concurrent update of both bytecodes can leave one of them
123 // reset to zero.  This is harmless; the interpreter will simply re-resolve
124 // the damaged entry.  More seriously, the memory synchronization is needed
125 // to flush other fields (f1, f2) completely to memory before the bytecodes
126 // are updated, lest other processors see a non-zero bytecode but zero f1/f2.
127 void ConstantPoolCacheEntry::set_field(Bytecodes::Code get_code,
128                                        Bytecodes::Code put_code,
129                                        Klass* field_holder,
130                                        int field_index,
131                                        int field_offset,
132                                        TosState field_type,
133                                        bool is_final,
134                                        bool is_volatile,
135                                        bool is_tsan_ignore,
136                                        Klass* root_klass) {
137   set_f1(field_holder);
138   set_f2(field_offset);
139   assert((field_index & field_index_mask) == field_index,
140          "field index does not fit in low flag bits");
141   set_field_flags(field_type,
142                   ((is_volatile ? 1 : 0) << is_volatile_shift) |
143                   ((is_final    ? 1 : 0) << is_final_shift) |
144                   ((is_tsan_ignore ? 1 : 0) << is_tsan_ignore_shift),
145                   field_index);
146   set_bytecode_1(get_code);
147   set_bytecode_2(put_code);
148   NOT_PRODUCT(verify(tty));
149 }
150 
151 void ConstantPoolCacheEntry::set_parameter_size(int value) {
152   // This routine is called only in corner cases where the CPCE is not yet initialized.
153   // See AbstractInterpreter::deopt_continue_after_entry.
154   assert(_flags == 0 || parameter_size() == 0 || parameter_size() == value,
155          "size must not change: parameter_size=%d, value=%d", parameter_size(), value);
156   // Setting the parameter size by itself is only safe if the
157   // current value of _flags is 0, otherwise another thread may have
158   // updated it and we don't want to overwrite that value.  Don't
159   // bother trying to update it once it's nonzero but always make
160   // sure that the final parameter size agrees with what was passed.
161   if (_flags == 0) {
162     intx newflags = (value & parameter_size_mask);
163     Atomic::cmpxchg(&_flags, (intx)0, newflags);
164   }
< prev index next >