60 const char* _name;
61 address _code;
62 aot_metadata* _meta;
63 jlong* _state_adr;
64 address _metadata_table;
65 int _metadata_size;
66 } AOTMethodData;
67
68 typedef struct {
69 int _got_index;
70 int _class_id;
71 int _compiled_methods_offset;
72 int _dependent_methods_offset;
73 uint64_t _fingerprint;
74 } AOTKlassData;
75
76 typedef struct {
77 int _version;
78 int _class_count;
79 int _method_count;
80 int _metaspace_got_size;
81 int _metadata_got_size;
82 int _oop_got_size;
83 int _jvm_version_offset;
84
85 enum {
86 AOT_SHARED_VERSION = 1
87 };
88 } AOTHeader;
89
90 typedef struct {
91 enum { CONFIG_SIZE = 7 * jintSize + 11 };
92 // 7 int values
93 int _config_size;
94 int _narrowOopShift;
95 int _narrowKlassShift;
96 int _contendedPaddingWidth;
97 int _fieldsAllocationStyle;
98 int _objectAlignment;
99 int _codeSegmentSize;
100 // byte[11] array map to boolean values here
163 int _aot_id;
164
165 int _class_count;
166 int _method_count;
167 AOTClass* _classes;
168 CodeToAMethod* _code_to_aot;
169
170 address _code_space;
171 address _code_segments;
172 jlong* _method_state;
173
174
175 // Collect metaspace info: names -> address in .got section
176 const char* _metaspace_names;
177 address _method_metadata;
178
179 address _methods_offsets;
180 address _klasses_offsets;
181 address _dependencies;
182
183 Metadata** _metaspace_got;
184 Metadata** _metadata_got;
185 oop* _oop_got;
186
187 int _metaspace_got_size;
188 int _metadata_got_size;
189 int _oop_got_size;
190
191 // Collect stubs info
192 int* _stubs_offsets;
193
194 bool _lib_symbols_initialized;
195
196 void adjust_boundaries(AOTCompiledMethod* method) {
197 char* low = (char*)method->code_begin();
198 if (low < low_boundary()) {
199 _memory.set_low_boundary(low);
200 _memory.set_low(low);
201 }
202 char* high = (char *)method->code_end();
203 if (high > high_boundary()) {
204 _memory.set_high_boundary(high);
205 _memory.set_high(high);
206 }
207 assert(_method_count > 0, "methods count should be set already");
234 virtual void* first() const;
235 virtual void* next(void *p) const;
236
237 AOTKlassData* find_klass(InstanceKlass* ik);
238 bool load_klass_data(InstanceKlass* ik, Thread* thread);
239 Klass* get_klass_from_got(const char* klass_name, int klass_len, const Method* method);
240 void sweep_dependent_methods(AOTKlassData* klass_data);
241 bool is_dependent_method(Klass* dependee, AOTCompiledMethod* aot);
242
243 const char* get_name_at(int offset) {
244 return _metaspace_names + offset;
245 }
246
247 void oops_do(OopClosure* f);
248 void metadata_do(void f(Metadata*));
249 void got_metadata_do(void f(Metadata*));
250
251 #ifdef ASSERT
252 bool got_contains(Metadata **p) {
253 return (p >= &_metadata_got[0] && p < &_metadata_got[_metadata_got_size]) ||
254 (p >= &_metaspace_got[0] && p < &_metaspace_got[_metaspace_got_size]);
255 }
256 #endif
257
258 int dso_id() const { return _lib->id(); }
259 int aot_id() const { return _aot_id; }
260
261 int method_count() { return _method_count; }
262
263 AOTCompiledMethod* get_code_desc_at_index(int index) {
264 if (index < _method_count && _code_to_aot[index]._state == in_use) {
265 AOTCompiledMethod* m = _code_to_aot[index]._aot;
266 assert(m != NULL, "AOT method should be set");
267 if (!m->is_runtime_stub()) {
268 return m;
269 }
270 }
271 return NULL;
272 }
273
274 static Method* find_method(Klass* klass, Thread* thread, const char* method_name);
|
60 const char* _name;
61 address _code;
62 aot_metadata* _meta;
63 jlong* _state_adr;
64 address _metadata_table;
65 int _metadata_size;
66 } AOTMethodData;
67
68 typedef struct {
69 int _got_index;
70 int _class_id;
71 int _compiled_methods_offset;
72 int _dependent_methods_offset;
73 uint64_t _fingerprint;
74 } AOTKlassData;
75
76 typedef struct {
77 int _version;
78 int _class_count;
79 int _method_count;
80 int _klasses_got_size;
81 int _metadata_got_size;
82 int _oop_got_size;
83 int _jvm_version_offset;
84
85 enum {
86 AOT_SHARED_VERSION = 1
87 };
88 } AOTHeader;
89
90 typedef struct {
91 enum { CONFIG_SIZE = 7 * jintSize + 11 };
92 // 7 int values
93 int _config_size;
94 int _narrowOopShift;
95 int _narrowKlassShift;
96 int _contendedPaddingWidth;
97 int _fieldsAllocationStyle;
98 int _objectAlignment;
99 int _codeSegmentSize;
100 // byte[11] array map to boolean values here
163 int _aot_id;
164
165 int _class_count;
166 int _method_count;
167 AOTClass* _classes;
168 CodeToAMethod* _code_to_aot;
169
170 address _code_space;
171 address _code_segments;
172 jlong* _method_state;
173
174
175 // Collect metaspace info: names -> address in .got section
176 const char* _metaspace_names;
177 address _method_metadata;
178
179 address _methods_offsets;
180 address _klasses_offsets;
181 address _dependencies;
182
183 Metadata** _klasses_got;
184 Metadata** _metadata_got;
185 oop* _oop_got;
186
187 int _klasses_got_size;
188 int _metadata_got_size;
189 int _oop_got_size;
190
191 // Collect stubs info
192 int* _stubs_offsets;
193
194 bool _lib_symbols_initialized;
195
196 void adjust_boundaries(AOTCompiledMethod* method) {
197 char* low = (char*)method->code_begin();
198 if (low < low_boundary()) {
199 _memory.set_low_boundary(low);
200 _memory.set_low(low);
201 }
202 char* high = (char *)method->code_end();
203 if (high > high_boundary()) {
204 _memory.set_high_boundary(high);
205 _memory.set_high(high);
206 }
207 assert(_method_count > 0, "methods count should be set already");
234 virtual void* first() const;
235 virtual void* next(void *p) const;
236
237 AOTKlassData* find_klass(InstanceKlass* ik);
238 bool load_klass_data(InstanceKlass* ik, Thread* thread);
239 Klass* get_klass_from_got(const char* klass_name, int klass_len, const Method* method);
240 void sweep_dependent_methods(AOTKlassData* klass_data);
241 bool is_dependent_method(Klass* dependee, AOTCompiledMethod* aot);
242
243 const char* get_name_at(int offset) {
244 return _metaspace_names + offset;
245 }
246
247 void oops_do(OopClosure* f);
248 void metadata_do(void f(Metadata*));
249 void got_metadata_do(void f(Metadata*));
250
251 #ifdef ASSERT
252 bool got_contains(Metadata **p) {
253 return (p >= &_metadata_got[0] && p < &_metadata_got[_metadata_got_size]) ||
254 (p >= &_klasses_got[0] && p < &_klasses_got[_klasses_got_size]);
255 }
256 #endif
257
258 int dso_id() const { return _lib->id(); }
259 int aot_id() const { return _aot_id; }
260
261 int method_count() { return _method_count; }
262
263 AOTCompiledMethod* get_code_desc_at_index(int index) {
264 if (index < _method_count && _code_to_aot[index]._state == in_use) {
265 AOTCompiledMethod* m = _code_to_aot[index]._aot;
266 assert(m != NULL, "AOT method should be set");
267 if (!m->is_runtime_stub()) {
268 return m;
269 }
270 }
271 return NULL;
272 }
273
274 static Method* find_method(Klass* klass, Thread* thread, const char* method_name);
|