< prev index next >

src/hotspot/share/oops/cpCache.cpp

Print this page




 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   }




 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_flattened_field_shift) |
 143                   ((is_flattenable ? 1 : 0) << is_flattenable_field_shift),
 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 >