153 static void revoke_from_deopt_handler(JavaThread* thread, frame fr, RegisterMap* map);
154
155 public:
156 // Deoptimizes a frame lazily. Deopt happens on return to the frame.
157 static void deoptimize(JavaThread* thread, frame fr, DeoptReason reason = Reason_constraint);
158
159 #if INCLUDE_JVMCI
160 static address deoptimize_for_missing_exception_handler(CompiledMethod* cm);
161 static oop get_cached_box(AutoBoxObjectValue* bv, frame* fr, RegisterMap* reg_map, TRAPS);
162 #endif
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 #if COMPILER2_OR_JVMCI
169 public:
170
171 // Support for restoring non-escaping objects
172 static bool realloc_objects(JavaThread* thread, frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, TRAPS);
173 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
174 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
175 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal);
176 static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread, bool realloc_failures);
177 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
178 NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);)
179 #endif // COMPILER2_OR_JVMCI
180
181 public:
182 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
183
184 // Interface used for unpacking deoptimized frames
185
186 // UnrollBlock is returned by fetch_unroll_info() to the deoptimization handler (blob).
187 // This is only a CheapObj to ease debugging after a deopt failure
188 class UnrollBlock : public CHeapObj<mtCompiler> {
189 friend class VMStructs;
190 friend class JVMCIVMStructs;
191 private:
192 int _size_of_deoptimized_frame; // Size, in bytes, of current deoptimized frame
193 int _caller_adjustment; // Adjustment, in bytes, to caller's SP by initial interpreted frame
194 int _number_of_frames; // Number frames to unroll
|
153 static void revoke_from_deopt_handler(JavaThread* thread, frame fr, RegisterMap* map);
154
155 public:
156 // Deoptimizes a frame lazily. Deopt happens on return to the frame.
157 static void deoptimize(JavaThread* thread, frame fr, DeoptReason reason = Reason_constraint);
158
159 #if INCLUDE_JVMCI
160 static address deoptimize_for_missing_exception_handler(CompiledMethod* cm);
161 static oop get_cached_box(AutoBoxObjectValue* bv, frame* fr, RegisterMap* reg_map, TRAPS);
162 #endif
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 #if COMPILER2_OR_JVMCI
169 public:
170
171 // Support for restoring non-escaping objects
172 static bool realloc_objects(JavaThread* thread, frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, TRAPS);
173 static void reassign_stack_allocated_fields(frame *fr, GrowableArray<ScopeValue*>* objects, ObjectValue *sv, Handle obj, Klass* k);
174 static void reassign_stack_allocated_type_array_elements(oop orig, oop newly_allocated, Klass *k);
175 static void reassign_stack_allocated_object_array_elements(oop orig, oop newly_allocated, intptr_t *sp_base, intptr_t *sp_top, GrowableArray<ScopeValue*>* objects);
176 static void reassign_scalar_replaced_fields(frame *fr, RegisterMap *reg_map, GrowableArray<ScopeValue*>* objects, ObjectValue *sv, Handle obj, Klass* k, bool skip_internal);
177 static void reassign_scalar_replaced_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
178 static void reassign_scalar_replaced_object_array_elements(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, ObjectValue* sv, objArrayOop obj);
179 static ScopeValue *get_scope_value(frame* fr, RegisterMap* reg_map, ScopeValue* sv, GrowableArray<ScopeValue*>* objects);
180 static ScopeValue *match_object_to_stack_oop(intptr_t *oop_ptr, intptr_t *sp_base, GrowableArray<ScopeValue*>* objects);
181 static void reassign_scalar_replaced_fields_by_klass(InstanceKlass* klass, frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, ObjectValue* sv, int svIndex, oop obj, bool skip_internal);
182 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal);
183 static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread, bool realloc_failures);
184 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
185 NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);)
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
|