< prev index next >

src/hotspot/share/cds/aotConstantPoolResolver.hpp

Print this page

 50 //
 51 // For example, a JVM_CONSTANT_Class reference to a supertype can be safely resolved
 52 // at dump time, because at run time we will load a class from the CDS archive only
 53 // if all of its supertypes are loaded from the CDS archive.
 54 class AOTConstantPoolResolver :  AllStatic {
 55   static const int TABLE_SIZE = 15889; // prime number
 56   using ClassesTable = ResourceHashtable<InstanceKlass*, bool, TABLE_SIZE, AnyObj::C_HEAP, mtClassShared> ;
 57   static ClassesTable* _processed_classes;
 58 
 59 #ifdef ASSERT
 60   template <typename T> static bool is_in_archivebuilder_buffer(T p) {
 61     return is_in_archivebuilder_buffer((address)(p));
 62   }
 63   static bool is_in_archivebuilder_buffer(address p);
 64 #endif
 65 
 66   static void resolve_string(constantPoolHandle cp, int cp_index, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 67   static bool is_class_resolution_deterministic(InstanceKlass* cp_holder, Klass* resolved_class);
 68   static bool is_indy_resolution_deterministic(ConstantPool* cp, int cp_index);
 69 






 70   static Klass* find_loaded_class(Thread* current, oop class_loader, Symbol* name);
 71   static Klass* find_loaded_class(Thread* current, ConstantPool* cp, int class_cp_index);
 72 
 73   // fmi = FieldRef/MethodRef/InterfaceMethodRef
 74   static void maybe_resolve_fmi_ref(InstanceKlass* ik, Method* m, Bytecodes::Code bc, int raw_index,
 75                                     GrowableArray<bool>* resolve_fmi_list, TRAPS);
 76 
 77   static bool check_methodtype_signature(ConstantPool* cp, Symbol* sig, Klass** return_type_ret = nullptr);
 78   static bool check_lambda_metafactory_signature(ConstantPool* cp, Symbol* sig);
 79   static bool check_lambda_metafactory_methodtype_arg(ConstantPool* cp, int bsms_attribute_index, int arg_i);
 80   static bool check_lambda_metafactory_methodhandle_arg(ConstantPool* cp, int bsms_attribute_index, int arg_i);
 81 
 82 public:
 83   static void initialize();
 84   static void dispose();
 85 
 86   static void preresolve_class_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list);
 87   static void preresolve_field_and_method_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list);
 88   static void preresolve_indy_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list);
 89 







 90 
 91   // Resolve all constant pool entries that are safe to be stored in the
 92   // CDS archive.
 93   static void dumptime_resolve_constants(InstanceKlass* ik, TRAPS);
 94 
 95   static bool is_resolution_deterministic(ConstantPool* cp, int cp_index);
 96 };
 97 
 98 #endif // SHARE_CDS_AOTCONSTANTPOOLRESOLVER_HPP

 50 //
 51 // For example, a JVM_CONSTANT_Class reference to a supertype can be safely resolved
 52 // at dump time, because at run time we will load a class from the CDS archive only
 53 // if all of its supertypes are loaded from the CDS archive.
 54 class AOTConstantPoolResolver :  AllStatic {
 55   static const int TABLE_SIZE = 15889; // prime number
 56   using ClassesTable = ResourceHashtable<InstanceKlass*, bool, TABLE_SIZE, AnyObj::C_HEAP, mtClassShared> ;
 57   static ClassesTable* _processed_classes;
 58 
 59 #ifdef ASSERT
 60   template <typename T> static bool is_in_archivebuilder_buffer(T p) {
 61     return is_in_archivebuilder_buffer((address)(p));
 62   }
 63   static bool is_in_archivebuilder_buffer(address p);
 64 #endif
 65 
 66   static void resolve_string(constantPoolHandle cp, int cp_index, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 67   static bool is_class_resolution_deterministic(InstanceKlass* cp_holder, Klass* resolved_class);
 68   static bool is_indy_resolution_deterministic(ConstantPool* cp, int cp_index);
 69 
 70   // helper
 71   static Klass* resolve_boot_class_or_fail(const char* class_name, TRAPS);
 72 
 73   // java/lang/reflect/Proxy caching
 74   static void init_dynamic_proxy_cache(TRAPS);
 75 
 76   static Klass* find_loaded_class(Thread* current, oop class_loader, Symbol* name);
 77   static Klass* find_loaded_class(Thread* current, ConstantPool* cp, int class_cp_index);
 78 
 79   // fmi = FieldRef/MethodRef/InterfaceMethodRef
 80   static void maybe_resolve_fmi_ref(InstanceKlass* ik, Method* m, Bytecodes::Code bc, int raw_index,
 81                                     GrowableArray<bool>* resolve_fmi_list, TRAPS);
 82 
 83   static bool check_methodtype_signature(ConstantPool* cp, Symbol* sig, Klass** return_type_ret = nullptr);
 84   static bool check_lambda_metafactory_signature(ConstantPool* cp, Symbol* sig);
 85   static bool check_lambda_metafactory_methodtype_arg(ConstantPool* cp, int bsms_attribute_index, int arg_i);
 86   static bool check_lambda_metafactory_methodhandle_arg(ConstantPool* cp, int bsms_attribute_index, int arg_i);
 87 
 88 public:
 89   static void initialize();
 90   static void dispose();
 91 
 92   static void preresolve_class_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list);
 93   static void preresolve_field_and_method_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list);
 94   static void preresolve_indy_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list);
 95 
 96   // java/lang/Class$ReflectionData caching
 97   static int class_reflection_data_flags(InstanceKlass* ik, TRAPS);
 98   static void generate_reflection_data(JavaThread* current, InstanceKlass* ik, int rd_flags);
 99 
100   // java/lang/reflect/Proxy caching
101   static void trace_dynamic_proxy_class(oop loader, const char* proxy_name, objArrayOop interfaces, int access_flags);
102   static void define_dynamic_proxy_class(Handle loader, Handle proxy_name, Handle interfaces, int access_flags, TRAPS);
103 
104   // Resolve all constant pool entries that are safe to be stored in the
105   // CDS archive.
106   static void dumptime_resolve_constants(InstanceKlass* ik, TRAPS);
107 
108   static bool is_resolution_deterministic(ConstantPool* cp, int cp_index);
109 };
110 
111 #endif // SHARE_CDS_AOTCONSTANTPOOLRESOLVER_HPP
< prev index next >