# HG changeset patch # User Lukas Stadler # Date 1314200412 -7200 # Node ID bc95d122df79ee986a901d29b48830fa74a884da # Parent b2cd623a93adee1f5b9b016034dcc240e39ec0ed added runtime call to supply info upon deoptimization diff -r b2cd623a93ad -r bc95d122df79 src/cpu/x86/vm/c1_Runtime1_x86.cpp --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp Wed Aug 24 14:22:34 2011 +0200 +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp Wed Aug 24 17:40:12 2011 +0200 @@ -1921,6 +1921,12 @@ break; } + case graal_set_deopt_info_id: { + __ movptr(Address(r15_thread, JavaThread::graal_deopt_info_offset()), rscratch1); + __ ret(0); + break; + } + case graal_create_null_pointer_exception_id: { __ enter(); oop_maps = new OopMapSet(); diff -r b2cd623a93ad -r bc95d122df79 src/share/vm/c1/c1_Runtime1.cpp --- a/src/share/vm/c1/c1_Runtime1.cpp Wed Aug 24 14:22:34 2011 +0200 +++ b/src/share/vm/c1/c1_Runtime1.cpp Wed Aug 24 17:40:12 2011 +0200 @@ -206,6 +206,7 @@ case graal_slow_subtype_check_id: case graal_arithmetic_frem_id: case graal_arithmetic_drem_id: + case graal_set_deopt_info_id: #ifndef TIERED case counter_overflow_id: // Not generated outside the tiered world #endif diff -r b2cd623a93ad -r bc95d122df79 src/share/vm/c1/c1_Runtime1.hpp --- a/src/share/vm/c1/c1_Runtime1.hpp Wed Aug 24 14:22:34 2011 +0200 +++ b/src/share/vm/c1/c1_Runtime1.hpp Wed Aug 24 17:40:12 2011 +0200 @@ -78,6 +78,7 @@ stub(graal_monitorenter) \ stub(graal_monitorexit) \ stub(graal_verify_pointer) \ + stub(graal_set_deopt_info) \ stub(graal_create_null_pointer_exception) \ stub(graal_create_out_of_bounds_exception) \ last_entry(number_of_ids) diff -r b2cd623a93ad -r bc95d122df79 src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Wed Aug 24 14:22:34 2011 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Wed Aug 24 17:40:12 2011 +0200 @@ -597,6 +597,10 @@ call->set_destination(Runtime1::entry_for(Runtime1::graal_handle_exception_id)); _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); TRACE_graal_3("CiRuntimeCall::HandleException()"); + } else if (runtime_call == CiRuntimeCall::SetDeoptInfo()) { + call->set_destination(Runtime1::entry_for(Runtime1::graal_set_deopt_info_id)); + _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); + TRACE_graal_3("CiRuntimeCall::SetDeoptInfo()"); } else if (runtime_call == CiRuntimeCall::CreateNullPointerException()) { call->set_destination(Runtime1::entry_for(Runtime1::graal_create_null_pointer_exception_id)); _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand); diff -r b2cd623a93ad -r bc95d122df79 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Wed Aug 24 14:22:34 2011 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Wed Aug 24 17:40:12 2011 +0200 @@ -177,6 +177,7 @@ static_oop_field(CiRuntimeCall, UnwindException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ static_oop_field(CiRuntimeCall, RegisterFinalizer, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ static_oop_field(CiRuntimeCall, HandleException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ + static_oop_field(CiRuntimeCall, SetDeoptInfo, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ static_oop_field(CiRuntimeCall, CreateNullPointerException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ static_oop_field(CiRuntimeCall, CreateOutOfBoundsException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ static_oop_field(CiRuntimeCall, OSRMigrationEnd, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ diff -r b2cd623a93ad -r bc95d122df79 src/share/vm/runtime/deoptimization.cpp --- a/src/share/vm/runtime/deoptimization.cpp Wed Aug 24 14:22:34 2011 +0200 +++ b/src/share/vm/runtime/deoptimization.cpp Wed Aug 24 17:40:12 2011 +0200 @@ -1265,6 +1265,18 @@ if (TraceDeoptimization) { tty->print_cr("Deoptimization: bci=%d pc=%d, relative_pc=%d, method=%s", trap_scope->bci(), fr.pc(), fr.pc() - nm->code_begin(), trap_scope->method()->name()->as_C_string()); + if (thread->graal_deopt_info() != NULL) { + oop deopt_info = thread->graal_deopt_info(); + if (java_lang_String::is_instance(deopt_info)) { + char buf[1024]; + java_lang_String::as_utf8_string(deopt_info, buf, 1024); + tty->print_cr("deopt info: %s", buf); + } else { + tty->print_cr("deopt info:"); + deopt_info->print(); + } + thread->set_graal_deopt_info(NULL); + } } methodHandle trap_method = trap_scope->method(); diff -r b2cd623a93ad -r bc95d122df79 src/share/vm/runtime/thread.cpp --- a/src/share/vm/runtime/thread.cpp Wed Aug 24 14:22:34 2011 +0200 +++ b/src/share/vm/runtime/thread.cpp Wed Aug 24 17:40:12 2011 +0200 @@ -1272,6 +1272,7 @@ _in_deopt_handler = 0; _doing_unsafe_access = false; _stack_guard_state = stack_guard_unused; + _graal_deopt_info = NULL; _exception_oop = NULL; _exception_pc = 0; _exception_handler_pc = 0; @@ -2550,6 +2551,7 @@ f->do_oop((oop*) &_threadObj); f->do_oop((oop*) &_vm_result); f->do_oop((oop*) &_vm_result_2); + f->do_oop((oop*) &_graal_deopt_info); f->do_oop((oop*) &_exception_oop); f->do_oop((oop*) &_pending_async_exception); diff -r b2cd623a93ad -r bc95d122df79 src/share/vm/runtime/thread.hpp --- a/src/share/vm/runtime/thread.hpp Wed Aug 24 14:22:34 2011 +0200 +++ b/src/share/vm/runtime/thread.hpp Wed Aug 24 17:40:12 2011 +0200 @@ -840,6 +840,8 @@ // graal needs some place to put the dimensions jint graal_multinewarray_storage[256]; + volatile oop _graal_deopt_info; + StackGuardState _stack_guard_state; // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is @@ -1194,6 +1196,9 @@ MemRegion deferred_card_mark() const { return _deferred_card_mark; } void set_deferred_card_mark(MemRegion mr) { _deferred_card_mark = mr; } + oop graal_deopt_info() const { return _graal_deopt_info; } + void set_graal_deopt_info(oop o) { _graal_deopt_info = o; } + // Exception handling for compiled methods oop exception_oop() const { return _exception_oop; } int exception_stack_size() const { return _exception_stack_size; } @@ -1275,6 +1280,7 @@ static ByteSize thread_state_offset() { return byte_offset_of(JavaThread, _thread_state ); } static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc ); } static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread ); } + static ByteSize graal_deopt_info_offset() { return byte_offset_of(JavaThread, _graal_deopt_info ); } static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop ); } static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc ); } static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); }