< prev index next >
src/share/vm/runtime/deoptimization.cpp
Print this page
*** 66,76 ****
int caller_adjustment,
int caller_actual_parameters,
int number_of_frames,
intptr_t* frame_sizes,
address* frame_pcs,
! BasicType return_type) {
_size_of_deoptimized_frame = size_of_deoptimized_frame;
_caller_adjustment = caller_adjustment;
_caller_actual_parameters = caller_actual_parameters;
_number_of_frames = number_of_frames;
_frame_sizes = frame_sizes;
--- 66,77 ----
int caller_adjustment,
int caller_actual_parameters,
int number_of_frames,
intptr_t* frame_sizes,
address* frame_pcs,
! BasicType return_type,
! int exec_mode) {
_size_of_deoptimized_frame = size_of_deoptimized_frame;
_caller_adjustment = caller_adjustment;
_caller_actual_parameters = caller_actual_parameters;
_number_of_frames = number_of_frames;
_frame_sizes = frame_sizes;
*** 78,91 ****
_register_block = NEW_C_HEAP_ARRAY(intptr_t, RegisterMap::reg_count * 2, mtCompiler);
_return_type = return_type;
_initial_info = 0;
// PD (x86 only)
_counter_temp = 0;
! _unpack_kind = 0;
_sender_sp_temp = 0;
_total_frame_sizes = size_of_frames();
}
Deoptimization::UnrollBlock::~UnrollBlock() {
FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes);
--- 79,93 ----
_register_block = NEW_C_HEAP_ARRAY(intptr_t, RegisterMap::reg_count * 2, mtCompiler);
_return_type = return_type;
_initial_info = 0;
// PD (x86 only)
_counter_temp = 0;
! _unpack_kind = exec_mode;
_sender_sp_temp = 0;
_total_frame_sizes = size_of_frames();
+ assert(exec_mode >= 0 && exec_mode < Unpack_LIMIT, "Unexpected exec_mode");
}
Deoptimization::UnrollBlock::~UnrollBlock() {
FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes);
*** 126,136 ****
// In order to make fetch_unroll_info work properly with escape
// analysis, The method was changed from JRT_LEAF to JRT_BLOCK_ENTRY and
// ResetNoHandleMark and HandleMark were removed from it. The actual reallocation
// of previously eliminated objects occurs in realloc_objects, which is
// called from the method fetch_unroll_info_helper below.
! JRT_BLOCK_ENTRY(Deoptimization::UnrollBlock*, Deoptimization::fetch_unroll_info(JavaThread* thread))
// It is actually ok to allocate handles in a leaf method. It causes no safepoints,
// but makes the entry a little slower. There is however a little dance we have to
// do in debug mode to get around the NoHandleMark code in the JRT_LEAF macro
// fetch_unroll_info() is called at the beginning of the deoptimization
--- 128,138 ----
// In order to make fetch_unroll_info work properly with escape
// analysis, The method was changed from JRT_LEAF to JRT_BLOCK_ENTRY and
// ResetNoHandleMark and HandleMark were removed from it. The actual reallocation
// of previously eliminated objects occurs in realloc_objects, which is
// called from the method fetch_unroll_info_helper below.
! JRT_BLOCK_ENTRY(Deoptimization::UnrollBlock*, Deoptimization::fetch_unroll_info(JavaThread* thread, int exec_mode))
// It is actually ok to allocate handles in a leaf method. It causes no safepoints,
// but makes the entry a little slower. There is however a little dance we have to
// do in debug mode to get around the NoHandleMark code in the JRT_LEAF macro
// fetch_unroll_info() is called at the beginning of the deoptimization
*** 140,155 ****
if (TraceDeoptimization) {
tty->print_cr("Deoptimizing thread " INTPTR_FORMAT, p2i(thread));
}
thread->inc_in_deopt_handler();
! return fetch_unroll_info_helper(thread);
JRT_END
// This is factored, since it is both called from a JRT_LEAF (deoptimization) and a JRT_ENTRY (uncommon_trap)
! Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread* thread) {
// Note: there is a safepoint safety issue here. No matter whether we enter
// via vanilla deopt or uncommon trap we MUST NOT stop at a safepoint once
// the vframeArray is created.
//
--- 142,157 ----
if (TraceDeoptimization) {
tty->print_cr("Deoptimizing thread " INTPTR_FORMAT, p2i(thread));
}
thread->inc_in_deopt_handler();
! return fetch_unroll_info_helper(thread, exec_mode);
JRT_END
// This is factored, since it is both called from a JRT_LEAF (deoptimization) and a JRT_ENTRY (uncommon_trap)
! Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread* thread, int exec_mode) {
// Note: there is a safepoint safety issue here. No matter whether we enter
// via vanilla deopt or uncommon trap we MUST NOT stop at a safepoint once
// the vframeArray is created.
//
*** 184,193 ****
--- 186,208 ----
vf = vf->sender();
}
assert(vf->is_compiled_frame(), "Wrong frame type");
chunk->push(compiledVFrame::cast(vf));
+ ScopeDesc* trap_scope = chunk->at(0)->scope();
+ Handle exceptionObject;
+ if (trap_scope->rethrow_exception()) {
+ if (PrintDeoptimizationDetails) {
+ tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
+ }
+ GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
+ guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
+ ScopeValue* topOfStack = expressions->top();
+ exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
+ assert(exceptionObject() != NULL, "exception oop can not be null");
+ }
+
bool realloc_failures = false;
#if defined(COMPILER2) || INCLUDE_JVMCI
// Reallocate the non-escaping objects and restore their fields. Then
// relock objects if synchronization on them was eliminated.
*** 472,488 ****
#ifndef SHARK
assert(CodeCache::find_blob_unsafe(frame_pcs[0]) != NULL, "bad pc");
#endif // SHARK
UnrollBlock* info = new UnrollBlock(array->frame_size() * BytesPerWord,
caller_adjustment * BytesPerWord,
caller_was_method_handle ? 0 : callee_parameters,
number_of_frames,
frame_sizes,
frame_pcs,
! return_type);
// On some platforms, we need a way to pass some platform dependent
// information to the unpacking code so the skeletal frames come out
// correct (initial fp value, unextended sp, ...)
info->set_initial_info((intptr_t) array->sender().initial_deoptimization_info());
--- 487,511 ----
#ifndef SHARK
assert(CodeCache::find_blob_unsafe(frame_pcs[0]) != NULL, "bad pc");
#endif // SHARK
+ #ifdef INCLUDE_JVMCI
+ if (exceptionObject() != NULL) {
+ thread->set_exception_oop(exceptionObject());
+ exec_mode = Unpack_exception;
+ }
+ #endif
+
UnrollBlock* info = new UnrollBlock(array->frame_size() * BytesPerWord,
caller_adjustment * BytesPerWord,
caller_was_method_handle ? 0 : callee_parameters,
number_of_frames,
frame_sizes,
frame_pcs,
! return_type,
! exec_mode);
// On some platforms, we need a way to pass some platform dependent
// information to the unpacking code so the skeletal frames come out
// correct (initial fp value, unextended sp, ...)
info->set_initial_info((intptr_t) array->sender().initial_deoptimization_info());
*** 1493,1514 ****
thread->set_pending_transfer_to_interpreter(true);
}
#endif
Bytecodes::Code trap_bc = trap_method->java_code_at(trap_bci);
-
- if (trap_scope->rethrow_exception()) {
- if (PrintDeoptimizationDetails) {
- tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_method->method_holder()->name()->as_C_string(), trap_method->name()->as_C_string(), trap_bci);
- }
- GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
- guarantee(expressions != NULL, "must have exception to throw");
- ScopeValue* topOfStack = expressions->top();
- Handle topOfStackObj = StackValue::create_stack_value(&fr, ®_map, topOfStack)->get_obj();
- THREAD->set_pending_exception(topOfStackObj(), NULL, 0);
- }
-
// Record this event in the histogram.
gather_statistics(reason, action, trap_bc);
// Ensure that we can record deopt. history:
// Need MDO to record RTM code generation state.
--- 1516,1525 ----
*** 1983,2002 ****
ignore_this_trap_count,
ignore_maybe_prior_trap,
ignore_maybe_prior_recompile);
}
! Deoptimization::UnrollBlock* Deoptimization::uncommon_trap(JavaThread* thread, jint trap_request) {
if (TraceDeoptimization) {
tty->print("Uncommon trap ");
}
// Still in Java no safepoints
{
// This enters VM and may safepoint
uncommon_trap_inner(thread, trap_request);
}
! return fetch_unroll_info_helper(thread);
}
// Local derived constants.
// Further breakdown of DataLayout::trap_state, as promised by DataLayout.
const int DS_REASON_MASK = DataLayout::trap_mask >> 1;
--- 1994,2013 ----
ignore_this_trap_count,
ignore_maybe_prior_trap,
ignore_maybe_prior_recompile);
}
! Deoptimization::UnrollBlock* Deoptimization::uncommon_trap(JavaThread* thread, jint trap_request, jint exec_mode) {
if (TraceDeoptimization) {
tty->print("Uncommon trap ");
}
// Still in Java no safepoints
{
// This enters VM and may safepoint
uncommon_trap_inner(thread, trap_request);
}
! return fetch_unroll_info_helper(thread, exec_mode);
}
// Local derived constants.
// Further breakdown of DataLayout::trap_state, as promised by DataLayout.
const int DS_REASON_MASK = DataLayout::trap_mask >> 1;
< prev index next >