188 assert((resolved_klass_index & 0xffff0000) == 0, "must be"); 189 *int_at_addr(class_index) = 190 build_int_from_shorts((jushort)resolved_klass_index, (jushort)name_index); 191 192 symbol_at_put(name_index, name); 193 name->increment_refcount(); 194 Klass** adr = resolved_klasses()->adr_at(resolved_klass_index); 195 OrderAccess::release_store_ptr((Klass* volatile *)adr, k); 196 197 // The interpreter assumes when the tag is stored, the klass is resolved 198 // and the Klass* non-NULL, so we need hardware store ordering here. 199 if (k != NULL) { 200 release_tag_at_put(class_index, JVM_CONSTANT_Class); 201 } else { 202 release_tag_at_put(class_index, JVM_CONSTANT_UnresolvedClass); 203 } 204 } 205 206 // Anonymous class support: 207 void ConstantPool::klass_at_put(int class_index, Klass* k) { 208 CPKlassSlot kslot = klass_slot_at(class_index); 209 int resolved_klass_index = kslot.resolved_klass_index(); 210 int name_index = kslot.name_index(); 211 Symbol* name = symbol_at(name_index); 212 guarantee(name == k->name(), "Invalid class name for anonymous"); 213 214 Klass** adr = resolved_klasses()->adr_at(resolved_klass_index); 215 OrderAccess::release_store_ptr((Klass* volatile *)adr, k); 216 } 217 218 // CDS support. Create a new resolved_references array. 219 void ConstantPool::restore_unshareable_info(TRAPS) { 220 assert(is_constantPool(), "ensure C++ vtable is restored"); 221 assert(on_stack(), "should always be set for shared constant pools"); 222 assert(is_shared(), "should always be set for shared constant pools"); 223 224 // Only create the new resolved references array if it hasn't been attempted before 225 if (resolved_references() != NULL) return; 226 227 // restore the C++ vtable from the shared archive 228 restore_vtable(); 229 230 if (SystemDictionary::Object_klass_loaded()) { 231 // Recreate the object array and add to ClassLoaderData. 232 int map_length = resolved_reference_length(); 233 if (map_length > 0) { 234 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK); 235 Handle refs_handle (THREAD, (oop)stom); // must handleize. | 188 assert((resolved_klass_index & 0xffff0000) == 0, "must be"); 189 *int_at_addr(class_index) = 190 build_int_from_shorts((jushort)resolved_klass_index, (jushort)name_index); 191 192 symbol_at_put(name_index, name); 193 name->increment_refcount(); 194 Klass** adr = resolved_klasses()->adr_at(resolved_klass_index); 195 OrderAccess::release_store_ptr((Klass* volatile *)adr, k); 196 197 // The interpreter assumes when the tag is stored, the klass is resolved 198 // and the Klass* non-NULL, so we need hardware store ordering here. 199 if (k != NULL) { 200 release_tag_at_put(class_index, JVM_CONSTANT_Class); 201 } else { 202 release_tag_at_put(class_index, JVM_CONSTANT_UnresolvedClass); 203 } 204 } 205 206 // Anonymous class support: 207 void ConstantPool::klass_at_put(int class_index, Klass* k) { 208 assert(k != NULL, "must be valid klass"); 209 CPKlassSlot kslot = klass_slot_at(class_index); 210 int resolved_klass_index = kslot.resolved_klass_index(); 211 Klass** adr = resolved_klasses()->adr_at(resolved_klass_index); 212 OrderAccess::release_store_ptr((Klass* volatile *)adr, k); 213 214 // The interpreter assumes when the tag is stored, the klass is resolved 215 // and the Klass* non-NULL, so we need hardware store ordering here. 216 release_tag_at_put(class_index, JVM_CONSTANT_Class); 217 } 218 219 // CDS support. Create a new resolved_references array. 220 void ConstantPool::restore_unshareable_info(TRAPS) { 221 assert(is_constantPool(), "ensure C++ vtable is restored"); 222 assert(on_stack(), "should always be set for shared constant pools"); 223 assert(is_shared(), "should always be set for shared constant pools"); 224 225 // Only create the new resolved references array if it hasn't been attempted before 226 if (resolved_references() != NULL) return; 227 228 // restore the C++ vtable from the shared archive 229 restore_vtable(); 230 231 if (SystemDictionary::Object_klass_loaded()) { 232 // Recreate the object array and add to ClassLoaderData. 233 int map_length = resolved_reference_length(); 234 if (map_length > 0) { 235 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK); 236 Handle refs_handle (THREAD, (oop)stom); // must handleize. |