8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place

Reviewed-by: kvn, roland
This commit is contained in:
Vladimir Ivanov 2014-06-10 10:00:59 +00:00
parent 5067eae483
commit ea0470002e
4 changed files with 113 additions and 17 deletions

View file

@ -2513,7 +2513,7 @@ void GraphKit::merge_memory(Node* new_mem, Node* region, int new_path) {
//------------------------------make_slow_call_ex------------------------------
// Make the exception handler hookups for the slow call
void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj) {
void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj, bool deoptimize) {
if (stopped()) return;
// Make a catch node with just two handlers: fall-through and catch-all
@ -2527,11 +2527,17 @@ void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool sep
set_i_o(i_o);
if (excp != top()) {
// Create an exception state also.
// Use an exact type if the caller has specified a specific exception.
const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull);
Node* ex_oop = new CreateExNode(ex_type, control(), i_o);
add_exception_state(make_exception_state(_gvn.transform(ex_oop)));
if (deoptimize) {
// Deoptimize if an exception is caught. Don't construct exception state in this case.
uncommon_trap(Deoptimization::Reason_unhandled,
Deoptimization::Action_none);
} else {
// Create an exception state also.
// Use an exact type if the caller has specified a specific exception.
const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull);
Node* ex_oop = new CreateExNode(ex_type, control(), i_o);
add_exception_state(make_exception_state(_gvn.transform(ex_oop)));
}
}
}
@ -3352,7 +3358,8 @@ static void hook_memory_on_init(GraphKit& kit, int alias_idx,
//---------------------------set_output_for_allocation-------------------------
Node* GraphKit::set_output_for_allocation(AllocateNode* alloc,
const TypeOopPtr* oop_type) {
const TypeOopPtr* oop_type,
bool deoptimize_on_exception) {
int rawidx = Compile::AliasIdxRaw;
alloc->set_req( TypeFunc::FramePtr, frameptr() );
add_safepoint_edges(alloc);
@ -3360,7 +3367,7 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc,
set_control( _gvn.transform(new ProjNode(allocx, TypeFunc::Control) ) );
// create memory projection for i_o
set_memory ( _gvn.transform( new ProjNode(allocx, TypeFunc::Memory, true) ), rawidx );
make_slow_call_ex(allocx, env()->Throwable_klass(), true);
make_slow_call_ex(allocx, env()->Throwable_klass(), true, deoptimize_on_exception);
// create a memory projection as for the normal control path
Node* malloc = _gvn.transform(new ProjNode(allocx, TypeFunc::Memory));
@ -3438,9 +3445,11 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc,
// The optional arguments are for specialized use by intrinsics:
// - If 'extra_slow_test' if not null is an extra condition for the slow-path.
// - If 'return_size_val', report the the total object size to the caller.
// - deoptimize_on_exception controls how Java exceptions are handled (rethrow vs deoptimize)
Node* GraphKit::new_instance(Node* klass_node,
Node* extra_slow_test,
Node* *return_size_val) {
Node* *return_size_val,
bool deoptimize_on_exception) {
// Compute size in doublewords
// The size is always an integral number of doublewords, represented
// as a positive bytewise size stored in the klass's layout_helper.
@ -3508,7 +3517,7 @@ Node* GraphKit::new_instance(Node* klass_node,
size, klass_node,
initial_slow_test);
return set_output_for_allocation(alloc, oop_type);
return set_output_for_allocation(alloc, oop_type, deoptimize_on_exception);
}
//-------------------------------new_array-------------------------------------
@ -3518,7 +3527,8 @@ Node* GraphKit::new_instance(Node* klass_node,
Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
Node* length, // number of array elements
int nargs, // number of arguments to push back for uncommon trap
Node* *return_size_val) {
Node* *return_size_val,
bool deoptimize_on_exception) {
jint layout_con = Klass::_lh_neutral_value;
Node* layout_val = get_layout_helper(klass_node, layout_con);
int layout_is_con = (layout_val == NULL);
@ -3661,7 +3671,7 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
}
Node* javaoop = set_output_for_allocation(alloc, ary_type);
Node* javaoop = set_output_for_allocation(alloc, ary_type, deoptimize_on_exception);
// Cast length on remaining path to be as narrow as possible
if (map()->find_edge(length) >= 0) {