161 #if INCLUDE_JVMCI
162 static address deoptimize_for_missing_exception_handler(CompiledMethod* cm);
163 #endif
164
165 static oop get_cached_box(AutoBoxObjectValue* bv, frame* fr, RegisterMap* reg_map, TRAPS);
166
167 private:
168 // Does the actual work for deoptimizing a single frame
169 static void deoptimize_single_frame(JavaThread* thread, frame fr, DeoptReason reason);
170
171 #if COMPILER2_OR_JVMCI
172 // Deoptimize objects, that is reallocate and relock them, just before they
173 // escape through JVMTI. The given vframes cover one physical frame.
174 static bool deoptimize_objects_internal(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk,
175 bool& realloc_failures);
176
177 public:
178
179 // Support for restoring non-escaping objects
180 static bool realloc_objects(JavaThread* thread, frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, TRAPS);
181 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
182 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
183 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal);
184 static bool relock_objects(JavaThread* thread, GrowableArray<MonitorInfo*>* monitors,
185 JavaThread* deoptee_thread, frame& fr, int exec_mode, bool realloc_failures);
186 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
187 #endif // COMPILER2_OR_JVMCI
188
189 public:
190 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
191
192 // Interface used for unpacking deoptimized frames
193
194 // UnrollBlock is returned by fetch_unroll_info() to the deoptimization handler (blob).
195 // This is only a CheapObj to ease debugging after a deopt failure
196 class UnrollBlock : public CHeapObj<mtCompiler> {
197 friend class VMStructs;
198 friend class JVMCIVMStructs;
199 private:
200 int _size_of_deoptimized_frame; // Size, in bytes, of current deoptimized frame
201 int _caller_adjustment; // Adjustment, in bytes, to caller's SP by initial interpreted frame
202 int _number_of_frames; // Number frames to unroll
203 int _total_frame_sizes; // Total of number*sizes frames
|
161 #if INCLUDE_JVMCI
162 static address deoptimize_for_missing_exception_handler(CompiledMethod* cm);
163 #endif
164
165 static oop get_cached_box(AutoBoxObjectValue* bv, frame* fr, RegisterMap* reg_map, TRAPS);
166
167 private:
168 // Does the actual work for deoptimizing a single frame
169 static void deoptimize_single_frame(JavaThread* thread, frame fr, DeoptReason reason);
170
171 #if COMPILER2_OR_JVMCI
172 // Deoptimize objects, that is reallocate and relock them, just before they
173 // escape through JVMTI. The given vframes cover one physical frame.
174 static bool deoptimize_objects_internal(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk,
175 bool& realloc_failures);
176
177 public:
178
179 // Support for restoring non-escaping objects
180 static bool realloc_objects(JavaThread* thread, frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, TRAPS);
181 static bool realloc_inline_type_result(InlineKlass* vk, const RegisterMap& map, GrowableArray<Handle>& return_oops, TRAPS);
182 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
183 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
184 static void reassign_flat_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, flatArrayOop obj, FlatArrayKlass* vak, bool skip_internal, TRAPS);
185 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal, TRAPS);
186 static bool relock_objects(JavaThread* thread, GrowableArray<MonitorInfo*>* monitors,
187 JavaThread* deoptee_thread, frame& fr, int exec_mode, bool realloc_failures);
188 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
189 #endif // COMPILER2_OR_JVMCI
190
191 public:
192 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
193
194 // Interface used for unpacking deoptimized frames
195
196 // UnrollBlock is returned by fetch_unroll_info() to the deoptimization handler (blob).
197 // This is only a CheapObj to ease debugging after a deopt failure
198 class UnrollBlock : public CHeapObj<mtCompiler> {
199 friend class VMStructs;
200 friend class JVMCIVMStructs;
201 private:
202 int _size_of_deoptimized_frame; // Size, in bytes, of current deoptimized frame
203 int _caller_adjustment; // Adjustment, in bytes, to caller's SP by initial interpreted frame
204 int _number_of_frames; // Number frames to unroll
205 int _total_frame_sizes; // Total of number*sizes frames
|