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