8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)

Fri, 11 Oct 2013 10:14:02 -0700

author
twisti
date
Fri, 11 Oct 2013 10:14:02 -0700
changeset 5915
8b80b262e501
parent 5914
d13d7aba8c12
child 5918
dd2cf1d1248b
child 5919
469216acdb28

8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
Reviewed-by: kvn, iveresov

src/cpu/sparc/vm/c1_Runtime1_sparc.cpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_Runtime1.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/runtime.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/thread.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Wed Oct 09 16:32:21 2013 +0200
     1.2 +++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Oct 11 10:14:02 2013 -0700
     1.3 @@ -1067,6 +1067,25 @@
     1.4  
     1.5    __ verify_not_null_oop(Oexception);
     1.6  
     1.7 +#ifdef ASSERT
     1.8 +  // check that fields in JavaThread for exception oop and issuing pc are
     1.9 +  // empty before writing to them
    1.10 +  Label oop_empty;
    1.11 +  Register scratch = I7;  // We can use I7 here because it's overwritten later anyway.
    1.12 +  __ ld_ptr(Address(G2_thread, JavaThread::exception_oop_offset()), scratch);
    1.13 +  __ br_null(scratch, false, Assembler::pt, oop_empty);
    1.14 +  __ delayed()->nop();
    1.15 +  __ stop("exception oop already set");
    1.16 +  __ bind(oop_empty);
    1.17 +
    1.18 +  Label pc_empty;
    1.19 +  __ ld_ptr(Address(G2_thread, JavaThread::exception_pc_offset()), scratch);
    1.20 +  __ br_null(scratch, false, Assembler::pt, pc_empty);
    1.21 +  __ delayed()->nop();
    1.22 +  __ stop("exception pc already set");
    1.23 +  __ bind(pc_empty);
    1.24 +#endif
    1.25 +
    1.26    // save the exception and issuing pc in the thread
    1.27    __ st_ptr(Oexception,  G2_thread, in_bytes(JavaThread::exception_oop_offset()));
    1.28    __ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset()));
     2.1 --- a/src/share/vm/c1/c1_Runtime1.cpp	Wed Oct 09 16:32:21 2013 +0200
     2.2 +++ b/src/share/vm/c1/c1_Runtime1.cpp	Fri Oct 11 10:14:02 2013 -0700
     2.3 @@ -542,8 +542,7 @@
     2.4      // exception handler can cause class loading, which might throw an
     2.5      // exception and those fields are expected to be clear during
     2.6      // normal bytecode execution.
     2.7 -    thread->set_exception_oop(NULL);
     2.8 -    thread->set_exception_pc(NULL);
     2.9 +    thread->clear_exception_oop_and_pc();
    2.10  
    2.11      continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
    2.12      // If an exception was thrown during exception dispatch, the exception oop may have changed
     3.1 --- a/src/share/vm/opto/runtime.cpp	Wed Oct 09 16:32:21 2013 +0200
     3.2 +++ b/src/share/vm/opto/runtime.cpp	Fri Oct 11 10:14:02 2013 -0700
     3.3 @@ -976,30 +976,36 @@
     3.4    address handler_address = NULL;
     3.5  
     3.6    Handle exception(thread, thread->exception_oop());
     3.7 +  address pc = thread->exception_pc();
     3.8 +
     3.9 +  // Clear out the exception oop and pc since looking up an
    3.10 +  // exception handler can cause class loading, which might throw an
    3.11 +  // exception and those fields are expected to be clear during
    3.12 +  // normal bytecode execution.
    3.13 +  thread->clear_exception_oop_and_pc();
    3.14  
    3.15    if (TraceExceptions) {
    3.16 -    trace_exception(exception(), thread->exception_pc(), "");
    3.17 +    trace_exception(exception(), pc, "");
    3.18    }
    3.19 +
    3.20    // for AbortVMOnException flag
    3.21    NOT_PRODUCT(Exceptions::debug_check_abort(exception));
    3.22  
    3.23 -  #ifdef ASSERT
    3.24 -    if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
    3.25 -      // should throw an exception here
    3.26 -      ShouldNotReachHere();
    3.27 -    }
    3.28 -  #endif
    3.29 -
    3.30 +#ifdef ASSERT
    3.31 +  if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
    3.32 +    // should throw an exception here
    3.33 +    ShouldNotReachHere();
    3.34 +  }
    3.35 +#endif
    3.36  
    3.37    // new exception handling: this method is entered only from adapters
    3.38    // exceptions from compiled java methods are handled in compiled code
    3.39    // using rethrow node
    3.40  
    3.41 -  address pc = thread->exception_pc();
    3.42    nm = CodeCache::find_nmethod(pc);
    3.43    assert(nm != NULL, "No NMethod found");
    3.44    if (nm->is_native_method()) {
    3.45 -    fatal("Native mathod should not have path to exception handling");
    3.46 +    fatal("Native method should not have path to exception handling");
    3.47    } else {
    3.48      // we are switching to old paradigm: search for exception handler in caller_frame
    3.49      // instead in exception handler of caller_frame.sender()
    3.50 @@ -1346,7 +1352,8 @@
    3.51    tty->print(" in ");
    3.52    CodeBlob* blob = CodeCache::find_blob(exception_pc);
    3.53    if (blob->is_nmethod()) {
    3.54 -    ((nmethod*)blob)->method()->print_value();
    3.55 +    nmethod* nm = blob->as_nmethod_or_null();
    3.56 +    nm->method()->print_value();
    3.57    } else if (blob->is_runtime_stub()) {
    3.58      tty->print("<runtime-stub>");
    3.59    } else {
     4.1 --- a/src/share/vm/runtime/thread.hpp	Wed Oct 09 16:32:21 2013 +0200
     4.2 +++ b/src/share/vm/runtime/thread.hpp	Fri Oct 11 10:14:02 2013 -0700
     4.3 @@ -1283,6 +1283,11 @@
     4.4    void set_exception_handler_pc(address a)       { _exception_handler_pc = a; }
     4.5    void set_is_method_handle_return(bool value)   { _is_method_handle_return = value ? 1 : 0; }
     4.6  
     4.7 +  void clear_exception_oop_and_pc() {
     4.8 +    set_exception_oop(NULL);
     4.9 +    set_exception_pc(NULL);
    4.10 +  }
    4.11 +
    4.12    // Stack overflow support
    4.13    inline size_t stack_available(address cur_sp);
    4.14    address stack_yellow_zone_base()

mercurial