62 enum CodeInstallResult {
63 ok,
64 dependencies_failed,
65 dependencies_invalid,
66 cache_full,
67 code_too_large
68 };
69
70 // Look up a klass by name from a particular class loader (the accessor's).
71 // If require_local, result must be defined in that class loader, or NULL.
72 // If !require_local, a result from remote class loader may be reported,
73 // if sufficient class loader constraints exist such that initiating
74 // a class loading request from the given loader is bound to return
75 // the class defined in the remote loader (or throw an error).
76 //
77 // Return an unloaded klass if !require_local and no class at all is found.
78 //
79 // The CI treats a klass as loaded if it is consistently defined in
80 // another loader, even if it hasn't yet been loaded in all loaders
81 // that could potentially see it via delegation.
82 static KlassHandle get_klass_by_name(KlassHandle accessing_klass,
83 Symbol* klass_name,
84 bool require_local);
85
86 // Constant pool access.
87 static KlassHandle get_klass_by_index(const constantPoolHandle& cpool,
88 int klass_index,
89 bool& is_accessible,
90 KlassHandle loading_klass);
91 static void get_field_by_index(instanceKlassHandle loading_klass, fieldDescriptor& fd,
92 int field_index);
93 static methodHandle get_method_by_index(const constantPoolHandle& cpool,
94 int method_index, Bytecodes::Code bc,
95 instanceKlassHandle loading_klass);
96
97 JVMCIEnv(CompileTask* task, int system_dictionary_modification_counter);
98
99 private:
100 CompileTask* _task;
101 int _system_dictionary_modification_counter;
102
103 // Compilation result values
104 const char* _failure_reason;
105 bool _retryable;
106
107 // Cache JVMTI state
108 bool _jvmti_can_hotswap_or_post_breakpoint;
109 bool _jvmti_can_access_local_variables;
110 bool _jvmti_can_post_on_exceptions;
111
112 // Implementation methods for loading and constant pool access.
113 static KlassHandle get_klass_by_name_impl(KlassHandle& accessing_klass,
114 const constantPoolHandle& cpool,
115 Symbol* klass_name,
116 bool require_local);
117 static KlassHandle get_klass_by_index_impl(const constantPoolHandle& cpool,
118 int klass_index,
119 bool& is_accessible,
120 KlassHandle loading_klass);
121 static void get_field_by_index_impl(instanceKlassHandle loading_klass, fieldDescriptor& fd,
122 int field_index);
123 static methodHandle get_method_by_index_impl(const constantPoolHandle& cpool,
124 int method_index, Bytecodes::Code bc,
125 instanceKlassHandle loading_klass);
126
127 // Helper methods
128 static bool check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass);
129 static methodHandle lookup_method(instanceKlassHandle accessor,
130 instanceKlassHandle holder,
131 Symbol* name,
132 Symbol* sig,
133 Bytecodes::Code bc,
134 constantTag tag);
135
136 private:
137
138 // Is this thread currently in the VM state?
139 static bool is_in_vm();
140
141 // Helper routine for determining the validity of a compilation
142 // with respect to concurrent class loading.
143 static JVMCIEnv::CodeInstallResult check_for_system_dictionary_modification(Dependencies* target, Handle compiled_code,
144 JVMCIEnv* env, char** failure_detail);
145
146 public:
147 CompileTask* task() { return _task; }
148
149 const char* failure_reason() { return _failure_reason; }
150 bool retryable() { return _retryable; }
163 int orig_pc_offset,
164 CodeBuffer* code_buffer,
165 int frame_words,
166 OopMapSet* oop_map_set,
167 ExceptionHandlerTable* handler_table,
168 AbstractCompiler* compiler,
169 DebugInformationRecorder* debug_info,
170 Dependencies* dependencies,
171 JVMCIEnv* env,
172 int compile_id,
173 bool has_unsafe_access,
174 bool has_wide_vector,
175 Handle installed_code,
176 Handle compiled_code,
177 Handle speculation_log);
178
179 // converts the Klass* representing the holder of a method into a
180 // InstanceKlass*. This is needed since the holder of a method in
181 // the bytecodes could be an array type. Basically this converts
182 // array types into java/lang/Object and other types stay as they are.
183 static instanceKlassHandle get_instance_klass_for_declared_method_holder(KlassHandle klass);
184 };
185
186 #endif // SHARE_VM_JVMCI_JVMCIENV_HPP
|
62 enum CodeInstallResult {
63 ok,
64 dependencies_failed,
65 dependencies_invalid,
66 cache_full,
67 code_too_large
68 };
69
70 // Look up a klass by name from a particular class loader (the accessor's).
71 // If require_local, result must be defined in that class loader, or NULL.
72 // If !require_local, a result from remote class loader may be reported,
73 // if sufficient class loader constraints exist such that initiating
74 // a class loading request from the given loader is bound to return
75 // the class defined in the remote loader (or throw an error).
76 //
77 // Return an unloaded klass if !require_local and no class at all is found.
78 //
79 // The CI treats a klass as loaded if it is consistently defined in
80 // another loader, even if it hasn't yet been loaded in all loaders
81 // that could potentially see it via delegation.
82 static Klass* get_klass_by_name(Klass* accessing_klass, Symbol* klass_name, bool require_local);
83
84 // Constant pool access.
85 static Klass* get_klass_by_index(const constantPoolHandle& cpool,
86 int klass_index,
87 bool& is_accessible,
88 Klass* loading_klass);
89 static void get_field_by_index(InstanceKlass* loading_klass, fieldDescriptor& fd,
90 int field_index);
91 static methodHandle get_method_by_index(const constantPoolHandle& cpool,
92 int method_index, Bytecodes::Code bc,
93 InstanceKlass* loading_klass);
94
95 JVMCIEnv(CompileTask* task, int system_dictionary_modification_counter);
96
97 private:
98 CompileTask* _task;
99 int _system_dictionary_modification_counter;
100
101 // Compilation result values
102 const char* _failure_reason;
103 bool _retryable;
104
105 // Cache JVMTI state
106 bool _jvmti_can_hotswap_or_post_breakpoint;
107 bool _jvmti_can_access_local_variables;
108 bool _jvmti_can_post_on_exceptions;
109
110 // Implementation methods for loading and constant pool access.
111 static Klass* get_klass_by_name_impl(Klass* accessing_klass,
112 const constantPoolHandle& cpool,
113 Symbol* klass_name,
114 bool require_local);
115 static Klass* get_klass_by_index_impl(const constantPoolHandle& cpool,
116 int klass_index,
117 bool& is_accessible,
118 Klass* loading_klass);
119 static void get_field_by_index_impl(InstanceKlass* loading_klass, fieldDescriptor& fd,
120 int field_index);
121 static methodHandle get_method_by_index_impl(const constantPoolHandle& cpool,
122 int method_index, Bytecodes::Code bc,
123 InstanceKlass* loading_klass);
124
125 // Helper methods
126 static bool check_klass_accessibility(Klass* accessing_klass, Klass* resolved_klass);
127 static methodHandle lookup_method(InstanceKlass* accessor,
128 InstanceKlass* holder,
129 Symbol* name,
130 Symbol* sig,
131 Bytecodes::Code bc,
132 constantTag tag);
133
134 private:
135
136 // Is this thread currently in the VM state?
137 static bool is_in_vm();
138
139 // Helper routine for determining the validity of a compilation
140 // with respect to concurrent class loading.
141 static JVMCIEnv::CodeInstallResult check_for_system_dictionary_modification(Dependencies* target, Handle compiled_code,
142 JVMCIEnv* env, char** failure_detail);
143
144 public:
145 CompileTask* task() { return _task; }
146
147 const char* failure_reason() { return _failure_reason; }
148 bool retryable() { return _retryable; }
161 int orig_pc_offset,
162 CodeBuffer* code_buffer,
163 int frame_words,
164 OopMapSet* oop_map_set,
165 ExceptionHandlerTable* handler_table,
166 AbstractCompiler* compiler,
167 DebugInformationRecorder* debug_info,
168 Dependencies* dependencies,
169 JVMCIEnv* env,
170 int compile_id,
171 bool has_unsafe_access,
172 bool has_wide_vector,
173 Handle installed_code,
174 Handle compiled_code,
175 Handle speculation_log);
176
177 // converts the Klass* representing the holder of a method into a
178 // InstanceKlass*. This is needed since the holder of a method in
179 // the bytecodes could be an array type. Basically this converts
180 // array types into java/lang/Object and other types stay as they are.
181 static InstanceKlass* get_instance_klass_for_declared_method_holder(Klass* klass);
182 };
183
184 #endif // SHARE_VM_JVMCI_JVMCIENV_HPP
|