217
218 private:
219
220 // The fake offsets are added by the class loader when java.lang.Class is loaded
221
222 static int _klass_offset;
223 static int _array_klass_offset;
224
225 static int _oop_size_offset;
226 static int _static_oop_field_count_offset;
227
228 static int _protection_domain_offset;
229 static int _signers_offset;
230 static int _class_loader_offset;
231 static int _module_offset;
232 static int _component_mirror_offset;
233 static int _name_offset;
234 static int _source_file_offset;
235 static int _classData_offset;
236 static int _classRedefinedCount_offset;
237
238 static bool _offsets_computed;
239
240 static GrowableArray<Klass*>* _fixup_mirror_list;
241 static GrowableArray<Klass*>* _fixup_module_field_list;
242
243 static void set_protection_domain(oop java_class, oop protection_domain);
244 static void set_class_loader(oop java_class, oop class_loader);
245 static void set_component_mirror(oop java_class, oop comp_mirror);
246 static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
247 Handle classData, TRAPS);
248 static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
249 public:
250 static void allocate_fixup_lists();
251 static void compute_offsets();
252
253 // Instance creation
254 static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
255 Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
256 static void create_mirror(Klass* k, Handle class_loader, Handle module,
281 static BasicType primitive_type(oop java_class);
282 static oop primitive_mirror(BasicType t);
283 // JVM_NewArray support
284 static Klass* array_klass_acquire(oop java_class);
285 static void release_set_array_klass(oop java_class, Klass* klass);
286 // compiler support for class operations
287 static int klass_offset() { CHECK_INIT(_klass_offset); }
288 static int array_klass_offset() { CHECK_INIT(_array_klass_offset); }
289 // Support for classRedefinedCount field
290 static int classRedefinedCount(oop the_class_mirror);
291 static void set_classRedefinedCount(oop the_class_mirror, int value);
292
293 // Support for embedded per-class oops
294 static oop protection_domain(oop java_class);
295 static oop component_mirror(oop java_class);
296 static objArrayOop signers(oop java_class);
297 static void set_signers(oop java_class, objArrayOop signers);
298 static oop class_data(oop java_class);
299 static void set_class_data(oop java_class, oop classData);
300
301 static int component_mirror_offset() { return _component_mirror_offset; }
302
303 static oop class_loader(oop java_class);
304 static void set_module(oop java_class, oop module);
305 static oop module(oop java_class);
306
307 static oop name(Handle java_class, TRAPS);
308
309 static oop source_file(oop java_class);
310 static void set_source_file(oop java_class, oop source_file);
311
312 static size_t oop_size(oop java_class);
313 static void set_oop_size(HeapWord* java_class, size_t size);
314 static int static_oop_field_count(oop java_class);
315 static void set_static_oop_field_count(oop java_class, int size);
316
317 static GrowableArray<Klass*>* fixup_mirror_list() {
318 return _fixup_mirror_list;
319 }
320 static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
608
609 static void print_stack_element(outputStream *st, Method* method, int bci);
610
611 static void compute_offsets();
612 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
613
614 // Allocate space for backtrace (created but stack trace not filled in)
615 static void allocate_backtrace(Handle throwable, TRAPS);
616 // Fill in current stack trace for throwable with preallocated backtrace (no GC)
617 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
618 // Fill in current stack trace, can cause GC
619 static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
620 static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
621
622 // Programmatic access to stack trace
623 static void get_stack_trace_elements(int depth, Handle backtrace, objArrayHandle stack_trace, TRAPS);
624
625 // For recreating class initialization error exceptions.
626 static Handle create_initialization_error(JavaThread* current, Handle throwable);
627
628 // Printing
629 static void print(oop throwable, outputStream* st);
630 static void print_stack_trace(Handle throwable, outputStream* st);
631 static void java_printStackTrace(Handle throwable, TRAPS);
632 // Debugging
633 friend class JavaClasses;
634 // Gets the method and bci of the top frame (TOS). Returns false if this failed.
635 static bool get_top_method_and_bci(oop throwable, Method** method, int* bci);
636 };
637
638
639 // Interface to java.lang.reflect.AccessibleObject objects
640
641 class java_lang_reflect_AccessibleObject: AllStatic {
642 private:
643 // Note that to reduce dependencies on the JDK we compute these
644 // offsets at run-time.
645 static int _override_offset;
646
647 static void compute_offsets();
648
|
217
218 private:
219
220 // The fake offsets are added by the class loader when java.lang.Class is loaded
221
222 static int _klass_offset;
223 static int _array_klass_offset;
224
225 static int _oop_size_offset;
226 static int _static_oop_field_count_offset;
227
228 static int _protection_domain_offset;
229 static int _signers_offset;
230 static int _class_loader_offset;
231 static int _module_offset;
232 static int _component_mirror_offset;
233 static int _name_offset;
234 static int _source_file_offset;
235 static int _classData_offset;
236 static int _classRedefinedCount_offset;
237 static int _reflectionData_offset;
238
239 static bool _offsets_computed;
240
241 static GrowableArray<Klass*>* _fixup_mirror_list;
242 static GrowableArray<Klass*>* _fixup_module_field_list;
243
244 static void set_protection_domain(oop java_class, oop protection_domain);
245 static void set_class_loader(oop java_class, oop class_loader);
246 static void set_component_mirror(oop java_class, oop comp_mirror);
247 static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
248 Handle classData, TRAPS);
249 static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
250 public:
251 static void allocate_fixup_lists();
252 static void compute_offsets();
253
254 // Instance creation
255 static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
256 Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
257 static void create_mirror(Klass* k, Handle class_loader, Handle module,
282 static BasicType primitive_type(oop java_class);
283 static oop primitive_mirror(BasicType t);
284 // JVM_NewArray support
285 static Klass* array_klass_acquire(oop java_class);
286 static void release_set_array_klass(oop java_class, Klass* klass);
287 // compiler support for class operations
288 static int klass_offset() { CHECK_INIT(_klass_offset); }
289 static int array_klass_offset() { CHECK_INIT(_array_klass_offset); }
290 // Support for classRedefinedCount field
291 static int classRedefinedCount(oop the_class_mirror);
292 static void set_classRedefinedCount(oop the_class_mirror, int value);
293
294 // Support for embedded per-class oops
295 static oop protection_domain(oop java_class);
296 static oop component_mirror(oop java_class);
297 static objArrayOop signers(oop java_class);
298 static void set_signers(oop java_class, objArrayOop signers);
299 static oop class_data(oop java_class);
300 static void set_class_data(oop java_class, oop classData);
301
302 static oop reflection_data(oop java_class);
303 static void set_reflection_data(oop java_class, oop reflection_data);
304 static bool has_reflection_data(oop java_class);
305
306 static int component_mirror_offset() { return _component_mirror_offset; }
307
308 static oop class_loader(oop java_class);
309 static void set_module(oop java_class, oop module);
310 static oop module(oop java_class);
311
312 static oop name(Handle java_class, TRAPS);
313
314 static oop source_file(oop java_class);
315 static void set_source_file(oop java_class, oop source_file);
316
317 static size_t oop_size(oop java_class);
318 static void set_oop_size(HeapWord* java_class, size_t size);
319 static int static_oop_field_count(oop java_class);
320 static void set_static_oop_field_count(oop java_class, int size);
321
322 static GrowableArray<Klass*>* fixup_mirror_list() {
323 return _fixup_mirror_list;
324 }
325 static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
613
614 static void print_stack_element(outputStream *st, Method* method, int bci);
615
616 static void compute_offsets();
617 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
618
619 // Allocate space for backtrace (created but stack trace not filled in)
620 static void allocate_backtrace(Handle throwable, TRAPS);
621 // Fill in current stack trace for throwable with preallocated backtrace (no GC)
622 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
623 // Fill in current stack trace, can cause GC
624 static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
625 static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
626
627 // Programmatic access to stack trace
628 static void get_stack_trace_elements(int depth, Handle backtrace, objArrayHandle stack_trace, TRAPS);
629
630 // For recreating class initialization error exceptions.
631 static Handle create_initialization_error(JavaThread* current, Handle throwable);
632
633 static oop create_exception_instance(Symbol* class_name, TRAPS);
634
635 // Printing
636 static void print(oop throwable, outputStream* st);
637 static void print_stack_trace(Handle throwable, outputStream* st);
638 static void java_printStackTrace(Handle throwable, TRAPS);
639 // Debugging
640 friend class JavaClasses;
641 // Gets the method and bci of the top frame (TOS). Returns false if this failed.
642 static bool get_top_method_and_bci(oop throwable, Method** method, int* bci);
643 };
644
645
646 // Interface to java.lang.reflect.AccessibleObject objects
647
648 class java_lang_reflect_AccessibleObject: AllStatic {
649 private:
650 // Note that to reduce dependencies on the JDK we compute these
651 // offsets at run-time.
652 static int _override_offset;
653
654 static void compute_offsets();
655
|