34 template <typename T> class GrowableArray;
35 template <typename T> class Array;
36
37 // This class is used for transferring information from the AOTConfiguration file (aka the "preimage")
38 // to the JVM that creates the AOTCache (aka the "final image").
39 // - The recipes are recorded when CDSConfig::is_dumping_preimage_static_archive() is true.
40 // - The recipes are applied when CDSConfig::is_dumping_final_static_archive() is true.
41 // The following information are recorded:
42 // - The list of all classes that are stored in the AOTConfiguration file.
43 // - The list of all classes that require AOT resolution of invokedynamic call sites.
44 class FinalImageRecipes {
45 // A list of all the archived classes from the preimage. We want to transfer all of these
46 // into the final image.
47 Array<Klass*>* _all_klasses;
48
49 // The classes who have resolved at least one indy CP entry during the training run.
50 // _indy_cp_indices[i] is a list of all resolved CP entries for _indy_klasses[i].
51 Array<InstanceKlass*>* _indy_klasses;
52 Array<Array<int>*>* _indy_cp_indices;
53
54 FinalImageRecipes() : _indy_klasses(nullptr), _indy_cp_indices(nullptr) {}
55
56 void* operator new(size_t size) throw();
57
58 // Called when dumping preimage
59 void record_recipes_impl();
60
61 // Called when dumping final image
62 void apply_recipes_impl(TRAPS);
63 void load_all_classes(TRAPS);
64 void apply_recipes_for_invokedynamic(TRAPS);
65
66 public:
67 static void serialize(SerializeClosure* soc);
68
69 // Called when dumping preimage
70 static void record_recipes();
71
72 // Called when dumping final image
73 static void apply_recipes(TRAPS);
74 };
75
76 #endif // SHARE_CDS_FINALIMAGERECIPES_HPP
|
34 template <typename T> class GrowableArray;
35 template <typename T> class Array;
36
37 // This class is used for transferring information from the AOTConfiguration file (aka the "preimage")
38 // to the JVM that creates the AOTCache (aka the "final image").
39 // - The recipes are recorded when CDSConfig::is_dumping_preimage_static_archive() is true.
40 // - The recipes are applied when CDSConfig::is_dumping_final_static_archive() is true.
41 // The following information are recorded:
42 // - The list of all classes that are stored in the AOTConfiguration file.
43 // - The list of all classes that require AOT resolution of invokedynamic call sites.
44 class FinalImageRecipes {
45 // A list of all the archived classes from the preimage. We want to transfer all of these
46 // into the final image.
47 Array<Klass*>* _all_klasses;
48
49 // The classes who have resolved at least one indy CP entry during the training run.
50 // _indy_cp_indices[i] is a list of all resolved CP entries for _indy_klasses[i].
51 Array<InstanceKlass*>* _indy_klasses;
52 Array<Array<int>*>* _indy_cp_indices;
53
54 // The RefectionData for _reflect_klasses[i] should be initialized with _reflect_flags[i]
55 Array<InstanceKlass*>* _reflect_klasses;
56 Array<int>* _reflect_flags;
57
58 static GrowableArray<InstanceKlass*>* _tmp_reflect_klasses;
59 static GrowableArray<int>* _tmp_reflect_flags;
60
61 struct TmpDynamicProxyClassInfo {
62 int _loader_type;
63 int _access_flags;
64 const char* _proxy_name;
65 GrowableArray<Klass*>* _interfaces;
66 };
67
68 struct DynamicProxyClassInfo {
69 int _loader_type;
70 int _access_flags;
71 const char* _proxy_name;
72 Array<Klass*>* _interfaces;
73 };
74
75 Array<DynamicProxyClassInfo>* _dynamic_proxy_classes;
76
77 static GrowableArray<TmpDynamicProxyClassInfo>* _tmp_dynamic_proxy_classes;
78
79 FinalImageRecipes() : _indy_klasses(nullptr), _indy_cp_indices(nullptr),
80 _reflect_klasses(nullptr), _reflect_flags(nullptr),
81 _dynamic_proxy_classes(nullptr) {}
82
83
84 void* operator new(size_t size) throw();
85
86 // Called when dumping preimage
87 void record_recipes_impl();
88
89 // Called when dumping final image
90 void apply_recipes_impl(TRAPS);
91 void load_all_classes(TRAPS);
92 void apply_recipes_for_dynamic_proxies(TRAPS);
93 void apply_recipes_for_invokedynamic(TRAPS);
94 void apply_recipes_for_reflection_data(JavaThread* current);
95
96 public:
97 static void serialize(SerializeClosure* soc);
98
99 // Called when dumping preimage
100 static void add_dynamic_proxy_class(oop loader, const char* proxy_name, objArrayOop interfaces, int access_flags);
101 static void add_reflection_data_flags(InstanceKlass* ik, TRAPS);
102 static void record_recipes();
103
104 // Called when dumping final image
105 static void apply_recipes(TRAPS);
106 };
107
108 #endif // SHARE_CDS_FINALIMAGERECIPES_HPP
|