RFR: 8309240: Array classes should be stored in dynamic CDS archive [v3]

Calvin Cheung ccheung at openjdk.org
Thu Jul 27 23:05:51 UTC 2023


On Thu, 27 Jul 2023 22:50:23 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/cds/dynamicArchive.cpp line 435:
>> 
>>> 433:       if (elm->is_instance_klass()) {
>>> 434:         assert(InstanceKlass::cast(elm)->array_klasses() == nullptr, "must be");
>>> 435:         InstanceKlass::cast(elm)->release_set_array_klasses(oak);
>> 
>> I know you were asked to use this here but a release operation only has meaning when paired with an acquire - so where is the matching acquire?
>
> I don't know if this code is run at a safepoint, but because of this bug https://bugs.openjdk.org/browse/JDK-8308745, we can't use a lock to allocate objArrayKlass, so we'll likely need the matching acquire when we fix that.

The code in question is being called during VM startup.

DynamicArchive::setup_array_klasses() : void
	MetaspaceShared::initialize_shared_spaces() : void
		universe_init() : jint
			init_globals() : jint
				Threads::create_vm(JavaVMInitArgs *, bool *) : jint
					JNI_CreateJavaVM_inner(JavaVM * *, void * *, void *) : jint
						JNI_CreateJavaVM(JavaVM * *, void * *, void *) : jint

Maybe it is safe not to use the "release_" version for setting `array_klasses`?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14959#discussion_r1276905901


More information about the hotspot-runtime-dev mailing list