RFR: 8307315: Missing ResourceMark in CDS and JVMTI code [v2]

Ioi Lam iklam at openjdk.org
Tue May 16 01:09:48 UTC 2023


On Mon, 15 May 2023 18:39:43 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Please review this simple fix for adding a missing `ResourceMark` in `KlassFactory::check_shared_class_file_load_hook` which is a common caller of `FileMapInfo::open_stream_for_jvmti` and `JvmtiClassFileLoadHookPoster::post_to_env `(indirectly via `JvmtiExport::post_class_file_load_hook`).
>> 
>> Passed tiers 1 - 3 testing.
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   add a comment

LGTM. Just a nit about the comment.

src/hotspot/share/classfile/klassFactory.cpp line 57:

> 55:   assert(ik->is_shared(), "expecting a shared class");
> 56:   if (JvmtiExport::should_post_class_file_load_hook()) {
> 57:     // Caller needs a ResourceMark because parts of the returned cfs are resource-allocated.

I think this comment should be placed in filemap.hpp above the declaration of `FileMapInfo::open_stream_for_jvmti()`. We use the same convention for other functions that needs the caller to create the ResourceMark.

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

Marked as reviewed by iklam (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13992#pullrequestreview-1427551061
PR Review Comment: https://git.openjdk.org/jdk/pull/13992#discussion_r1194493865


More information about the hotspot-runtime-dev mailing list