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