8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata

Mon, 21 Nov 2016 05:29:59 +0000

author
shshahma
date
Mon, 21 Nov 2016 05:29:59 +0000
changeset 8652
057571442f86
parent 8651
a50ab9692b6f
child 8653
0ffee573412b

8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
Summary: Always obtain return type from declared_signature for Invoke::declared_type. TypeCast return value to declared_signature return type for inlined lforms.
Reviewed-by: kvn, kevinw

src/share/vm/c1/c1_GraphBuilder.cpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_Instruction.cpp file | annotate | diff | comparison | revisions
src/share/vm/ci/ciMethod.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Nov 17 16:06:56 2016 +0000
     1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Mon Nov 21 05:29:59 2016 +0000
     1.3 @@ -1485,6 +1485,21 @@
     1.4    // Check to see whether we are inlining. If so, Return
     1.5    // instructions become Gotos to the continuation point.
     1.6    if (continuation() != NULL) {
     1.7 +
     1.8 +    int invoke_bci = state()->caller_state()->bci();
     1.9 +
    1.10 +    if (x != NULL) {
    1.11 +      ciMethod* caller = state()->scope()->caller()->method();
    1.12 +      Bytecodes::Code invoke_raw_bc = caller->raw_code_at_bci(invoke_bci);
    1.13 +      if (invoke_raw_bc == Bytecodes::_invokehandle || invoke_raw_bc == Bytecodes::_invokedynamic) {
    1.14 +        ciType* declared_ret_type = caller->get_declared_signature_at_bci(invoke_bci)->return_type();
    1.15 +        if (declared_ret_type->is_klass() && x->exact_type() == NULL &&
    1.16 +            x->declared_type() != declared_ret_type && declared_ret_type != compilation()->env()->Object_klass()) {
    1.17 +          x = append(new TypeCast(declared_ret_type->as_klass(), x, copy_state_before()));
    1.18 +        }
    1.19 +      }
    1.20 +    }
    1.21 +
    1.22      assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
    1.23  
    1.24      if (compilation()->env()->dtrace_method_probes()) {
    1.25 @@ -1508,7 +1523,6 @@
    1.26      // State at end of inlined method is the state of the caller
    1.27      // without the method parameters on stack, including the
    1.28      // return value, if any, of the inlined method on operand stack.
    1.29 -    int invoke_bci = state()->caller_state()->bci();
    1.30      set_state(state()->caller_state()->copy_for_parsing());
    1.31      if (x != NULL) {
    1.32        state()->push(x->type(), x);
     2.1 --- a/src/share/vm/c1/c1_Instruction.cpp	Thu Nov 17 16:06:56 2016 +0000
     2.2 +++ b/src/share/vm/c1/c1_Instruction.cpp	Mon Nov 21 05:29:59 2016 +0000
     2.3 @@ -360,7 +360,8 @@
     2.4  }
     2.5  
     2.6  ciType* Invoke::declared_type() const {
     2.7 -  ciType *t = _target->signature()->return_type();
     2.8 +  ciSignature* declared_signature = state()->scope()->method()->get_declared_signature_at_bci(state()->bci());
     2.9 +  ciType *t = declared_signature->return_type();
    2.10    assert(t->basic_type() != T_VOID, "need return value of void method?");
    2.11    return t;
    2.12  }
     3.1 --- a/src/share/vm/ci/ciMethod.hpp	Thu Nov 17 16:06:56 2016 +0000
     3.2 +++ b/src/share/vm/ci/ciMethod.hpp	Mon Nov 21 05:29:59 2016 +0000
     3.3 @@ -243,11 +243,21 @@
     3.4  
     3.5    ciField*      get_field_at_bci( int bci, bool &will_link);
     3.6    ciMethod*     get_method_at_bci(int bci, bool &will_link, ciSignature* *declared_signature);
     3.7 +
     3.8 +  ciSignature*  get_declared_signature_at_bci(int bci) {
     3.9 +    bool ignored_will_link;
    3.10 +    ciSignature* declared_signature;
    3.11 +    get_method_at_bci(bci, ignored_will_link, &declared_signature);
    3.12 +    assert(declared_signature != NULL, "cannot be null");
    3.13 +    return declared_signature;
    3.14 +  }
    3.15 +
    3.16    ciMethod*     get_method_at_bci(int bci) {
    3.17      bool ignored_will_link;
    3.18      ciSignature* ignored_declared_signature;
    3.19      return get_method_at_bci(bci, ignored_will_link, &ignored_declared_signature);
    3.20    }
    3.21 +
    3.22    // Given a certain calling environment, find the monomorphic target
    3.23    // for the call.  Return NULL if the call is not monomorphic in
    3.24    // its calling environment.

mercurial