< prev index next >

src/hotspot/share/oops/cpCache.cpp

Print this page




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

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

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




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


< prev index next >