src/share/vm/ci/ciStreams.cpp

changeset 4133
f6b0eb4e44cf
parent 4037
da91efe96a93
child 6876
710a3c8b516e
child 9745
0e3d6188f198
     1.1 --- a/src/share/vm/ci/ciStreams.cpp	Fri Sep 28 14:36:20 2012 -0700
     1.2 +++ b/src/share/vm/ci/ciStreams.cpp	Mon Oct 01 14:50:10 2012 -0700
     1.3 @@ -364,12 +364,15 @@
     1.4    constantPoolHandle cpool(_method->get_Method()->constants());
     1.5    ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder);
     1.6    will_link = m->is_loaded();
     1.7 -  // Get declared method signature and return it.
     1.8 -  if (has_optional_appendix()) {
     1.9 -    const int sig_index = get_method_signature_index();
    1.10 -    Symbol* sig_sym = cpool->symbol_at(sig_index);
    1.11 -    ciKlass* pool_holder = env->get_klass(cpool->pool_holder());
    1.12 -    (*declared_signature_result) = new (env->arena()) ciSignature(pool_holder, cpool, env->get_symbol(sig_sym));
    1.13 +
    1.14 +  // Use the MethodType stored in the CP cache to create a signature
    1.15 +  // with correct types (in respect to class loaders).
    1.16 +  if (has_method_type()) {
    1.17 +    ciSymbol*     sig_sym     = env->get_symbol(cpool->symbol_at(get_method_signature_index()));
    1.18 +    ciKlass*      pool_holder = env->get_klass(cpool->pool_holder());
    1.19 +    ciMethodType* method_type = get_method_type();
    1.20 +    ciSignature* declared_signature = new (env->arena()) ciSignature(pool_holder, sig_sym, method_type);
    1.21 +    (*declared_signature_result) = declared_signature;
    1.22    } else {
    1.23      (*declared_signature_result) = m->signature();
    1.24    }
    1.25 @@ -400,6 +403,31 @@
    1.26  }
    1.27  
    1.28  // ------------------------------------------------------------------
    1.29 +// ciBytecodeStream::has_method_type
    1.30 +//
    1.31 +// Returns true if there is a MethodType argument stored in the
    1.32 +// constant pool cache at the current bci.
    1.33 +bool ciBytecodeStream::has_method_type() {
    1.34 +  GUARDED_VM_ENTRY(
    1.35 +    constantPoolHandle cpool(_method->get_Method()->constants());
    1.36 +    return ConstantPool::has_method_type_at_if_loaded(cpool, get_method_index());
    1.37 +  )
    1.38 +}
    1.39 +
    1.40 +// ------------------------------------------------------------------
    1.41 +// ciBytecodeStream::get_method_type
    1.42 +//
    1.43 +// Return the MethodType stored in the constant pool cache at
    1.44 +// the current bci.
    1.45 +ciMethodType* ciBytecodeStream::get_method_type() {
    1.46 +  GUARDED_VM_ENTRY(
    1.47 +    constantPoolHandle cpool(_method->get_Method()->constants());
    1.48 +    oop method_type_oop = ConstantPool::method_type_at_if_loaded(cpool, get_method_index());
    1.49 +    return CURRENT_ENV->get_object(method_type_oop)->as_method_type();
    1.50 +  )
    1.51 +}
    1.52 +
    1.53 +// ------------------------------------------------------------------
    1.54  // ciBytecodeStream::get_declared_method_holder
    1.55  //
    1.56  // Get the declared holder of the currently referenced method.

mercurial