< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page

 222  private:
 223 
 224   // The fake offsets are added by the class loader when java.lang.Class is loaded
 225 
 226   static int _klass_offset;
 227   static int _array_klass_offset;
 228 
 229   static int _oop_size_offset;
 230   static int _static_oop_field_count_offset;
 231 
 232   static int _protection_domain_offset;
 233   static int _init_lock_offset;
 234   static int _signers_offset;
 235   static int _class_loader_offset;
 236   static int _module_offset;
 237   static int _component_mirror_offset;
 238   static int _name_offset;
 239   static int _source_file_offset;
 240   static int _classData_offset;
 241   static int _classRedefinedCount_offset;

 242 
 243   static bool _offsets_computed;
 244 
 245   static GrowableArray<Klass*>* _fixup_mirror_list;
 246   static GrowableArray<Klass*>* _fixup_module_field_list;
 247 
 248   static void set_init_lock(oop java_class, oop init_lock);
 249   static void set_protection_domain(oop java_class, oop protection_domain);
 250   static void set_class_loader(oop java_class, oop class_loader);
 251   static void set_component_mirror(oop java_class, oop comp_mirror);
 252   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 253                                        Handle classData, TRAPS);
 254   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 255  public:
 256   static void allocate_fixup_lists();
 257   static void compute_offsets();
 258 
 259   // Instance creation
 260   static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
 261                               Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
 262   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 263                             Handle protection_domain, Handle classData, TRAPS);
 264   static void fixup_mirror(Klass* k, TRAPS);
 265   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 266 
 267   // Archiving
 268   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 269   static void create_scratch_mirror(Klass* k, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 270   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 271                                       Handle protection_domain,
 272                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 273 
 274   static void fixup_module_field(Klass* k, Handle module);
 275 
 276   // Conversion
 277   static Klass* as_Klass(oop java_class);
 278   static void set_klass(oop java_class, Klass* klass);
 279   static BasicType as_BasicType(oop java_class, Klass** reference_klass = nullptr);
 280   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 281   static void print_signature(oop java_class, outputStream *st);
 282   static const char* as_external_name(oop java_class);
 283   // Testing
 284   static bool is_instance(oop obj);
 285 
 286   static bool is_primitive(oop java_class);
 287   static BasicType primitive_type(oop java_class);
 288   static oop primitive_mirror(BasicType t);
 289   // JVM_NewArray support
 290   static Klass* array_klass_acquire(oop java_class);
 291   static void release_set_array_klass(oop java_class, Klass* klass);
 292   // compiler support for class operations
 293   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 294   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }
 295   // Support for classRedefinedCount field
 296   static int classRedefinedCount(oop the_class_mirror);
 297   static void set_classRedefinedCount(oop the_class_mirror, int value);
 298 
 299   // Support for embedded per-class oops
 300   static oop  protection_domain(oop java_class);
 301   static oop  init_lock(oop java_class);
 302   static void clear_init_lock(oop java_class) {
 303     set_init_lock(java_class, nullptr);
 304   }
 305   static oop  component_mirror(oop java_class);
 306   static objArrayOop signers(oop java_class);
 307   static oop  class_data(oop java_class);
 308   static void set_class_data(oop java_class, oop classData);
 309 




 310   static int component_mirror_offset() { return _component_mirror_offset; }
 311 
 312   static oop class_loader(oop java_class);
 313   static void set_module(oop java_class, oop module);
 314   static oop module(oop java_class);
 315 
 316   static oop name(Handle java_class, TRAPS);
 317 
 318   static oop source_file(oop java_class);
 319   static void set_source_file(oop java_class, oop source_file);
 320 
 321   static size_t oop_size(oop java_class);
 322   static void set_oop_size(HeapWord* java_class, size_t size);
 323   static int static_oop_field_count(oop java_class);
 324   static void set_static_oop_field_count(oop java_class, int size);
 325 
 326   static GrowableArray<Klass*>* fixup_mirror_list() {
 327     return _fixup_mirror_list;
 328   }
 329   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {

 617 
 618   static void print_stack_element(outputStream *st, Method* method, int bci);
 619 
 620   static void compute_offsets();
 621   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 622 
 623   // Allocate space for backtrace (created but stack trace not filled in)
 624   static void allocate_backtrace(Handle throwable, TRAPS);
 625   // Fill in current stack trace for throwable with preallocated backtrace (no GC)
 626   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
 627   // Fill in current stack trace, can cause GC
 628   static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
 629   static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
 630 
 631   // Programmatic access to stack trace
 632   static void get_stack_trace_elements(int depth, Handle backtrace, objArrayHandle stack_trace, TRAPS);
 633 
 634   // For recreating class initialization error exceptions.
 635   static Handle create_initialization_error(JavaThread* current, Handle throwable);
 636 
 637   // Printing


 638   static void print(oop throwable, outputStream* st);
 639   static void print_stack_trace(Handle throwable, outputStream* st);
 640   static void java_printStackTrace(Handle throwable, TRAPS);
 641   // Debugging
 642   friend class JavaClasses;
 643   // Gets the method and bci of the top frame (TOS). Returns false if this failed.
 644   static bool get_top_method_and_bci(oop throwable, Method** method, int* bci);
 645 };
 646 
 647 
 648 // Interface to java.lang.reflect.AccessibleObject objects
 649 
 650 class java_lang_reflect_AccessibleObject: AllStatic {
 651  private:
 652   // Note that to reduce dependencies on the JDK we compute these
 653   // offsets at run-time.
 654   static int _override_offset;
 655 
 656   static void compute_offsets();
 657 

 222  private:
 223 
 224   // The fake offsets are added by the class loader when java.lang.Class is loaded
 225 
 226   static int _klass_offset;
 227   static int _array_klass_offset;
 228 
 229   static int _oop_size_offset;
 230   static int _static_oop_field_count_offset;
 231 
 232   static int _protection_domain_offset;
 233   static int _init_lock_offset;
 234   static int _signers_offset;
 235   static int _class_loader_offset;
 236   static int _module_offset;
 237   static int _component_mirror_offset;
 238   static int _name_offset;
 239   static int _source_file_offset;
 240   static int _classData_offset;
 241   static int _classRedefinedCount_offset;
 242   static int _reflectionData_offset;
 243 
 244   static bool _offsets_computed;
 245 
 246   static GrowableArray<Klass*>* _fixup_mirror_list;
 247   static GrowableArray<Klass*>* _fixup_module_field_list;
 248 
 249   static void set_init_lock(oop java_class, oop init_lock);
 250   static void set_protection_domain(oop java_class, oop protection_domain);
 251   static void set_class_loader(oop java_class, oop class_loader);
 252   static void set_component_mirror(oop java_class, oop comp_mirror);
 253   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 254                                        Handle classData, TRAPS);
 255   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 256  public:
 257   static void allocate_fixup_lists();
 258   static void compute_offsets();
 259 
 260   // Instance creation
 261   static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
 262                               Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
 263   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 264                             Handle protection_domain, Handle classData, TRAPS);
 265   static void fixup_mirror(Klass* k, TRAPS);
 266   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 267 
 268   // Archiving
 269   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 270   static void create_scratch_mirror(Klass* k, Handle protection_domain, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 271   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 272                                       Handle protection_domain,
 273                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 274 
 275   static void fixup_module_field(Klass* k, Handle module);
 276 
 277   // Conversion
 278   static Klass* as_Klass(oop java_class);
 279   static void set_klass(oop java_class, Klass* klass);
 280   static BasicType as_BasicType(oop java_class, Klass** reference_klass = nullptr);
 281   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 282   static void print_signature(oop java_class, outputStream *st);
 283   static const char* as_external_name(oop java_class);
 284   // Testing
 285   static bool is_instance(oop obj);
 286 
 287   static bool is_primitive(oop java_class);
 288   static BasicType primitive_type(oop java_class);
 289   static oop primitive_mirror(BasicType t);
 290   // JVM_NewArray support
 291   static Klass* array_klass_acquire(oop java_class);
 292   static void release_set_array_klass(oop java_class, Klass* klass);
 293   // compiler support for class operations
 294   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 295   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }
 296   // Support for classRedefinedCount field
 297   static int classRedefinedCount(oop the_class_mirror);
 298   static void set_classRedefinedCount(oop the_class_mirror, int value);
 299 
 300   // Support for embedded per-class oops
 301   static oop  protection_domain(oop java_class);
 302   static oop  init_lock(oop java_class);
 303   static void clear_init_lock(oop java_class) {
 304     set_init_lock(java_class, nullptr);
 305   }
 306   static oop  component_mirror(oop java_class);
 307   static objArrayOop signers(oop java_class);
 308   static oop  class_data(oop java_class);
 309   static void set_class_data(oop java_class, oop classData);
 310 
 311   static oop  reflection_data(oop java_class);
 312   static void set_reflection_data(oop java_class, oop reflection_data);
 313   static bool has_reflection_data(oop java_class);
 314 
 315   static int component_mirror_offset() { return _component_mirror_offset; }
 316 
 317   static oop class_loader(oop java_class);
 318   static void set_module(oop java_class, oop module);
 319   static oop module(oop java_class);
 320 
 321   static oop name(Handle java_class, TRAPS);
 322 
 323   static oop source_file(oop java_class);
 324   static void set_source_file(oop java_class, oop source_file);
 325 
 326   static size_t oop_size(oop java_class);
 327   static void set_oop_size(HeapWord* java_class, size_t size);
 328   static int static_oop_field_count(oop java_class);
 329   static void set_static_oop_field_count(oop java_class, int size);
 330 
 331   static GrowableArray<Klass*>* fixup_mirror_list() {
 332     return _fixup_mirror_list;
 333   }
 334   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {

 622 
 623   static void print_stack_element(outputStream *st, Method* method, int bci);
 624 
 625   static void compute_offsets();
 626   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 627 
 628   // Allocate space for backtrace (created but stack trace not filled in)
 629   static void allocate_backtrace(Handle throwable, TRAPS);
 630   // Fill in current stack trace for throwable with preallocated backtrace (no GC)
 631   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
 632   // Fill in current stack trace, can cause GC
 633   static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
 634   static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
 635 
 636   // Programmatic access to stack trace
 637   static void get_stack_trace_elements(int depth, Handle backtrace, objArrayHandle stack_trace, TRAPS);
 638 
 639   // For recreating class initialization error exceptions.
 640   static Handle create_initialization_error(JavaThread* current, Handle throwable);
 641 
 642   static oop create_exception_instance(Symbol* class_name, TRAPS);
 643 
 644     // Printing
 645   static void print(oop throwable, outputStream* st);
 646   static void print_stack_trace(Handle throwable, outputStream* st);
 647   static void java_printStackTrace(Handle throwable, TRAPS);
 648   // Debugging
 649   friend class JavaClasses;
 650   // Gets the method and bci of the top frame (TOS). Returns false if this failed.
 651   static bool get_top_method_and_bci(oop throwable, Method** method, int* bci);
 652 };
 653 
 654 
 655 // Interface to java.lang.reflect.AccessibleObject objects
 656 
 657 class java_lang_reflect_AccessibleObject: AllStatic {
 658  private:
 659   // Note that to reduce dependencies on the JDK we compute these
 660   // offsets at run-time.
 661   static int _override_offset;
 662 
 663   static void compute_offsets();
 664 
< prev index next >