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