RFR: 8242440: use separate, destroyable JavaVM instances per libgraal compiler thread
Kim Barrett
kbarrett at openjdk.java.net
Mon Apr 18 04:42:51 UTC 2022
On Sun, 17 Apr 2022 09:04:10 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
>> src/hotspot/share/jvmci/jvmciRuntime.cpp line 1185:
>>
>>> 1183: JNIEnv* JVMCIRuntime::init_shared_library_javavm() {
>>> 1184: MutexLocker locker(_lock);
>>> 1185: JavaVM* javaVM = (JavaVM*) _shared_library_javavm;
>>
>> Pointless cast.
>
> Without that cast, I get this compiler error:
I forgot that `_shared_library_javavm` is declared `volatile JavaVM*`. So what's needed is a const_cast to discard the volatile. But why is it pointer to volatile? I'm not seeing any reason for that; the out argument for `JNI_CreateJavaVM` doesn't specify volatile. I wonder if it's supposed to instead be `JavaVM* volatile` to (attempt to, though maybe not correctly) support unlocked reads with concurrent locked writes?
-------------
PR: https://git.openjdk.java.net/jdk/pull/8262
More information about the hotspot-dev
mailing list