RFR: 8340586: JdkJfrEvent::get_all_klasses stores non-strong oops in JNI handles [v3]
Axel Boldt-Christmas
aboldtch at openjdk.org
Tue Nov 5 15:20:47 UTC 2024
> JdkJfrEvent::get_all_klasses walks the class hierarchy of the Event class to find all event sub klasses. The mirrors of these classes are then stored in JNI handles and eventually transfered to an arraylist which is returned to the java caller.
>
> Because the klasses are found by walking the class hierarchy, their is no guarantee that the klass is strongly reachable, and thus that the java_mirror load is strong. So we must explicitly keep the klass alive (and not have a safepoint between the load and the store into the object graph).
>
> Having both `fill_klasses` and `transform_klasses_to_local_jni_handles` made the call to `keep_alive` and the comment explaining the reason why somewhat obscured, so I merged them. (The split seems to have served no purpose except to introduce the need for a lot of const and reinterpret casts.)
Axel Boldt-Christmas has updated the pull request incrementally with two additional commits since the last revision:
- Add Klass::java_mirror() comment.
- Fix comment
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/21893/files
- new: https://git.openjdk.org/jdk/pull/21893/files/f8ebdbf1..41adf48d
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=21893&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=21893&range=01-02
Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/21893.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21893/head:pull/21893
PR: https://git.openjdk.org/jdk/pull/21893
More information about the hotspot-dev
mailing list