1.1 --- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp Wed Mar 20 17:04:45 2013 -0700 1.2 +++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp Thu Mar 21 09:27:54 2013 +0100 1.3 @@ -101,6 +101,15 @@ 1.4 1.5 void RangeCheckStub::emit_code(LIR_Assembler* ce) { 1.6 __ bind(_entry); 1.7 + if (_info->deoptimize_on_exception()) { 1.8 + address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id); 1.9 + __ call(RuntimeAddress(a)); 1.10 + ce->add_call_info_here(_info); 1.11 + ce->verify_oop_map(_info); 1.12 + debug_only(__ should_not_reach_here()); 1.13 + return; 1.14 + } 1.15 + 1.16 // pass the array index on stack because all registers must be preserved 1.17 if (_index->is_cpu_register()) { 1.18 ce->store_parameter(_index->as_register(), 0); 1.19 @@ -115,9 +124,22 @@ 1.20 } 1.21 __ call(RuntimeAddress(Runtime1::entry_for(stub_id))); 1.22 ce->add_call_info_here(_info); 1.23 + ce->verify_oop_map(_info); 1.24 debug_only(__ should_not_reach_here()); 1.25 } 1.26 1.27 +PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) { 1.28 + _info = new CodeEmitInfo(info); 1.29 +} 1.30 + 1.31 +void PredicateFailedStub::emit_code(LIR_Assembler* ce) { 1.32 + __ bind(_entry); 1.33 + address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id); 1.34 + __ call(RuntimeAddress(a)); 1.35 + ce->add_call_info_here(_info); 1.36 + ce->verify_oop_map(_info); 1.37 + debug_only(__ should_not_reach_here()); 1.38 +} 1.39 1.40 void DivByZeroStub::emit_code(LIR_Assembler* ce) { 1.41 if (_offset != -1) { 1.42 @@ -414,10 +436,19 @@ 1.43 1.44 1.45 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) { 1.46 + address a; 1.47 + if (_info->deoptimize_on_exception()) { 1.48 + // Deoptimize, do not throw the exception, because it is probably wrong to do it here. 1.49 + a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id); 1.50 + } else { 1.51 + a = Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id); 1.52 + } 1.53 + 1.54 ce->compilation()->implicit_exception_table()->append(_offset, __ offset()); 1.55 __ bind(_entry); 1.56 - __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id))); 1.57 + __ call(RuntimeAddress(a)); 1.58 ce->add_call_info_here(_info); 1.59 + ce->verify_oop_map(_info); 1.60 debug_only(__ should_not_reach_here()); 1.61 } 1.62