hotspot/src/share/vm/oops/cpCacheOop.hpp
author coleenp
Fri, 23 Mar 2012 11:16:05 -0400
changeset 12263 d20640f4f8fe
parent 10008 d84de97ad847
child 13391 30245956af37
permissions -rw-r--r--
7150058: Allocate symbols from null boot loader to an arena for NMT Summary: Move symbol allocation to an arena so NMT doesn't have to track them at startup. Reviewed-by: never, kamg, zgu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8297
f05d10c1c4b8 7014851: Remove unused parallel compaction code
stefank
parents: 8296
diff changeset
     2
 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5420
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5420
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5420
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    25
#ifndef SHARE_VM_OOPS_CPCACHEOOP_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    26
#define SHARE_VM_OOPS_CPCACHEOOP_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    28
#include "interpreter/bytecodes.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    29
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    30
#include "oops/arrayOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    31
#include "utilities/array.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// A ConstantPoolCacheEntry describes an individual entry of the constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// pool cache. There's 2 principal kinds of entries: field entries for in-
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// stance & static field access, and method entries for invokes. Some of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// the entry layout is shared and looks as follows:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// bit number |31                0|
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// bit length |-8--|-8--|---16----|
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// --------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// _indices   [ b2 | b1 |  index  ]
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// _f1        [  entry specific   ]
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// _f2        [  entry specific   ]
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// _flags     [t|f|vf|v|m|h|unused|field_index] (for field entries)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// bit length |4|1|1 |1|1|0|---7--|----16-----]
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// _flags     [t|f|vf|v|m|h|unused|eidx|psze] (for method entries)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// bit length |4|1|1 |1|1|1|---7--|-8--|-8--]
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// --------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// with:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// index  = original constant pool index
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// b1     = bytecode 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// b2     = bytecode 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// psze   = parameters size (method entries only)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// eidx   = interpreter entry index (method entries only)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
// field_index = index into field information in holder instanceKlass
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
//          The index max is 0xffff (max number of fields in constant pool)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
//          and is multiplied by (instanceKlass::next_offset) when accessing.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
// t      = TosState (see below)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
// f      = field is marked final (see below)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
// vf     = virtual, final (method entries only : is_vfinal())
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// v      = field is volatile (see below)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
// m      = invokeinterface used for method in class Object (see below)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
// h      = RedefineClasses/Hotswap bit (see below)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
// The flags after TosState have the following interpretation:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
// bit 27: f flag  true if field is marked final
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// bit 26: vf flag true if virtual final method
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// bit 25: v flag true if field is volatile (only for fields)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// bit 24: m flag true if invokeinterface used for method in class Object
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// bit 23: 0 for fields, 1 for methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
// The flags 31, 30, 29, 28 together build a 4 bit number 0 to 8 with the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
// following mapping to the TosState states:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
// btos: 0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
// ctos: 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
// stos: 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
// itos: 3
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
// ltos: 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
// ftos: 5
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
// dtos: 6
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
// atos: 7
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
// vtos: 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
// Entry specific: field entries:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
// _indices = get (b1 section) and put (b2 section) bytecodes, original constant pool index
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
// _f1      = field holder
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
// _f2      = field offset in words
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
// _flags   = field type information, original field index in field holder
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
//            (field_index section)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
// Entry specific: method entries:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// _indices = invoke code for f1 (b1 section), invoke code for f2 (b2 section),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
//            original constant pool index
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
// _f1      = method for all but virtual calls, unused by virtual calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
//            (note: for interface calls, which are essentially virtual,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
//             contains klassOop for the corresponding interface.
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   100
//            for invokedynamic, f1 contains the CallSite object for the invocation
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
// _f2      = method/vtable index for virtual calls only, unused by all other
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
//            calls.  The vf flag indicates this is a method pointer not an
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
//            index.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
// _flags   = field type info (f section),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
//            virtual final entry (vf),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
//            interpreter entry index (eidx section),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
//            parameter size (psze section)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
// Note: invokevirtual & invokespecial bytecodes can share the same constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
//       pool entry and thus the same constant pool cache entry. All invoke
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
//       bytecodes but invokevirtual use only _f1 and the corresponding b1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
//       bytecode, while invokevirtual uses only _f2 and the corresponding
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
//       b2 bytecode.  The value of _flags is shared for both types of entries.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
// The fields are volatile so that they are stored in the order written in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
// source code.  The _indices field with the bytecode must be written last.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  friend class VMStructs;
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   120
  friend class constantPoolCacheKlass;
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   121
  friend class constantPoolOopDesc;  //resolve_constant_at_impl => set_f1
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   122
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  volatile intx     _indices;  // constant pool index & rewrite bytecodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  volatile oop      _f1;       // entry specific oop field
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  volatile intx     _f2;       // entry specific int/oop field
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  volatile intx     _flags;    // flags
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  bool same_methodOop(oop cur_f1, oop f1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  void set_bytecode_1(Bytecodes::Code code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  void set_bytecode_2(Bytecodes::Code code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  void set_f1(oop f1)                            {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    oop existing_f1 = _f1; // read once
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    assert(existing_f1 == NULL || existing_f1 == f1, "illegal field change");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    oop_store(&_f1, f1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  }
7104
0c8b519af363 6990192: VM crashes in ciTypeFlow::get_block_for()
twisti
parents: 6064
diff changeset
   141
  void set_f1_if_null_atomic(oop f1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  void set_f2(intx f2)                           { assert(_f2 == 0    || _f2 == f2, "illegal field change"); _f2 = f2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  int as_flags(TosState state, bool is_final, bool is_vfinal, bool is_volatile,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
               bool is_method_interface, bool is_method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  void set_flags(intx flags)                     { _flags = flags; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  // specific bit values in flag field
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  // Note: the interpreter knows this layout!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  enum FlagBitValues {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    hotSwapBit    = 23,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    methodInterface = 24,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    volatileField = 25,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    vfinalMethod  = 26,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    finalField    = 27
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  enum { field_index_mask = 0xFFFF };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  // start of type bits in flags
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  // Note: the interpreter knows this layout!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  enum FlagValues {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    tosBits      = 28
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  // Initialization
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   167
  void initialize_entry(int original_index);     // initialize primary entry
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   168
  void initialize_secondary_entry(int main_index); // initialize secondary entry
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  void set_field(                                // sets entry to resolved field state
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    Bytecodes::Code get_code,                    // the bytecode used for reading the field
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    Bytecodes::Code put_code,                    // the bytecode used for writing the field
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    KlassHandle     field_holder,                // the object/klass holding the field
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    int             orig_field_index,            // the original field index in the field holder
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    int             field_offset,                // the field offset in words in the field holder
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    TosState        field_type,                  // the (machine) field type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
    bool            is_final,                     // the field is final
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    bool            is_volatile                  // the field is volatile
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  void set_method(                               // sets entry to resolved method entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    Bytecodes::Code invoke_code,                 // the bytecode used for invoking the method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    methodHandle    method,                      // the method/prototype if any (NULL, otherwise)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    int             vtable_index                 // the vtable index if any, else negative
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  void set_interface_call(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    methodHandle method,                         // Resolved method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    int index                                    // Method index into interface
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   192
  void set_dynamic_call(
8676
9098d4e927e1 7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents: 8297
diff changeset
   193
    Handle call_site,                            // Resolved java.lang.invoke.CallSite (f1)
5420
586d3988e72b 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 4429
diff changeset
   194
    methodHandle signature_invoker               // determines signature information
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   195
  );
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   196
10008
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 8676
diff changeset
   197
  methodOop get_method_if_resolved(Bytecodes::Code invoke_code, constantPoolHandle cpool);
d84de97ad847 7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents: 8676
diff changeset
   198
6062
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   199
  // For JVM_CONSTANT_InvokeDynamic cache entries:
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   200
  void initialize_bootstrap_method_index_in_cache(int bsm_cache_index);
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   201
  int  bootstrap_method_index_in_cache();
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   202
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  void set_parameter_size(int value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
    assert(parameter_size() == 0 || parameter_size() == value,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
           "size must not change");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    // Setting the parameter size by itself is only safe if the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    // current value of _flags is 0, otherwise another thread may have
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    // updated it and we don't want to overwrite that value.  Don't
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    // bother trying to update it once it's nonzero but always make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
    // sure that the final parameter size agrees with what was passed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    if (_flags == 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
      Atomic::cmpxchg_ptr((value & 0xFF), &_flags, 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    guarantee(parameter_size() == value, "size must not change");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  // Which bytecode number (1 or 2) in the index field is valid for this bytecode?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  // Returns -1 if neither is valid.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  static int bytecode_number(Bytecodes::Code code) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    switch (code) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
      case Bytecodes::_getstatic       :    // fall through
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
      case Bytecodes::_getfield        :    // fall through
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
      case Bytecodes::_invokespecial   :    // fall through
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
      case Bytecodes::_invokestatic    :    // fall through
6064
71e316283a85 6969574: invokedynamic call sites deoptimize instead of executing
jrose
parents: 6062
diff changeset
   225
      case Bytecodes::_invokedynamic   :    // fall through
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
      case Bytecodes::_invokeinterface : return 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
      case Bytecodes::_putstatic       :    // fall through
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
      case Bytecodes::_putfield        :    // fall through
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
      case Bytecodes::_invokevirtual   : return 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
      default                          : break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    return -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  // Has this bytecode been resolved? Only valid for invokes and get/put field/static.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  bool is_resolved(Bytecodes::Code code) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    switch (bytecode_number(code)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
      case 1:  return (bytecode_1() == code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
      case 2:  return (bytecode_2() == code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    return false;      // default: not resolved
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  // Accessors
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   245
  bool is_secondary_entry() const                { return (_indices & 0xFFFF) == 0; }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   246
  int constant_pool_index() const                { assert((_indices & 0xFFFF) != 0, "must be main entry");
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   247
                                                   return (_indices & 0xFFFF); }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   248
  int main_entry_index() const                   { assert((_indices & 0xFFFF) == 0, "must be secondary entry");
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   249
                                                   return ((uintx)_indices >> 16); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  Bytecodes::Code bytecode_1() const             { return Bytecodes::cast((_indices >> 16) & 0xFF); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  Bytecodes::Code bytecode_2() const             { return Bytecodes::cast((_indices >> 24) & 0xFF); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  volatile oop  f1() const                       { return _f1; }
6062
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   253
  bool is_f1_null() const                        { return (oop)_f1 == NULL; }  // classifies a CPC entry as unbound
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  intx f2() const                                { return _f2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  int  field_index() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  int  parameter_size() const                    { return _flags & 0xFF; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  bool is_vfinal() const                         { return ((_flags & (1 << vfinalMethod)) == (1 << vfinalMethod)); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  bool is_volatile() const                       { return ((_flags & (1 << volatileField)) == (1 << volatileField)); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  bool is_methodInterface() const                { return ((_flags & (1 << methodInterface)) == (1 << methodInterface)); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  bool is_byte() const                           { return (((uintx) _flags >> tosBits) == btos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  bool is_char() const                           { return (((uintx) _flags >> tosBits) == ctos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  bool is_short() const                          { return (((uintx) _flags >> tosBits) == stos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  bool is_int() const                            { return (((uintx) _flags >> tosBits) == itos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  bool is_long() const                           { return (((uintx) _flags >> tosBits) == ltos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  bool is_float() const                          { return (((uintx) _flags >> tosBits) == ftos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  bool is_double() const                         { return (((uintx) _flags >> tosBits) == dtos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  bool is_object() const                         { return (((uintx) _flags >> tosBits) == atos); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  TosState flag_state() const                    { assert( ( (_flags >> tosBits) & 0x0F ) < number_of_states, "Invalid state in as_flags");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
                                                   return (TosState)((_flags >> tosBits) & 0x0F); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  // Code generation support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  static WordSize size()                         { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   273
  static ByteSize size_in_bytes()                { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  static ByteSize indices_offset()               { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  static ByteSize f1_offset()                    { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  static ByteSize f2_offset()                    { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  static ByteSize flags_offset()                 { return byte_offset_of(ConstantPoolCacheEntry, _flags); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  // GC Support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  void oops_do(void f(oop*));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  void oop_iterate(OopClosure* blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  void oop_iterate_m(OopClosure* blk, MemRegion mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  void follow_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  void adjust_pointers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  // Parallel Old
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  void follow_contents(ParCompactionManager* cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  void update_pointers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  // RedefineClasses() API support:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  // If this constantPoolCacheEntry refers to old_method then update it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  // to refer to new_method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  // trace_name_printed is set to true if the current call has
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  // printed the klass name so that other routines in the adjust_*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  // group don't print the klass name.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  bool adjust_method_entry(methodOop old_method, methodOop new_method,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
         bool * trace_name_printed);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  bool is_interesting_method_entry(klassOop k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  bool is_field_entry() const                    { return (_flags & (1 << hotSwapBit)) == 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  bool is_method_entry() const                   { return (_flags & (1 << hotSwapBit)) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  // Debugging & Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  void print (outputStream* st, int index) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  void verify(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  static void verify_tosBits() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
    assert(tosBits == 28, "interpreter now assumes tosBits is 28");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
// A constant pool cache is a runtime data structure set aside to a constant pool. The cache
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
// holds interpreter runtime information for all field access and invoke bytecodes. The cache
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
// is created and initialized before a class is actively used (i.e., initialized), the indivi-
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
// dual cache entries are filled at resolution (i.e., "link") time (see also: rewriter.*).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   320
class constantPoolCacheOopDesc: public oopDesc {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
 private:
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   323
  int             _length;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  constantPoolOop _constant_pool;                // the corresponding constant pool
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  // Sizing
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   327
  debug_only(friend class ClassVerifier;)
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 7104
diff changeset
   328
 public:
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   329
  int length() const                             { return _length; }
7114
65d21c4c6337 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 7104
diff changeset
   330
 private:
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   331
  void set_length(int length)                    { _length = length; }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   332
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  static int header_size()                       { return sizeof(constantPoolCacheOopDesc) / HeapWordSize; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  static int object_size(int length)             { return align_object_size(header_size() + length * in_words(ConstantPoolCacheEntry::size())); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  int object_size()                              { return object_size(length()); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  // Helpers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  constantPoolOop*        constant_pool_addr()   { return &_constant_pool; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  ConstantPoolCacheEntry* base() const           { return (ConstantPoolCacheEntry*)((address)this + in_bytes(base_offset())); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  friend class constantPoolCacheKlass;
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   342
  friend class ConstantPoolCacheEntry;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  // Initialization
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  void initialize(intArray& inverse_index_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   348
  // Secondary indexes.
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   349
  // They must look completely different from normal indexes.
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   350
  // The main reason is that byte swapping is sometimes done on normal indexes.
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   351
  // Also, some of the CP accessors do different things for secondary indexes.
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   352
  // Finally, it is helpful for debugging to tell the two apart.
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   353
  static bool is_secondary_index(int i) { return (i < 0); }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   354
  static int  decode_secondary_index(int i) { assert(is_secondary_index(i),  ""); return ~i; }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   355
  static int  encode_secondary_index(int i) { assert(!is_secondary_index(i), ""); return ~i; }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   356
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  // Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  void set_constant_pool(constantPoolOop pool)   { oop_store_without_check((oop*)&_constant_pool, (oop)pool); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  constantPoolOop constant_pool() const          { return _constant_pool; }
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   360
  // Fetches the entry at the given index.
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   361
  // The entry may be either primary or secondary.
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   362
  // In either case the index must not be encoded or byte-swapped in any way.
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   363
  ConstantPoolCacheEntry* entry_at(int i) const {
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   364
    assert(0 <= i && i < length(), "index out of bounds");
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   365
    return base() + i;
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   366
  }
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   367
  // Fetches the secondary entry referred to by index.
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   368
  // The index may be a secondary index, and must not be byte-swapped.
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   369
  ConstantPoolCacheEntry* secondary_entry_at(int i) const {
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   370
    int raw_index = i;
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   371
    if (is_secondary_index(i)) {  // correct these on the fly
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   372
      raw_index = decode_secondary_index(i);
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   373
    }
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   374
    assert(entry_at(raw_index)->is_secondary_entry(), "not a secondary entry");
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   375
    return entry_at(raw_index);
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   376
  }
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   377
  // Given a primary or secondary index, fetch the corresponding primary entry.
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   378
  // Indirect through the secondary entry, if the index is encoded as a secondary index.
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   379
  // The index must not be byte-swapped.
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   380
  ConstantPoolCacheEntry* main_entry_at(int i) const {
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   381
    int primary_index = i;
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   382
    if (is_secondary_index(i)) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   383
      // run through an extra level of indirection:
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   384
      int raw_index = decode_secondary_index(i);
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   385
      primary_index = entry_at(raw_index)->main_entry_index();
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   386
    }
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   387
    assert(!entry_at(primary_index)->is_secondary_entry(), "only one level of indirection");
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   388
    return entry_at(primary_index);
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   389
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  // Code generation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  static ByteSize base_offset()                  { return in_ByteSize(sizeof(constantPoolCacheOopDesc)); }
4429
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   393
  static ByteSize entry_offset(int raw_index) {
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   394
    int index = raw_index;
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   395
    if (is_secondary_index(raw_index))
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   396
      index = decode_secondary_index(raw_index);
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   397
    return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
d7eb4e2099aa 6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents: 2570
diff changeset
   398
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
  // RedefineClasses() API support:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
  // If any entry of this constantPoolCache points to any of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  // old_methods, replace it with the corresponding new_method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
  // trace_name_printed is set to true if the current call has
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
  // printed the klass name so that other routines in the adjust_*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
  // group don't print the klass name.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
  void adjust_method_entries(methodOop* old_methods, methodOop* new_methods,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
                             int methods_length, bool * trace_name_printed);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
   409
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
   410
#endif // SHARE_VM_OOPS_CPCACHEOOP_HPP