@@ -174,18 +174,20 @@ class Klass : public Metadata {
174174
175175#if INCLUDE_CDS
176176 // Various attributes for shared classes. Should be zero for a non-shared class.
177- u2 _shared_class_flags ;
178- enum CDSSharedClassFlags {
177+ u2 _aot_class_flags ;
178+ enum {
179179 _in_aot_cache = 1 << 0 ,
180180 _archived_lambda_proxy_is_available = 1 << 1 ,
181181 _has_value_based_class_annotation = 1 << 2 ,
182182 _verified_at_dump_time = 1 << 3 ,
183183 _has_archived_enum_objs = 1 << 4 ,
184- // This class was not loaded from a classfile in the module image
185- // or classpath.
186- _is_generated_shared_class = 1 << 5 ,
187- // archived mirror already initialized by AOT-cache assembly: no further need to call <clinit>
188- _has_aot_initialized_mirror = 1 << 6 ,
184+ _is_aot_generated_class = 1 << 5 , // this class was not loaded from a classfile in the module image
185+ // or classpath, but was generated during AOT cache assembly.
186+ _has_aot_initialized_mirror = 1 << 6 , // archived mirror already initialized by AOT cache assembly.
187+ // no further need to call <clinit>
188+ _has_aot_safe_initializer = 1 << 7 , // has @AOTSafeClassInitializer annotation
189+ _is_runtime_setup_required = 1 << 8 , // has a runtimeSetup method to be called when
190+ // this class is loaded from AOT cache
189191 };
190192#endif
191193
@@ -325,66 +327,84 @@ class Klass : public Metadata {
325327 void clear_archived_mirror_index () NOT_CDS_JAVA_HEAP_RETURN;
326328
327329 void set_lambda_proxy_is_available () {
328- CDS_ONLY (_shared_class_flags |= _archived_lambda_proxy_is_available;)
330+ CDS_ONLY (_aot_class_flags |= _archived_lambda_proxy_is_available;)
329331 }
330332 void clear_lambda_proxy_is_available () {
331- CDS_ONLY (_shared_class_flags &= (u2)(~_archived_lambda_proxy_is_available);)
333+ CDS_ONLY (_aot_class_flags &= (u2)(~_archived_lambda_proxy_is_available);)
332334 }
333335 bool lambda_proxy_is_available () const {
334- CDS_ONLY (return (_shared_class_flags & _archived_lambda_proxy_is_available) != 0 ;)
336+ CDS_ONLY (return (_aot_class_flags & _archived_lambda_proxy_is_available) != 0 ;)
335337 NOT_CDS (return false ;)
336338 }
337339
338340 void set_has_value_based_class_annotation () {
339- CDS_ONLY (_shared_class_flags |= _has_value_based_class_annotation;)
341+ CDS_ONLY (_aot_class_flags |= _has_value_based_class_annotation;)
340342 }
341343 void clear_has_value_based_class_annotation () {
342- CDS_ONLY (_shared_class_flags &= (u2)(~_has_value_based_class_annotation);)
344+ CDS_ONLY (_aot_class_flags &= (u2)(~_has_value_based_class_annotation);)
343345 }
344346 bool has_value_based_class_annotation () const {
345- CDS_ONLY (return (_shared_class_flags & _has_value_based_class_annotation) != 0 ;)
347+ CDS_ONLY (return (_aot_class_flags & _has_value_based_class_annotation) != 0 ;)
346348 NOT_CDS (return false ;)
347349 }
348350
349351 void set_verified_at_dump_time () {
350- CDS_ONLY (_shared_class_flags |= _verified_at_dump_time;)
352+ CDS_ONLY (_aot_class_flags |= _verified_at_dump_time;)
351353 }
352354 bool verified_at_dump_time () const {
353- CDS_ONLY (return (_shared_class_flags & _verified_at_dump_time) != 0 ;)
355+ CDS_ONLY (return (_aot_class_flags & _verified_at_dump_time) != 0 ;)
354356 NOT_CDS (return false ;)
355357 }
356358
357359 void set_has_archived_enum_objs () {
358- CDS_ONLY (_shared_class_flags |= _has_archived_enum_objs;)
360+ CDS_ONLY (_aot_class_flags |= _has_archived_enum_objs;)
359361 }
360362 bool has_archived_enum_objs () const {
361- CDS_ONLY (return (_shared_class_flags & _has_archived_enum_objs) != 0 ;)
363+ CDS_ONLY (return (_aot_class_flags & _has_archived_enum_objs) != 0 ;)
362364 NOT_CDS (return false ;)
363365 }
364366
365- void set_is_generated_shared_class () {
366- CDS_ONLY (_shared_class_flags |= _is_generated_shared_class ;)
367+ void set_is_aot_generated_class () {
368+ CDS_ONLY (_aot_class_flags |= _is_aot_generated_class ;)
367369 }
368- bool is_generated_shared_class () const {
369- CDS_ONLY (return (_shared_class_flags & _is_generated_shared_class ) != 0 ;)
370+ bool is_aot_generated_class () const {
371+ CDS_ONLY (return (_aot_class_flags & _is_aot_generated_class ) != 0 ;)
370372 NOT_CDS (return false ;)
371373 }
372374
373375 void set_has_aot_initialized_mirror () {
374- CDS_ONLY (_shared_class_flags |= _has_aot_initialized_mirror;)
376+ CDS_ONLY (_aot_class_flags |= _has_aot_initialized_mirror;)
375377 }
376378 bool has_aot_initialized_mirror () const {
377- CDS_ONLY (return (_shared_class_flags & _has_aot_initialized_mirror) != 0 ;)
379+ CDS_ONLY (return (_aot_class_flags & _has_aot_initialized_mirror) != 0 ;)
380+ NOT_CDS (return false ;)
381+ }
382+
383+ // Indicates presence of @AOTSafeClassInitializer. Also see AOTClassInitializer for more details.
384+ void set_has_aot_safe_initializer () {
385+ CDS_ONLY (_aot_class_flags |= _has_aot_safe_initializer;)
386+ }
387+ bool has_aot_safe_initializer () const {
388+ CDS_ONLY (return (_aot_class_flags & _has_aot_safe_initializer) != 0 ;)
389+ NOT_CDS (return false ;)
390+ }
391+
392+ // Indicates @AOTRuntimeSetup private static void runtimeSetup() presence.
393+ void set_is_runtime_setup_required () {
394+ CDS_ONLY (_aot_class_flags |= _is_runtime_setup_required;)
395+ }
396+ bool is_runtime_setup_required () const {
397+ CDS_ONLY (return (_aot_class_flags & _is_runtime_setup_required) != 0 ;)
378398 NOT_CDS (return false ;)
379399 }
380400
381401 bool in_aot_cache () const { // shadows MetaspaceObj::in_aot_cache)()
382- CDS_ONLY (return (_shared_class_flags & _in_aot_cache) != 0 ;)
402+ CDS_ONLY (return (_aot_class_flags & _in_aot_cache) != 0 ;)
383403 NOT_CDS (return false ;)
384404 }
385405
386406 void set_in_aot_cache () {
387- CDS_ONLY (_shared_class_flags |= _in_aot_cache;)
407+ CDS_ONLY (_aot_class_flags |= _in_aot_cache;)
388408 }
389409
390410 // Obtain the module or package for this class
0 commit comments