src/share/vm/ci/ciStreams.hpp

changeset 1957
136b78722a08
parent 1934
e9ff18c4ace7
child 2314
f95d63e2154a
     1.1 --- a/src/share/vm/ci/ciStreams.hpp	Mon Jun 07 14:17:01 2010 -0700
     1.2 +++ b/src/share/vm/ci/ciStreams.hpp	Wed Jun 09 18:50:45 2010 -0700
     1.3 @@ -46,6 +46,7 @@
     1.4  
     1.5    ciMethod* _method;           // the method
     1.6    ciInstanceKlass* _holder;
     1.7 +  ciCPCache* _cpcache;
     1.8    address _bc_start;            // Start of current bytecode for table
     1.9    address _was_wide;            // Address past last wide bytecode
    1.10    jint* _table_base;            // Aligned start of last table or switch
    1.11 @@ -58,7 +59,9 @@
    1.12  
    1.13    void reset( address base, unsigned int size ) {
    1.14      _bc_start =_was_wide = 0;
    1.15 -    _start = _pc = base; _end = base + size; }
    1.16 +    _start = _pc = base; _end = base + size;
    1.17 +    _cpcache = NULL;
    1.18 +  }
    1.19  
    1.20    void assert_wide(bool require_wide) const {
    1.21      if (require_wide)
    1.22 @@ -136,15 +139,20 @@
    1.23    bool is_wide() const { return ( _pc == _was_wide ); }
    1.24  
    1.25    // Does this instruction contain an index which refes into the CP cache?
    1.26 -  bool uses_cp_cache() const { return Bytecodes::uses_cp_cache(cur_bc_raw()); }
    1.27 +  bool has_cache_index() const { return Bytecodes::uses_cp_cache(cur_bc_raw()); }
    1.28  
    1.29    int get_index_u1() const {
    1.30      return bytecode()->get_index_u1(cur_bc_raw());
    1.31    }
    1.32  
    1.33 +  int get_index_u1_cpcache() const {
    1.34 +    return bytecode()->get_index_u1_cpcache(cur_bc_raw());
    1.35 +  }
    1.36 +
    1.37    // Get a byte index following this bytecode.
    1.38    // If prefixed with a wide bytecode, get a wide index.
    1.39    int get_index() const {
    1.40 +    assert(!has_cache_index(), "else use cpcache variant");
    1.41      return (_pc == _was_wide)   // was widened?
    1.42        ? get_index_u2(true)      // yes, return wide index
    1.43        : get_index_u1();         // no, return narrow index
    1.44 @@ -207,7 +215,9 @@
    1.45      return cur_bci() + get_int_table(index); }
    1.46  
    1.47    // --- Constant pool access ---
    1.48 -  int get_constant_index() const;
    1.49 +  int get_constant_raw_index() const;
    1.50 +  int get_constant_pool_index() const;
    1.51 +  int get_constant_cache_index() const;
    1.52    int get_field_index();
    1.53    int get_method_index();
    1.54  
    1.55 @@ -217,12 +227,17 @@
    1.56    int get_klass_index() const;
    1.57  
    1.58    // If this bytecode is one of the ldc variants, get the referenced
    1.59 -  // constant
    1.60 +  // constant.  Do not attempt to resolve it, since that would require
    1.61 +  // execution of Java code.  If it is not resolved, return an unloaded
    1.62 +  // object (ciConstant.as_object()->is_loaded() == false).
    1.63    ciConstant get_constant();
    1.64 -  // True if the ldc variant points to an unresolved string
    1.65 -  bool is_unresolved_string() const;
    1.66 -  // True if the ldc variant points to an unresolved klass
    1.67 -  bool is_unresolved_klass() const;
    1.68 +  constantTag get_constant_pool_tag(int index) const;
    1.69 +
    1.70 +  // True if the klass-using bytecode points to an unresolved klass
    1.71 +  bool is_unresolved_klass() const {
    1.72 +    constantTag tag = get_constant_pool_tag(get_klass_index());
    1.73 +    return tag.is_unresolved_klass();
    1.74 +  }
    1.75  
    1.76    // If this bytecode is one of get_field, get_static, put_field,
    1.77    // or put_static, get the referenced field.
    1.78 @@ -238,7 +253,7 @@
    1.79    int       get_method_holder_index();
    1.80    int       get_method_signature_index();
    1.81  
    1.82 -  ciCPCache*  get_cpcache();
    1.83 +  ciCPCache*  get_cpcache() const;
    1.84    ciCallSite* get_call_site();
    1.85  };
    1.86  

mercurial