On Mon, 21 Sep 2026 15:57:14 GMT, Ashutosh Mehra <[email protected]> wrote:

>> Moved to `AOTCacheAccess::map_aot_code_region()`
>
> This is fine, but I was thinking these checks are not specific to AOTCode, 
> and if these checks fail then something is seriously wrong with mapping of 
> the AOTCache. We should not even reach this stage.
> 
> So my suggestion is to have these checks immediately after mapping the 
> AOTCache, perhaps in 
> `AOTMetaspace::initialize_runtime_shared_and_meta_spaces()` after the call to 
> `AOTMetaspace::set_aot_metaspace_range()`, like this:
> 
> 
> void AOTMetaspace::initialize_runtime_shared_and_meta_spaces() {
>     ...
>     set_aot_metaspace_range(cds_base, static_mapinfo->mapped_end(), cds_end);
>     guarantee(SharedBaseAddress == MetaspaceObj::aot_metaspace_base(), "must 
> be");
>     guarantee(MetaspaceObj::aot_metaspace_base() <= 
> MetaspaceObj::aot_metaspace_top(), "must be");
> 
> 
> Also note that `AOTMetaspace::set_aot_metaspace_range` already has the assert 
> for the mapped range:
> 
> void AOTMetaspace::set_aot_metaspace_range(void* base, void *static_top, 
> void* top) {                                                                  
>                                                                               
>                          
>   assert(base <= static_top && static_top <= top, "must be");                 
>                                                                               
>                                                                               
>                     
>   _aot_metaspace_static_top = static_top;                                     
>                                                                               
>                                                                               
>                     
>   MetaspaceObj::set_aot_metaspace_range(base, top);                           
>                                                                               
>                                                                               
>                     
> }

Thank you, @ashu-mehra, for suggestion. I will do that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30778#discussion_r4064573554

Reply via email to