hotspot/src/share/vm/interpreter/rewriter.hpp
author twisti
Fri, 30 Nov 2012 15:23:16 -0800
changeset 14626 0cf4eccf130f
parent 13929 8da0dc50a6e4
child 15099 b31d40895bbb
permissions -rw-r--r--
8003240: x86: move MacroAssembler into separate file Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
     2
 * Copyright (c) 1998, 2012, 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: 4567
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4567
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: 4567
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: 6062
diff changeset
    25
#ifndef SHARE_VM_INTERPRETER_REWRITER_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6062
diff changeset
    26
#define SHARE_VM_INTERPRETER_REWRITER_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6062
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6062
diff changeset
    28
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6062
diff changeset
    29
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6062
diff changeset
    30
#include "utilities/growableArray.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6062
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// The Rewriter adds caches to the constant pool and rewrites bytecode indices
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// pointing into the constant pool for better interpreter performance.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    35
class Rewriter: public StackObj {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
 private:
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    37
  instanceKlassHandle _klass;
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    38
  constantPoolHandle  _pool;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    39
  Array<Method*>*     _methods;
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    40
  intArray            _cp_map;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    41
  intStack            _cp_cache_map;        // for Methodref, Fieldref,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    42
                                            // InterfaceMethodref and InvokeDynamic
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    43
  intArray            _reference_map;       // maps from cp index to resolved_refs index (or -1)
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    44
  intStack            _resolved_references_map;    // for strings, methodHandle, methodType
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    45
  intStack            _invokedynamic_references_map; // for invokedynamic resolved refs
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 9971
diff changeset
    46
  intArray            _method_handle_invokers;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    47
  int                 _resolved_reference_limit;
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    48
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    49
  void init_maps(int length) {
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    50
    _cp_map.initialize(length, -1);
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    51
    // Choose an initial value large enough that we don't get frequent
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    52
    // calls to grow().
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    53
    _cp_cache_map.initialize(length / 2);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    54
    // Also cache resolved objects, in another different cache.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    55
    _reference_map.initialize(length, -1);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    56
    _resolved_references_map.initialize(length / 2);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    57
    _invokedynamic_references_map.initialize(length / 2);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    58
    _resolved_reference_limit = -1;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    59
    DEBUG_ONLY(_cp_cache_index_limit = -1);
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    60
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    61
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    62
  int _cp_cache_index_limit;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    63
  void record_map_limits() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    64
#ifdef ASSERT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    65
    // Record initial size of the two arrays generated for the CP cache:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    66
    _cp_cache_index_limit = _cp_cache_map.length();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    67
#endif //ASSERT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    68
    _resolved_reference_limit = _resolved_references_map.length();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    69
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    70
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    71
  int  cp_entry_to_cp_cache(int i) { assert(has_cp_cache(i), "oob"); return _cp_map[i]; }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    72
  bool has_cp_cache(int i) { return (uint)i < (uint)_cp_map.length() && _cp_map[i] >= 0; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    73
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    74
  int add_cp_cache_entry(int cp_index) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    75
    assert(_pool->tag_at(cp_index).value() != JVM_CONSTANT_InvokeDynamic, "use indy version");
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    76
    assert(_cp_map[cp_index] == -1, "not twice on same cp_index");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    77
    assert(_cp_cache_index_limit == -1, "do not add cache entries after first iteration");
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    78
    int cache_index = _cp_cache_map.append(cp_index);
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    79
    _cp_map.at_put(cp_index, cache_index);
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    80
    assert(cp_entry_to_cp_cache(cp_index) == cache_index, "");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    81
    assert(cp_cache_entry_pool_index(cache_index) == cp_index, "");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    82
    return cache_index;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    83
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    84
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    85
  // add a new CP cache entry beyond the normal cache (for invokedynamic only)
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    86
  int add_invokedynamic_cp_cache_entry(int cp_index) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    87
    assert(_pool->tag_at(cp_index).value() == JVM_CONSTANT_InvokeDynamic, "use non-indy version");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    88
    assert(_cp_map[cp_index] == -1, "do not map from cp_index");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    89
    assert(_cp_cache_index_limit >= 0, "add indy cache entries after first iteration");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    90
    int cache_index = _cp_cache_map.append(cp_index);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    91
    assert(cache_index >= _cp_cache_index_limit, "");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    92
    // do not update _cp_map, since the mapping is one-to-many
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    93
    assert(cp_cache_entry_pool_index(cache_index) == cp_index, "");
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    94
    return cache_index;
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
    95
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    96
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    97
  // fix duplicated code later
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    98
  int  cp_entry_to_resolved_references(int cp_index) const {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    99
    assert(has_entry_in_resolved_references(cp_index), "oob");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   100
    return _reference_map[cp_index];
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   101
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   102
  bool has_entry_in_resolved_references(int cp_index) const {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   103
    return (uint)cp_index < (uint)_reference_map.length() && _reference_map[cp_index] >= 0;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   104
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   105
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   106
  // add a new entry to the resolved_references map
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   107
  int add_resolved_references_entry(int cp_index) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   108
    assert(_reference_map[cp_index] == -1, "not twice on same cp_index");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   109
    assert(_resolved_reference_limit == -1, "do not add CP refs after first iteration");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   110
    int ref_index = _resolved_references_map.append(cp_index);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   111
    _reference_map.at_put(cp_index, ref_index);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   112
    assert(cp_entry_to_resolved_references(cp_index) == ref_index, "");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   113
    return ref_index;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   114
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   115
13929
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   116
  // add a new entries to the resolved_references map (for invokedynamic and invokehandle only)
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   117
  int add_invokedynamic_resolved_references_entries(int cp_index, int cache_index) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   118
    assert(_resolved_reference_limit >= 0, "must add indy refs after first iteration");
13929
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   119
    int ref_index = -1;
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   120
    for (int entry = 0; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   121
      const int index = _resolved_references_map.append(cp_index);  // many-to-one
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   122
      assert(index >= _resolved_reference_limit, "");
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   123
      if (entry == 0) {
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   124
        ref_index = index;
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   125
      }
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   126
      assert((index - entry) == ref_index, "entries must be consecutive");
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   127
      _invokedynamic_references_map.at_put_grow(index, cache_index, -1);
8da0dc50a6e4 7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents: 13728
diff changeset
   128
    }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   129
    return ref_index;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   130
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   131
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   132
  int resolved_references_entry_to_pool_index(int ref_index) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   133
    int cp_index = _resolved_references_map[ref_index];
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   134
    return cp_index;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   135
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   136
6062
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   137
  // Access the contents of _cp_cache_map to determine CP cache layout.
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   138
  int cp_cache_entry_pool_index(int cache_index) {
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   139
    int cp_index = _cp_cache_map[cache_index];
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   140
      return cp_index;
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   141
  }
bab93afe9df7 6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents: 5882
diff changeset
   142
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   143
  // All the work goes in here:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   144
  Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS);
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   145
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   146
  void compute_index_maps();
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   147
  void make_constant_pool_cache(TRAPS);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   148
  void scan_method(Method* m, bool reverse = false);
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   149
  void rewrite_Object_init(methodHandle m, TRAPS);
9971
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   150
  void rewrite_member_reference(address bcp, int offset, bool reverse = false);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   151
  void maybe_rewrite_invokehandle(address opc, int cp_index, int cache_index, bool reverse = false);
9971
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   152
  void rewrite_invokedynamic(address bcp, int offset, bool reverse = false);
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   153
  void maybe_rewrite_ldc(address bcp, int offset, bool is_wide, bool reverse = false);
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   154
  // Revert bytecodes in case of an exception.
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   155
  void restore_bytecodes();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
9971
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   157
  static methodHandle rewrite_jsrs(methodHandle m, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
 public:
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 1
diff changeset
   159
  // Driver routine:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  static void rewrite(instanceKlassHandle klass, TRAPS);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   161
  static void rewrite(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS);
9971
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   162
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   163
  // Second pass, not gated by is_rewritten flag
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   164
  static void relocate_and_link(instanceKlassHandle klass, TRAPS);
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   165
  // JSR292 version to call with it's own methods.
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   166
  static void relocate_and_link(instanceKlassHandle klass,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   167
                                Array<Method*>* methods, TRAPS);
9971
d496ecd7b9de 7033141: assert(has_cp_cache(i)) failed: oob
coleenp
parents: 7397
diff changeset
   168
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6062
diff changeset
   170
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6062
diff changeset
   171
#endif // SHARE_VM_INTERPRETER_REWRITER_HPP