src/share/vm/oops/cpCacheOop.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7086585 Sdiff src/share/vm/oops

src/share/vm/oops/cpCacheOop.cpp

Print this page




 111 #ifdef ASSERT
 112 // It is possible to have two different dummy methodOops created
 113 // when the resolve code for invoke interface executes concurrently
 114 // Hence the assertion below is weakened a bit for the invokeinterface
 115 // case.
 116 bool ConstantPoolCacheEntry::same_methodOop(oop cur_f1, oop f1) {
 117   return (cur_f1 == f1 || ((methodOop)cur_f1)->name() ==
 118          ((methodOop)f1)->name() || ((methodOop)cur_f1)->signature() ==
 119          ((methodOop)f1)->signature());
 120 }
 121 #endif
 122 
 123 // Note that concurrent update of both bytecodes can leave one of them
 124 // reset to zero.  This is harmless; the interpreter will simply re-resolve
 125 // the damaged entry.  More seriously, the memory synchronization is needed
 126 // to flush other fields (f1, f2) completely to memory before the bytecodes
 127 // are updated, lest other processors see a non-zero bytecode but zero f1/f2.
 128 void ConstantPoolCacheEntry::set_field(Bytecodes::Code get_code,
 129                                        Bytecodes::Code put_code,
 130                                        KlassHandle field_holder,
 131                                        int orig_field_index,
 132                                        int field_offset,
 133                                        TosState field_type,
 134                                        bool is_final,
 135                                        bool is_volatile) {
 136   set_f1(field_holder()->java_mirror());
 137   set_f2(field_offset);
 138   // The field index is used by jvm/ti and is the index into fields() array
 139   // in holder instanceKlass.  This is scaled by instanceKlass::next_offset.
 140   assert((orig_field_index % instanceKlass::next_offset) == 0, "wierd index");
 141   const int field_index = orig_field_index / instanceKlass::next_offset;
 142   assert(field_index <= field_index_mask,
 143          "field index does not fit in low flag bits");
 144   set_flags(as_flags(field_type, is_final, false, is_volatile, false, false) |
 145             (field_index & field_index_mask));
 146   set_bytecode_1(get_code);
 147   set_bytecode_2(put_code);
 148   NOT_PRODUCT(verify(tty));
 149 }
 150 
 151 int  ConstantPoolCacheEntry::field_index() const {
 152   return (_flags & field_index_mask) * instanceKlass::next_offset;
 153 }
 154 
 155 void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
 156                                         methodHandle method,
 157                                         int vtable_index) {
 158   assert(!is_secondary_entry(), "");
 159   assert(method->interpreter_entry() != NULL, "should have been set at this point");
 160   assert(!method->is_obsolete(),  "attempt to write obsolete method to cpCache");
 161   bool change_to_virtual = (invoke_code == Bytecodes::_invokeinterface);
 162 
 163   int byte_no = -1;
 164   bool needs_vfinal_flag = false;
 165   switch (invoke_code) {
 166     case Bytecodes::_invokevirtual:
 167     case Bytecodes::_invokeinterface: {
 168         if (method->can_be_statically_bound()) {
 169           set_f2((intptr_t)method());
 170           needs_vfinal_flag = true;
 171         } else {
 172           assert(vtable_index >= 0, "valid index");




 111 #ifdef ASSERT
 112 // It is possible to have two different dummy methodOops created
 113 // when the resolve code for invoke interface executes concurrently
 114 // Hence the assertion below is weakened a bit for the invokeinterface
 115 // case.
 116 bool ConstantPoolCacheEntry::same_methodOop(oop cur_f1, oop f1) {
 117   return (cur_f1 == f1 || ((methodOop)cur_f1)->name() ==
 118          ((methodOop)f1)->name() || ((methodOop)cur_f1)->signature() ==
 119          ((methodOop)f1)->signature());
 120 }
 121 #endif
 122 
 123 // Note that concurrent update of both bytecodes can leave one of them
 124 // reset to zero.  This is harmless; the interpreter will simply re-resolve
 125 // the damaged entry.  More seriously, the memory synchronization is needed
 126 // to flush other fields (f1, f2) completely to memory before the bytecodes
 127 // are updated, lest other processors see a non-zero bytecode but zero f1/f2.
 128 void ConstantPoolCacheEntry::set_field(Bytecodes::Code get_code,
 129                                        Bytecodes::Code put_code,
 130                                        KlassHandle field_holder,
 131                                        int field_index,
 132                                        int field_offset,
 133                                        TosState field_type,
 134                                        bool is_final,
 135                                        bool is_volatile) {
 136   set_f1(field_holder()->java_mirror());
 137   set_f2(field_offset);




 138   assert(field_index <= field_index_mask,
 139          "field index does not fit in low flag bits");
 140   set_flags(as_flags(field_type, is_final, false, is_volatile, false, false) |
 141             (field_index & field_index_mask));
 142   set_bytecode_1(get_code);
 143   set_bytecode_2(put_code);
 144   NOT_PRODUCT(verify(tty));
 145 }
 146 
 147 int  ConstantPoolCacheEntry::field_index() const {
 148   return (_flags & field_index_mask);
 149 }
 150 
 151 void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
 152                                         methodHandle method,
 153                                         int vtable_index) {
 154   assert(!is_secondary_entry(), "");
 155   assert(method->interpreter_entry() != NULL, "should have been set at this point");
 156   assert(!method->is_obsolete(),  "attempt to write obsolete method to cpCache");
 157   bool change_to_virtual = (invoke_code == Bytecodes::_invokeinterface);
 158 
 159   int byte_no = -1;
 160   bool needs_vfinal_flag = false;
 161   switch (invoke_code) {
 162     case Bytecodes::_invokevirtual:
 163     case Bytecodes::_invokeinterface: {
 164         if (method->can_be_statically_bound()) {
 165           set_f2((intptr_t)method());
 166           needs_vfinal_flag = true;
 167         } else {
 168           assert(vtable_index >= 0, "valid index");


src/share/vm/oops/cpCacheOop.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File