On Mon, 21 Sep 2026 17:12:40 GMT, Vladimir Kozlov <[email protected]> wrote:

>> 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.

Done.

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

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

Reply via email to