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