src/share/vm/ci/ciStreams.cpp

changeset 4037
da91efe96a93
parent 4021
7f813940ac35
child 4133
f6b0eb4e44cf
     1.1 --- a/src/share/vm/ci/ciStreams.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/ci/ciStreams.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -23,7 +23,6 @@
    1.11   */
    1.12  
    1.13  #include "precompiled.hpp"
    1.14 -#include "ci/ciCPCache.hpp"
    1.15  #include "ci/ciCallSite.hpp"
    1.16  #include "ci/ciConstant.hpp"
    1.17  #include "ci/ciField.hpp"
    1.18 @@ -186,7 +185,7 @@
    1.19  // or checkcast, get the referenced klass.
    1.20  ciKlass* ciBytecodeStream::get_klass(bool& will_link) {
    1.21    VM_ENTRY_MARK;
    1.22 -  constantPoolHandle cpool(_method->get_methodOop()->constants());
    1.23 +  constantPoolHandle cpool(_method->get_Method()->constants());
    1.24    return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
    1.25  }
    1.26  
    1.27 @@ -211,12 +210,14 @@
    1.28  
    1.29  // ------------------------------------------------------------------
    1.30  // ciBytecodeStream::get_constant_pool_index
    1.31 -// Decode any CP cache index into a regular pool index.
    1.32 +// Decode any reference index into a regular pool index.
    1.33  int ciBytecodeStream::get_constant_pool_index() const {
    1.34    // work-alike for Bytecode_loadconstant::pool_index()
    1.35    int index = get_constant_raw_index();
    1.36    if (has_cache_index()) {
    1.37 -    return get_cpcache()->get_pool_index(index);
    1.38 +    VM_ENTRY_MARK;
    1.39 +    constantPoolHandle cpool(_method->get_Method()->constants());
    1.40 +    return cpool->object_to_cp_index(index);
    1.41    }
    1.42    return index;
    1.43  }
    1.44 @@ -242,7 +243,7 @@
    1.45      pool_index = -1;
    1.46    }
    1.47    VM_ENTRY_MARK;
    1.48 -  constantPoolHandle cpool(_method->get_methodOop()->constants());
    1.49 +  constantPoolHandle cpool(_method->get_Method()->constants());
    1.50    return CURRENT_ENV->get_constant_by_index(cpool, pool_index, cache_index, _holder);
    1.51  }
    1.52  
    1.53 @@ -253,7 +254,7 @@
    1.54  // constant.
    1.55  constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
    1.56    VM_ENTRY_MARK;
    1.57 -  return _method->get_methodOop()->constants()->tag_at(index);
    1.58 +  return _method->get_Method()->constants()->tag_at(index);
    1.59  }
    1.60  
    1.61  // ------------------------------------------------------------------
    1.62 @@ -295,7 +296,7 @@
    1.63  // for checking linkability when retrieving the associated field.
    1.64  ciInstanceKlass* ciBytecodeStream::get_declared_field_holder() {
    1.65    VM_ENTRY_MARK;
    1.66 -  constantPoolHandle cpool(_method->get_methodOop()->constants());
    1.67 +  constantPoolHandle cpool(_method->get_Method()->constants());
    1.68    int holder_index = get_field_holder_index();
    1.69    bool ignore;
    1.70    return CURRENT_ENV->get_klass_by_index(cpool, holder_index, ignore, _holder)
    1.71 @@ -310,7 +311,7 @@
    1.72  // deoptimization information.
    1.73  int ciBytecodeStream::get_field_holder_index() {
    1.74    GUARDED_VM_ENTRY(
    1.75 -    constantPoolOop cpool = _holder->get_instanceKlass()->constants();
    1.76 +    ConstantPool* cpool = _holder->get_instanceKlass()->constants();
    1.77      return cpool->klass_ref_index_at(get_field_index());
    1.78    )
    1.79  }
    1.80 @@ -323,7 +324,7 @@
    1.81  // deoptimization information.
    1.82  int ciBytecodeStream::get_field_signature_index() {
    1.83    VM_ENTRY_MARK;
    1.84 -  constantPoolOop cpool = _holder->get_instanceKlass()->constants();
    1.85 +  ConstantPool* cpool = _holder->get_instanceKlass()->constants();
    1.86    int nt_index = cpool->name_and_type_ref_index_at(get_field_index());
    1.87    return cpool->signature_ref_index_at(nt_index);
    1.88  }
    1.89 @@ -360,14 +361,14 @@
    1.90  ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_signature_result) {
    1.91    VM_ENTRY_MARK;
    1.92    ciEnv* env = CURRENT_ENV;
    1.93 -  constantPoolHandle cpool(_method->get_methodOop()->constants());
    1.94 +  constantPoolHandle cpool(_method->get_Method()->constants());
    1.95    ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder);
    1.96    will_link = m->is_loaded();
    1.97    // Get declared method signature and return it.
    1.98    if (has_optional_appendix()) {
    1.99      const int sig_index = get_method_signature_index();
   1.100      Symbol* sig_sym = cpool->symbol_at(sig_index);
   1.101 -    ciKlass* pool_holder = env->get_object(cpool->pool_holder())->as_klass();
   1.102 +    ciKlass* pool_holder = env->get_klass(cpool->pool_holder());
   1.103      (*declared_signature_result) = new (env->arena()) ciSignature(pool_holder, cpool, env->get_symbol(sig_sym));
   1.104    } else {
   1.105      (*declared_signature_result) = m->signature();
   1.106 @@ -382,8 +383,8 @@
   1.107  // constant pool cache at the current bci.
   1.108  bool ciBytecodeStream::has_appendix() {
   1.109    VM_ENTRY_MARK;
   1.110 -  constantPoolHandle cpool(_method->get_methodOop()->constants());
   1.111 -  return constantPoolOopDesc::has_appendix_at_if_loaded(cpool, get_method_index());
   1.112 +  constantPoolHandle cpool(_method->get_Method()->constants());
   1.113 +  return ConstantPool::has_appendix_at_if_loaded(cpool, get_method_index());
   1.114  }
   1.115  
   1.116  // ------------------------------------------------------------------
   1.117 @@ -393,8 +394,8 @@
   1.118  // the current bci.
   1.119  ciObject* ciBytecodeStream::get_appendix() {
   1.120    VM_ENTRY_MARK;
   1.121 -  constantPoolHandle cpool(_method->get_methodOop()->constants());
   1.122 -  oop appendix_oop = constantPoolOopDesc::appendix_at_if_loaded(cpool, get_method_index());
   1.123 +  constantPoolHandle cpool(_method->get_Method()->constants());
   1.124 +  oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, get_method_index());
   1.125    return CURRENT_ENV->get_object(appendix_oop);
   1.126  }
   1.127  
   1.128 @@ -411,7 +412,7 @@
   1.129  // for checking linkability when retrieving the associated method.
   1.130  ciKlass* ciBytecodeStream::get_declared_method_holder() {
   1.131    VM_ENTRY_MARK;
   1.132 -  constantPoolHandle cpool(_method->get_methodOop()->constants());
   1.133 +  constantPoolHandle cpool(_method->get_Method()->constants());
   1.134    bool ignore;
   1.135    // report as MethodHandle for invokedynamic, which is syntactically classless
   1.136    if (cur_bc() == Bytecodes::_invokedynamic)
   1.137 @@ -426,7 +427,7 @@
   1.138  // referenced by the current bytecode.  Used for generating
   1.139  // deoptimization information.
   1.140  int ciBytecodeStream::get_method_holder_index() {
   1.141 -  constantPoolOop cpool = _method->get_methodOop()->constants();
   1.142 +  ConstantPool* cpool = _method->get_Method()->constants();
   1.143    return cpool->klass_ref_index_at(get_method_index());
   1.144  }
   1.145  
   1.146 @@ -438,7 +439,7 @@
   1.147  // deoptimization information.
   1.148  int ciBytecodeStream::get_method_signature_index() {
   1.149    GUARDED_VM_ENTRY(
   1.150 -    constantPoolOop cpool = _holder->get_instanceKlass()->constants();
   1.151 +    ConstantPool* cpool = _holder->get_instanceKlass()->constants();
   1.152      const int method_index = get_method_index();
   1.153      const int name_and_type_index = cpool->name_and_type_ref_index_at(method_index);
   1.154      return cpool->signature_ref_index_at(name_and_type_index);
   1.155 @@ -446,32 +447,12 @@
   1.156  }
   1.157  
   1.158  // ------------------------------------------------------------------
   1.159 -// ciBytecodeStream::get_cpcache
   1.160 -ciCPCache* ciBytecodeStream::get_cpcache() const {
   1.161 -  if (_cpcache == NULL) {
   1.162 +// ciBytecodeStream::get_resolved_references
   1.163 +ciObjArray* ciBytecodeStream::get_resolved_references() {
   1.164      VM_ENTRY_MARK;
   1.165      // Get the constant pool.
   1.166 -    constantPoolOop      cpool   = _holder->get_instanceKlass()->constants();
   1.167 -    constantPoolCacheOop cpcache = cpool->cache();
   1.168 +  ConstantPool*        cpool   = _holder->get_instanceKlass()->constants();
   1.169  
   1.170 -    *(ciCPCache**)&_cpcache = CURRENT_ENV->get_object(cpcache)->as_cpcache();
   1.171 +  // Create a resolved references array and return it.
   1.172 +  return CURRENT_ENV->get_object(cpool->resolved_references())->as_obj_array();
   1.173    }
   1.174 -  return _cpcache;
   1.175 -}
   1.176 -
   1.177 -// ------------------------------------------------------------------
   1.178 -// ciBytecodeStream::get_call_site
   1.179 -ciCallSite* ciBytecodeStream::get_call_site() {
   1.180 -  VM_ENTRY_MARK;
   1.181 -  // Get the constant pool.
   1.182 -  constantPoolOop      cpool   = _holder->get_instanceKlass()->constants();
   1.183 -  constantPoolCacheOop cpcache = cpool->cache();
   1.184 -
   1.185 -  // Get the CallSite from the constant pool cache.
   1.186 -  int method_index = get_method_index();
   1.187 -  ConstantPoolCacheEntry* cpcache_entry = cpcache->secondary_entry_at(method_index);
   1.188 -  oop call_site_oop = cpcache_entry->f1_as_instance();
   1.189 -
   1.190 -  // Create a CallSite object and return it.
   1.191 -  return CURRENT_ENV->get_object(call_site_oop)->as_call_site();
   1.192 -}

mercurial