121 |
121 |
122 enum UnpackType { |
122 enum UnpackType { |
123 Unpack_deopt = 0, // normal deoptimization, use pc computed in unpack_vframe_on_stack |
123 Unpack_deopt = 0, // normal deoptimization, use pc computed in unpack_vframe_on_stack |
124 Unpack_exception = 1, // exception is pending |
124 Unpack_exception = 1, // exception is pending |
125 Unpack_uncommon_trap = 2, // redo last byte code (C2 only) |
125 Unpack_uncommon_trap = 2, // redo last byte code (C2 only) |
126 Unpack_reexecute = 3 // reexecute bytecode (C1 only) |
126 Unpack_reexecute = 3, // reexecute bytecode (C1 only) |
|
127 Unpack_LIMIT = 4 |
127 }; |
128 }; |
128 |
129 |
129 // Checks all compiled methods. Invalid methods are deleted and |
130 // Checks all compiled methods. Invalid methods are deleted and |
130 // corresponding activations are deoptimized. |
131 // corresponding activations are deoptimized. |
131 static int deoptimize_dependents(); |
132 static int deoptimize_dependents(); |
177 intptr_t* _register_block; // Block for storing callee-saved registers. |
178 intptr_t* _register_block; // Block for storing callee-saved registers. |
178 BasicType _return_type; // Tells if we have to restore double or long return value |
179 BasicType _return_type; // Tells if we have to restore double or long return value |
179 intptr_t _initial_info; // Platform dependent data for the sender frame (was FP on x86) |
180 intptr_t _initial_info; // Platform dependent data for the sender frame (was FP on x86) |
180 int _caller_actual_parameters; // The number of actual arguments at the |
181 int _caller_actual_parameters; // The number of actual arguments at the |
181 // interpreted caller of the deoptimized frame |
182 // interpreted caller of the deoptimized frame |
|
183 int _unpack_kind; // exec_mode that can be changed during fetch_unroll_info |
182 |
184 |
183 // The following fields are used as temps during the unpacking phase |
185 // The following fields are used as temps during the unpacking phase |
184 // (which is tight on registers, especially on x86). They really ought |
186 // (which is tight on registers, especially on x86). They really ought |
185 // to be PD variables but that involves moving this class into its own |
187 // to be PD variables but that involves moving this class into its own |
186 // file to use the pd include mechanism. Maybe in a later cleanup ... |
188 // file to use the pd include mechanism. Maybe in a later cleanup ... |
187 intptr_t _counter_temp; // SHOULD BE PD VARIABLE (x86 frame count temp) |
189 intptr_t _counter_temp; // SHOULD BE PD VARIABLE (x86 frame count temp) |
188 intptr_t _unpack_kind; // SHOULD BE PD VARIABLE (x86 unpack kind) |
|
189 intptr_t _sender_sp_temp; // SHOULD BE PD VARIABLE (x86 sender_sp) |
190 intptr_t _sender_sp_temp; // SHOULD BE PD VARIABLE (x86 sender_sp) |
190 public: |
191 public: |
191 // Constructor |
192 // Constructor |
192 UnrollBlock(int size_of_deoptimized_frame, |
193 UnrollBlock(int size_of_deoptimized_frame, |
193 int caller_adjustment, |
194 int caller_adjustment, |
194 int caller_actual_parameters, |
195 int caller_actual_parameters, |
195 int number_of_frames, |
196 int number_of_frames, |
196 intptr_t* frame_sizes, |
197 intptr_t* frame_sizes, |
197 address* frames_pcs, |
198 address* frames_pcs, |
198 BasicType return_type); |
199 BasicType return_type, |
|
200 int unpack_kind); |
199 ~UnrollBlock(); |
201 ~UnrollBlock(); |
200 |
202 |
201 // Returns where a register is located. |
203 // Returns where a register is located. |
202 intptr_t* value_addr_at(int register_number) const; |
204 intptr_t* value_addr_at(int register_number) const; |
203 |
205 |
204 // Accessors |
206 // Accessors |
205 intptr_t* frame_sizes() const { return _frame_sizes; } |
207 intptr_t* frame_sizes() const { return _frame_sizes; } |
206 int number_of_frames() const { return _number_of_frames; } |
208 int number_of_frames() const { return _number_of_frames; } |
207 address* frame_pcs() const { return _frame_pcs ; } |
209 address* frame_pcs() const { return _frame_pcs ; } |
|
210 int unpack_kind() const { return _unpack_kind; } |
208 |
211 |
209 // Returns the total size of frames |
212 // Returns the total size of frames |
210 int size_of_frames() const; |
213 int size_of_frames() const; |
211 |
214 |
212 void set_initial_info(intptr_t info) { _initial_info = info; } |
215 void set_initial_info(intptr_t info) { _initial_info = info; } |
235 // how to make room for the resulting interpreter frames. |
238 // how to make room for the resulting interpreter frames. |
236 // Called by assembly stub after execution has returned to |
239 // Called by assembly stub after execution has returned to |
237 // deoptimized frame. |
240 // deoptimized frame. |
238 // @argument thread. Thread where stub_frame resides. |
241 // @argument thread. Thread where stub_frame resides. |
239 // @see OptoRuntime::deoptimization_fetch_unroll_info_C |
242 // @see OptoRuntime::deoptimization_fetch_unroll_info_C |
240 static UnrollBlock* fetch_unroll_info(JavaThread* thread); |
243 static UnrollBlock* fetch_unroll_info(JavaThread* thread, int exec_mode); |
241 |
244 |
242 //** Unpacks vframeArray onto execution stack |
245 //** Unpacks vframeArray onto execution stack |
243 // Called by assembly stub after execution has returned to |
246 // Called by assembly stub after execution has returned to |
244 // deoptimized frame and after the stack unrolling. |
247 // deoptimized frame and after the stack unrolling. |
245 // @argument thread. Thread where stub_frame resides. |
248 // @argument thread. Thread where stub_frame resides. |
260 // so caller of the deoptimized frame will get back the values it expects. |
263 // so caller of the deoptimized frame will get back the values it expects. |
261 static void unwind_callee_save_values(frame* f, vframeArray* vframe_array); |
264 static void unwind_callee_save_values(frame* f, vframeArray* vframe_array); |
262 |
265 |
263 //** Performs an uncommon trap for compiled code. |
266 //** Performs an uncommon trap for compiled code. |
264 // The top most compiler frame is converted into interpreter frames |
267 // The top most compiler frame is converted into interpreter frames |
265 static UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index); |
268 static UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index, jint exec_mode); |
266 // Helper routine that enters the VM and may block |
269 // Helper routine that enters the VM and may block |
267 static void uncommon_trap_inner(JavaThread* thread, jint unloaded_class_index); |
270 static void uncommon_trap_inner(JavaThread* thread, jint unloaded_class_index); |
268 |
271 |
269 //** Deoptimizes the frame identified by id. |
272 //** Deoptimizes the frame identified by id. |
270 // Only called from VMDeoptimizeFrame |
273 // Only called from VMDeoptimizeFrame |
421 bool& ret_maybe_prior_recompile); |
424 bool& ret_maybe_prior_recompile); |
422 // class loading support for uncommon trap |
425 // class loading support for uncommon trap |
423 static void load_class_by_index(const constantPoolHandle& constant_pool, int index, TRAPS); |
426 static void load_class_by_index(const constantPoolHandle& constant_pool, int index, TRAPS); |
424 static void load_class_by_index(const constantPoolHandle& constant_pool, int index); |
427 static void load_class_by_index(const constantPoolHandle& constant_pool, int index); |
425 |
428 |
426 static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread); |
429 static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread, int exec_mode); |
427 |
430 |
428 static DeoptAction _unloaded_action; // == Action_reinterpret; |
431 static DeoptAction _unloaded_action; // == Action_reinterpret; |
429 static const char* _trap_reason_name[]; |
432 static const char* _trap_reason_name[]; |
430 static const char* _trap_action_name[]; |
433 static const char* _trap_action_name[]; |
431 |
434 |