src/hotspot/share/oops/cpCache.cpp
changeset 59247 56bf71d64d51
parent 59056 15936b142f86
child 59252 623722a6aeb9
equal deleted inserted replaced
59246:fcad92f425c5 59247:56bf71d64d51
    95   // Read once.
    95   // Read once.
    96   volatile Bytecodes::Code c = bytecode_1();
    96   volatile Bytecodes::Code c = bytecode_1();
    97   assert(c == 0 || c == code || code == 0, "update must be consistent");
    97   assert(c == 0 || c == code || code == 0, "update must be consistent");
    98 #endif
    98 #endif
    99   // Need to flush pending stores here before bytecode is written.
    99   // Need to flush pending stores here before bytecode is written.
   100   OrderAccess::release_store(&_indices, _indices | ((u_char)code << bytecode_1_shift));
   100   Atomic::release_store(&_indices, _indices | ((u_char)code << bytecode_1_shift));
   101 }
   101 }
   102 
   102 
   103 void ConstantPoolCacheEntry::set_bytecode_2(Bytecodes::Code code) {
   103 void ConstantPoolCacheEntry::set_bytecode_2(Bytecodes::Code code) {
   104 #ifdef ASSERT
   104 #ifdef ASSERT
   105   // Read once.
   105   // Read once.
   106   volatile Bytecodes::Code c = bytecode_2();
   106   volatile Bytecodes::Code c = bytecode_2();
   107   assert(c == 0 || c == code || code == 0, "update must be consistent");
   107   assert(c == 0 || c == code || code == 0, "update must be consistent");
   108 #endif
   108 #endif
   109   // Need to flush pending stores here before bytecode is written.
   109   // Need to flush pending stores here before bytecode is written.
   110   OrderAccess::release_store(&_indices, _indices | ((u_char)code << bytecode_2_shift));
   110   Atomic::release_store(&_indices, _indices | ((u_char)code << bytecode_2_shift));
   111 }
   111 }
   112 
   112 
   113 // Sets f1, ordering with previous writes.
   113 // Sets f1, ordering with previous writes.
   114 void ConstantPoolCacheEntry::release_set_f1(Metadata* f1) {
   114 void ConstantPoolCacheEntry::release_set_f1(Metadata* f1) {
   115   assert(f1 != NULL, "");
   115   assert(f1 != NULL, "");
   116   OrderAccess::release_store(&_f1, f1);
   116   Atomic::release_store(&_f1, f1);
   117 }
   117 }
   118 
   118 
   119 void ConstantPoolCacheEntry::set_indy_resolution_failed() {
   119 void ConstantPoolCacheEntry::set_indy_resolution_failed() {
   120   OrderAccess::release_store(&_flags, _flags | (1 << indy_resolution_failed_shift));
   120   Atomic::release_store(&_flags, _flags | (1 << indy_resolution_failed_shift));
   121 }
   121 }
   122 
   122 
   123 // Note that concurrent update of both bytecodes can leave one of them
   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
   124 // reset to zero.  This is harmless; the interpreter will simply re-resolve
   125 // the damaged entry.  More seriously, the memory synchronization is needed
   125 // the damaged entry.  More seriously, the memory synchronization is needed