Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/deoptimization.hpp @ 22712:3c1edc9c60d8
Let fetch_unroll_info override the exec_mode and handle rethrowing scopes
Scopes with rethrow_exception set to true need to be handled
for all types of deoptimization, not just for uncommon traps.
This change moves their handling from uncommon_trap_inner to
fetch_unroll_info_helper and uses exception_oop and exec_mode
Unpack_exception rather than setting a pending execption.
fetch_unroll_info_helper can now override the exec_mode by
passing it through the UnrollBlock.
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Thu, 29 Oct 2015 16:11:45 +0100 |
parents | 6832e10a0b97 |
children | ba7846fcb814 |
comparison
equal
deleted
inserted
replaced
22711:316e768645c0 | 22712:3c1edc9c60d8 |
---|---|
114 | 114 |
115 enum UnpackType { | 115 enum UnpackType { |
116 Unpack_deopt = 0, // normal deoptimization, use pc computed in unpack_vframe_on_stack | 116 Unpack_deopt = 0, // normal deoptimization, use pc computed in unpack_vframe_on_stack |
117 Unpack_exception = 1, // exception is pending | 117 Unpack_exception = 1, // exception is pending |
118 Unpack_uncommon_trap = 2, // redo last byte code (C2 only) | 118 Unpack_uncommon_trap = 2, // redo last byte code (C2 only) |
119 Unpack_reexecute = 3 // reexecute bytecode (C1 only) | 119 Unpack_reexecute = 3, // reexecute bytecode (C1 only) |
120 Unpack_LIMIT = 4 | |
120 }; | 121 }; |
121 | 122 |
122 // Checks all compiled methods. Invalid methods are deleted and | 123 // Checks all compiled methods. Invalid methods are deleted and |
123 // corresponding activations are deoptimized. | 124 // corresponding activations are deoptimized. |
124 static int deoptimize_dependents(); | 125 static int deoptimize_dependents(); |
170 intptr_t* _register_block; // Block for storing callee-saved registers. | 171 intptr_t* _register_block; // Block for storing callee-saved registers. |
171 BasicType _return_type; // Tells if we have to restore double or long return value | 172 BasicType _return_type; // Tells if we have to restore double or long return value |
172 intptr_t _initial_info; // Platform dependent data for the sender frame (was FP on x86) | 173 intptr_t _initial_info; // Platform dependent data for the sender frame (was FP on x86) |
173 int _caller_actual_parameters; // The number of actual arguments at the | 174 int _caller_actual_parameters; // The number of actual arguments at the |
174 // interpreted caller of the deoptimized frame | 175 // interpreted caller of the deoptimized frame |
176 int _exec_mode; // exec_mode that can be changed during fetch_unroll_info | |
175 | 177 |
176 // The following fields are used as temps during the unpacking phase | 178 // The following fields are used as temps during the unpacking phase |
177 // (which is tight on registers, especially on x86). They really ought | 179 // (which is tight on registers, especially on x86). They really ought |
178 // to be PD variables but that involves moving this class into its own | 180 // to be PD variables but that involves moving this class into its own |
179 // file to use the pd include mechanism. Maybe in a later cleanup ... | 181 // file to use the pd include mechanism. Maybe in a later cleanup ... |
186 int caller_adjustment, | 188 int caller_adjustment, |
187 int caller_actual_parameters, | 189 int caller_actual_parameters, |
188 int number_of_frames, | 190 int number_of_frames, |
189 intptr_t* frame_sizes, | 191 intptr_t* frame_sizes, |
190 address* frames_pcs, | 192 address* frames_pcs, |
191 BasicType return_type); | 193 BasicType return_type, |
194 int exec_mode); | |
192 ~UnrollBlock(); | 195 ~UnrollBlock(); |
193 | 196 |
194 // Returns where a register is located. | 197 // Returns where a register is located. |
195 intptr_t* value_addr_at(int register_number) const; | 198 intptr_t* value_addr_at(int register_number) const; |
196 | 199 |
197 // Accessors | 200 // Accessors |
198 intptr_t* frame_sizes() const { return _frame_sizes; } | 201 intptr_t* frame_sizes() const { return _frame_sizes; } |
199 int number_of_frames() const { return _number_of_frames; } | 202 int number_of_frames() const { return _number_of_frames; } |
200 address* frame_pcs() const { return _frame_pcs ; } | 203 address* frame_pcs() const { return _frame_pcs ; } |
204 int exec_mode() const { return _exec_mode ; } | |
201 | 205 |
202 // Returns the total size of frames | 206 // Returns the total size of frames |
203 int size_of_frames() const; | 207 int size_of_frames() const; |
204 | 208 |
205 void set_initial_info(intptr_t info) { _initial_info = info; } | 209 void set_initial_info(intptr_t info) { _initial_info = info; } |
217 static int return_type_offset_in_bytes() { return offset_of(UnrollBlock, _return_type); } | 221 static int return_type_offset_in_bytes() { return offset_of(UnrollBlock, _return_type); } |
218 static int counter_temp_offset_in_bytes() { return offset_of(UnrollBlock, _counter_temp); } | 222 static int counter_temp_offset_in_bytes() { return offset_of(UnrollBlock, _counter_temp); } |
219 static int initial_info_offset_in_bytes() { return offset_of(UnrollBlock, _initial_info); } | 223 static int initial_info_offset_in_bytes() { return offset_of(UnrollBlock, _initial_info); } |
220 static int unpack_kind_offset_in_bytes() { return offset_of(UnrollBlock, _unpack_kind); } | 224 static int unpack_kind_offset_in_bytes() { return offset_of(UnrollBlock, _unpack_kind); } |
221 static int sender_sp_temp_offset_in_bytes() { return offset_of(UnrollBlock, _sender_sp_temp); } | 225 static int sender_sp_temp_offset_in_bytes() { return offset_of(UnrollBlock, _sender_sp_temp); } |
226 static int exec_mode_offset_in_bytes() { return offset_of(UnrollBlock, _exec_mode); } | |
222 | 227 |
223 BasicType return_type() const { return _return_type; } | 228 BasicType return_type() const { return _return_type; } |
224 void print(); | 229 void print(); |
225 }; | 230 }; |
226 | 231 |
228 // how to make room for the resulting interpreter frames. | 233 // how to make room for the resulting interpreter frames. |
229 // Called by assembly stub after execution has returned to | 234 // Called by assembly stub after execution has returned to |
230 // deoptimized frame. | 235 // deoptimized frame. |
231 // @argument thread. Thread where stub_frame resides. | 236 // @argument thread. Thread where stub_frame resides. |
232 // @see OptoRuntime::deoptimization_fetch_unroll_info_C | 237 // @see OptoRuntime::deoptimization_fetch_unroll_info_C |
233 static UnrollBlock* fetch_unroll_info(JavaThread* thread); | 238 static UnrollBlock* fetch_unroll_info(JavaThread* thread, int exec_mode); |
234 | 239 |
235 //** Unpacks vframeArray onto execution stack | 240 //** Unpacks vframeArray onto execution stack |
236 // Called by assembly stub after execution has returned to | 241 // Called by assembly stub after execution has returned to |
237 // deoptimized frame and after the stack unrolling. | 242 // deoptimized frame and after the stack unrolling. |
238 // @argument thread. Thread where stub_frame resides. | 243 // @argument thread. Thread where stub_frame resides. |
253 // so caller of the deoptimized frame will get back the values it expects. | 258 // so caller of the deoptimized frame will get back the values it expects. |
254 static void unwind_callee_save_values(frame* f, vframeArray* vframe_array); | 259 static void unwind_callee_save_values(frame* f, vframeArray* vframe_array); |
255 | 260 |
256 //** Performs an uncommon trap for compiled code. | 261 //** Performs an uncommon trap for compiled code. |
257 // The top most compiler frame is converted into interpreter frames | 262 // The top most compiler frame is converted into interpreter frames |
258 static UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index); | 263 static UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index, jint exec_mode); |
259 // Helper routine that enters the VM and may block | 264 // Helper routine that enters the VM and may block |
260 static void uncommon_trap_inner(JavaThread* thread, jint unloaded_class_index); | 265 static void uncommon_trap_inner(JavaThread* thread, jint unloaded_class_index); |
261 | 266 |
262 //** Deoptimizes the frame identified by id. | 267 //** Deoptimizes the frame identified by id. |
263 // Only called from VMDeoptimizeFrame | 268 // Only called from VMDeoptimizeFrame |
405 bool& ret_maybe_prior_recompile); | 410 bool& ret_maybe_prior_recompile); |
406 // class loading support for uncommon trap | 411 // class loading support for uncommon trap |
407 static void load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS); | 412 static void load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS); |
408 static void load_class_by_index(constantPoolHandle constant_pool, int index); | 413 static void load_class_by_index(constantPoolHandle constant_pool, int index); |
409 | 414 |
410 static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread); | 415 static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread, int exec_mode); |
411 | 416 |
412 static DeoptAction _unloaded_action; // == Action_reinterpret; | 417 static DeoptAction _unloaded_action; // == Action_reinterpret; |
413 static const char* _trap_reason_name[]; | 418 static const char* _trap_reason_name[]; |
414 static const char* _trap_action_name[]; | 419 static const char* _trap_action_name[]; |
415 | 420 |