136 static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map, DeoptReason reason);
137
138 private:
139 // Does the actual work for deoptimizing a single frame
140 static void deoptimize_single_frame(JavaThread* thread, frame fr, DeoptReason reason);
141
142 // Helper function to revoke biases of all monitors in frame if UseBiasedLocking
143 // is enabled
144 static void revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map);
145 // Helper function to revoke biases of all monitors in frames
146 // executing in a particular CodeBlob if UseBiasedLocking is enabled
147 static void revoke_biases_of_monitors(CodeBlob* cb);
148
149 #if defined(COMPILER2) || INCLUDE_JVMCI
150 JVMCI_ONLY(public:)
151
152 // Support for restoring non-escaping objects
153 static bool realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS);
154 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
155 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
156 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal);
157 static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread, bool realloc_failures);
158 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
159 NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);)
160 #endif // COMPILER2 || INCLUDE_JVMCI
161
162 public:
163 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
164
165 // Interface used for unpacking deoptimized frames
166
167 // UnrollBlock is returned by fetch_unroll_info() to the deoptimization handler (blob).
168 // This is only a CheapObj to ease debugging after a deopt failure
169 class UnrollBlock : public CHeapObj<mtCompiler> {
170 friend class VMStructs;
171 friend class JVMCIVMStructs;
172 private:
173 int _size_of_deoptimized_frame; // Size, in bytes, of current deoptimized frame
174 int _caller_adjustment; // Adjustment, in bytes, to caller's SP by initial interpreted frame
175 int _number_of_frames; // Number frames to unroll
176 int _total_frame_sizes; // Total of number*sizes frames
|
136 static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map, DeoptReason reason);
137
138 private:
139 // Does the actual work for deoptimizing a single frame
140 static void deoptimize_single_frame(JavaThread* thread, frame fr, DeoptReason reason);
141
142 // Helper function to revoke biases of all monitors in frame if UseBiasedLocking
143 // is enabled
144 static void revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map);
145 // Helper function to revoke biases of all monitors in frames
146 // executing in a particular CodeBlob if UseBiasedLocking is enabled
147 static void revoke_biases_of_monitors(CodeBlob* cb);
148
149 #if defined(COMPILER2) || INCLUDE_JVMCI
150 JVMCI_ONLY(public:)
151
152 // Support for restoring non-escaping objects
153 static bool realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS);
154 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type);
155 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
156 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal, TRAPS);
157 static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread, bool realloc_failures);
158 static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
159 NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);)
160 #endif // COMPILER2 || INCLUDE_JVMCI
161
162 public:
163 static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
164
165 // Interface used for unpacking deoptimized frames
166
167 // UnrollBlock is returned by fetch_unroll_info() to the deoptimization handler (blob).
168 // This is only a CheapObj to ease debugging after a deopt failure
169 class UnrollBlock : public CHeapObj<mtCompiler> {
170 friend class VMStructs;
171 friend class JVMCIVMStructs;
172 private:
173 int _size_of_deoptimized_frame; // Size, in bytes, of current deoptimized frame
174 int _caller_adjustment; // Adjustment, in bytes, to caller's SP by initial interpreted frame
175 int _number_of_frames; // Number frames to unroll
176 int _total_frame_sizes; // Total of number*sizes frames
|