185
186 #if INCLUDE_JVMCI
187 static address deoptimize_for_missing_exception_handler(nmethod* nm);
188 static oop get_cached_box(AutoBoxObjectValue* bv, frame* fr, RegisterMap* reg_map, bool& cache_init_error, TRAPS);
189 #endif
190
191 private:
192 // Does the actual work for deoptimizing a single frame
193 static void deoptimize_single_frame(JavaThread* thread, frame fr, DeoptReason reason);
194
195 #if COMPILER2_OR_JVMCI
196 // Deoptimize objects, that is reallocate and relock them, just before they
197 // escape through JVMTI. The given vframes cover one physical frame.
198 static bool deoptimize_objects_internal(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk,
199 bool& realloc_failures);
200
201 public:
202
203 // Support for restoring non-escaping objects
204 static bool realloc_objects(JavaThread* thread, frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, TRAPS);
205 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
206 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
207 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal);
208 static bool relock_objects(JavaThread* thread, GrowableArray<MonitorInfo*>* monitors,
209 JavaThread* deoptee_thread, frame& fr, int exec_mode, bool realloc_failures);
210 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
211 #endif // COMPILER2_OR_JVMCI
212
213 public:
214 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
215
216 // Interface used for unpacking deoptimized frames
217
218 // UnrollBlock is returned by fetch_unroll_info() to the deoptimization handler (blob).
219 // This is only a CheapObj to ease debugging after a deopt failure
220 class UnrollBlock : public CHeapObj<mtCompiler> {
221 friend class VMStructs;
222 friend class JVMCIVMStructs;
223 private:
224 int _size_of_deoptimized_frame; // Size, in bytes, of current deoptimized frame
225 int _caller_adjustment; // Adjustment, in bytes, to caller's SP by initial interpreted frame
226 int _number_of_frames; // Number frames to unroll
227 int _total_frame_sizes; // Total of number*sizes frames
|
185
186 #if INCLUDE_JVMCI
187 static address deoptimize_for_missing_exception_handler(nmethod* nm);
188 static oop get_cached_box(AutoBoxObjectValue* bv, frame* fr, RegisterMap* reg_map, bool& cache_init_error, TRAPS);
189 #endif
190
191 private:
192 // Does the actual work for deoptimizing a single frame
193 static void deoptimize_single_frame(JavaThread* thread, frame fr, DeoptReason reason);
194
195 #if COMPILER2_OR_JVMCI
196 // Deoptimize objects, that is reallocate and relock them, just before they
197 // escape through JVMTI. The given vframes cover one physical frame.
198 static bool deoptimize_objects_internal(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk,
199 bool& realloc_failures);
200
201 public:
202
203 // Support for restoring non-escaping objects
204 static bool realloc_objects(JavaThread* thread, frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, TRAPS);
205 static bool realloc_inline_type_result(InlineKlass* vk, const RegisterMap& map, GrowableArray<Handle>& return_oops, TRAPS);
206 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
207 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
208 static void reassign_flat_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, flatArrayOop obj, FlatArrayKlass* vak, bool skip_internal, TRAPS);
209 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal, TRAPS);
210 static bool relock_objects(JavaThread* thread, GrowableArray<MonitorInfo*>* monitors,
211 JavaThread* deoptee_thread, frame& fr, int exec_mode, bool realloc_failures);
212 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
213 #endif // COMPILER2_OR_JVMCI
214
215 public:
216 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
217
218 // Interface used for unpacking deoptimized frames
219
220 // UnrollBlock is returned by fetch_unroll_info() to the deoptimization handler (blob).
221 // This is only a CheapObj to ease debugging after a deopt failure
222 class UnrollBlock : public CHeapObj<mtCompiler> {
223 friend class VMStructs;
224 friend class JVMCIVMStructs;
225 private:
226 int _size_of_deoptimized_frame; // Size, in bytes, of current deoptimized frame
227 int _caller_adjustment; // Adjustment, in bytes, to caller's SP by initial interpreted frame
228 int _number_of_frames; // Number frames to unroll
229 int _total_frame_sizes; // Total of number*sizes frames
|