Thanks Dan!

   ping!

Regards
Hui

-----邮件原件-----
发件人: [email protected] <[email protected]> 
发送时间: 2021年2月23日 2:17
收件人: kalinshi(施慧) <[email protected]>; [email protected]; 
[email protected]; [email protected]
主题: Re: JvmtiExport::can_walk_any_space() usage in hotspot(Internet mail)

Adding serviceability-dev@... to this email thread since JVM/TI is maintained 
by the Serviceability Team...

Dan


On 2/22/21 3:29 AM, kalinshi(施慧) wrote:
> Hi hotspot experts,
>
> Would you help on my question about JvmtiExport::can_walk_any_space() check?
> Question is why JvmtiExport::can_walk_any_space() check is needed in CDS when 
> mapping region?
>
> JvmtiExport::can_walk_any_space() method is only used in 
> FileMapInfo::map_region for modifing region read-only mapping attribute.
> JvmtiExport::can_walk_any_space() is set true when 
> jvmtiCapabilities.can_tag_objects is enabled.
> JVMTI capability can_tag_objects enables java heap iteration/object reference 
> tracing, and JvmtiEnv::Set/GetTag doesn't modify read-only regions in shared 
> archive (I might wrong).
>
> comments in latest code seems outdated, JvmtiExport::can_walk_any_space() 
> doesn't disable sharing now.
> "
>    JvmtiExport::set_can_walk_any_space(
>      avail.can_tag_objects);   // disable sharing in onload phase
> "
>
> Back to initial code, class sharing is disabled when condition 
> JvmtiExport::can_modify_any_class() || JvmtiExport::can_walk_any_space() is 
> true.
> This matches above comment in JvmtiManageCapabilities::update.
> "
>    if (JvmtiExport::can_modify_any_class() || 
> JvmtiExport::can_walk_any_space()) {
>      fail_continue("Tool agent requires sharing to be disabled.");
>      return false;
>    }
> "
>
> JvmtiExport::can_modify_any_class condition disables class data sharing when 
> class file load hook (requires modify code and read only contents) is needed 
> in initial code.
> Both checks are removed and used to determine region read/write attribute 
> with following commits. These commits are mainly supporting class file load 
> hook with CDS.
>
> 1. enable shared class when these tow checks on, modify/map all regions in 
> shared archive as RW.
>     8054386: Allow Java debugging when CDS is enabled Map archive RW when 
> debugging is enabled
>     8087153: EXCEPTION_ACCESS_VIOLATION when CDS RO section vanished 
> on win32
>     
> 2. Support class file load hook with CDS
>     8141341: CDS should be disabled if 
> JvmtiExport::should_post_class_file_load_hook() is true Disable loading 
> shared class if JvmtiExport::should_post_class_file_load_hook is true.
>     8078644: CDS needs to support JVMTI CFLH Support posting CLFH for shared 
> classes.
>     
> 3. Fix jvmtiCapabilities::can_generate_all_class_hook_events inconsistent 
> state when shared
>     8161605: The '!UseSharedSpaces' check is not need in 
> JvmtiManageCapabilities::recompute_always_capabilities
>     
> 4. Fix class file load hook error for early class hook event when shared
>     8212200: assert when shared java.lang.Object is redefined by JVMTI 
> agent
>
> Regards
> Hui


Reply via email to