src/hotspot/share/prims/jvmtiRedefineClasses.hpp
author coleenp
Wed, 13 Nov 2019 08:23:23 -0500
changeset 59056 15936b142f86
parent 53904 9c3fe09f69bc
permissions -rw-r--r--
8233913: Remove implicit conversion from Method* to methodHandle Summary: Fix call sites to use existing THREAD local or pass down THREAD local for shallower callsites. Make linkResolver methods return Method* for caller to handleize if needed. Reviewed-by: iklam, thartmann, hseigel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52877
diff changeset
     2
 * Copyright (c) 2003, 2019, 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: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52877
diff changeset
    25
#ifndef SHARE_PRIMS_JVMTIREDEFINECLASSES_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52877
diff changeset
    26
#define SHARE_PRIMS_JVMTIREDEFINECLASSES_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "jvmtifiles/jvmtiEnv.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/oopFactory.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "oops/objArrayKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "oops/objArrayOop.hpp"
52877
9e041366c764 8214850: Rename vm_operations.?pp files to vmOperations.?pp files
tschatzl
parents: 50735
diff changeset
    33
#include "runtime/vmOperations.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// Introduction:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// The RedefineClasses() API is used to change the definition of one or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// more classes. While the API supports redefining more than one class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// in a single call, in general, the API is discussed in the context of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// changing the definition of a single current class to a single new
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// class. For clarity, the current class is will always be called
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// "the_class" and the new class will always be called "scratch_class".
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// The name "the_class" is used because there is only one structure
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// that represents a specific class; redefinition does not replace the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// structure, but instead replaces parts of the structure. The name
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// "scratch_class" is used because the structure that represents the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
// new definition of a specific class is simply used to carry around
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// the parts of the new definition until they are used to replace the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// appropriate parts in the_class. Once redefinition of a class is
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// complete, scratch_class is thrown away.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// Implementation Overview:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// The RedefineClasses() API is mostly a wrapper around the VM op that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
// does the real work. The work is split in varying degrees between
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// doit_prologue(), doit() and doit_epilogue().
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
// 1) doit_prologue() is called by the JavaThread on the way to a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
//    safepoint. It does parameter verification and loads scratch_class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
//    which involves:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
//    - parsing the incoming class definition using the_class' class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
//      loader and security context
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
//    - linking scratch_class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
//    - merging constant pools and rewriting bytecodes as needed
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
//      for the merged constant pool
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
//    - verifying the bytecodes in scratch_class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
//    - setting up the constant pool cache and rewriting bytecodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
//      as needed to use the cache
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
//    - finally, scratch_class is compared to the_class to verify
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
//      that it is a valid replacement class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
//    - if everything is good, then scratch_class is saved in an
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
//      instance field in the VM operation for the doit() call
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
//    Note: A JavaThread must do the above work.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
// 2) doit() is called by the VMThread during a safepoint. It installs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
//    the new class definition(s) which involves:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
//    - retrieving the scratch_class from the instance field in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
//      VM operation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
//    - house keeping (flushing breakpoints and caches, deoptimizing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
//      dependent compiled code)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
//    - replacing parts in the_class with parts from scratch_class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
//    - adding weak reference(s) to track the obsolete but interesting
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
//      parts of the_class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
//    - adjusting constant pool caches and vtables in other classes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
//      that refer to methods in the_class. These adjustments use the
17373
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
    89
//      ClassLoaderDataGraph::classes_do() facility which only allows
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
//      a helper method to be specified. The interesting parameters
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
//      that we would like to pass to the helper method are saved in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
//      static global fields in the VM operation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
//    - telling the SystemDictionary to notice our changes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
//    Note: the above work must be done by the VMThread to be safe.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
// 3) doit_epilogue() is called by the JavaThread after the VM op
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
//    is finished and the safepoint is done. It simply cleans up
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
//    memory allocated in doit_prologue() and used in doit().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
// Constant Pool Details:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
// When the_class is redefined, we cannot just replace the constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
// pool in the_class with the constant pool from scratch_class because
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
// that could confuse obsolete methods that may still be running.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
// Instead, the constant pool from the_class, old_cp, is merged with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
// the constant pool from scratch_class, scratch_cp. The resulting
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
// constant pool, merge_cp, replaces old_cp in the_class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
// The key part of any merging algorithm is the entry comparison
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
// function so we have to know the types of entries in a constant pool
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
// in order to merge two of them together. Constant pools can contain
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
// up to 12 different kinds of entries; the JVM_CONSTANT_Unicode entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
// is not presently used so we only have to worry about the other 11
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
// entry types. For the purposes of constant pool merging, it is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
// helpful to know that the 11 entry types fall into 3 different
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
// subtypes: "direct", "indirect" and "double-indirect".
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
// Direct CP entries contain data and do not contain references to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
// other CP entries. The following are direct CP entries:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
//     JVM_CONSTANT_{Double,Float,Integer,Long,Utf8}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
// Indirect CP entries contain 1 or 2 references to a direct CP entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
// and no other data. The following are indirect CP entries:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
//     JVM_CONSTANT_{Class,NameAndType,String}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
// Double-indirect CP entries contain two references to indirect CP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
// entries and no other data. The following are double-indirect CP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
// entries:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
//     JVM_CONSTANT_{Fieldref,InterfaceMethodref,Methodref}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
// When comparing entries between two constant pools, the entry types
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
// are compared first and if they match, then further comparisons are
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
// made depending on the entry subtype. Comparing direct CP entries is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
// simply a matter of comparing the data associated with each entry.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
// Comparing both indirect and double-indirect CP entries requires
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
// recursion.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
// Fortunately, the recursive combinations are limited because indirect
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
// CP entries can only refer to direct CP entries and double-indirect
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
// CP entries can only refer to indirect CP entries. The following is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
// an example illustration of the deepest set of indirections needed to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
// access the data associated with a JVM_CONSTANT_Fieldref entry:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
//     JVM_CONSTANT_Fieldref {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
//         class_index => JVM_CONSTANT_Class {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
//             name_index => JVM_CONSTANT_Utf8 {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
//                 <data-1>
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
//             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
//         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
//         name_and_type_index => JVM_CONSTANT_NameAndType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
//             name_index => JVM_CONSTANT_Utf8 {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
//                 <data-2>
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
//             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
//             descriptor_index => JVM_CONSTANT_Utf8 {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
//                 <data-3>
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
//             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
//         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
//     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
// The above illustration is not a data structure definition for any
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
// computer language. The curly braces ('{' and '}') are meant to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
// delimit the context of the "fields" in the CP entry types shown.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
// Each indirection from the JVM_CONSTANT_Fieldref entry is shown via
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
// "=>", e.g., the class_index is used to indirectly reference a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
// JVM_CONSTANT_Class entry where the name_index is used to indirectly
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
// reference a JVM_CONSTANT_Utf8 entry which contains the interesting
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
// <data-1>. In order to understand a JVM_CONSTANT_Fieldref entry, we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
// have to do a total of 5 indirections just to get to the CP entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
// that contain the interesting pieces of data and then we have to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
// fetch the three pieces of data. This means we have to do a total of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
// (5 + 3) * 2 == 16 dereferences to compare two JVM_CONSTANT_Fieldref
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
// entries.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
// Here is the indirection, data and dereference count for each entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
// type:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
//    JVM_CONSTANT_Class               1 indir, 1 data, 2 derefs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
//    JVM_CONSTANT_Double              0 indir, 1 data, 1 deref
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
//    JVM_CONSTANT_Fieldref            2 indir, 3 data, 8 derefs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
//    JVM_CONSTANT_Float               0 indir, 1 data, 1 deref
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
//    JVM_CONSTANT_Integer             0 indir, 1 data, 1 deref
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
//    JVM_CONSTANT_InterfaceMethodref  2 indir, 3 data, 8 derefs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
//    JVM_CONSTANT_Long                0 indir, 1 data, 1 deref
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
//    JVM_CONSTANT_Methodref           2 indir, 3 data, 8 derefs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
//    JVM_CONSTANT_NameAndType         1 indir, 2 data, 4 derefs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
//    JVM_CONSTANT_String              1 indir, 1 data, 2 derefs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
//    JVM_CONSTANT_Utf8                0 indir, 1 data, 1 deref
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
// So different subtypes of CP entries require different amounts of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
// work for a proper comparison.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
// Now that we've talked about the different entry types and how to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
// compare them we need to get back to merging. This is not a merge in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
// the "sort -u" sense or even in the "sort" sense. When we merge two
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
// constant pools, we copy all the entries from old_cp to merge_cp,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
// preserving entry order. Next we append all the unique entries from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
// scratch_cp to merge_cp and we track the index changes from the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
// location in scratch_cp to the possibly new location in merge_cp.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
// When we are done, any obsolete code that is still running that
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
// uses old_cp should not be able to observe any difference if it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
// were to use merge_cp. As for the new code in scratch_class, it is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
// modified to use the appropriate index values in merge_cp before it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
// is used to replace the code in the_class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
// There is one small complication in copying the entries from old_cp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
// to merge_cp. Two of the CP entry types are special in that they are
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
// lazily resolved. Before explaining the copying complication, we need
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
// to digress into CP entry resolution.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
//
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   212
// JVM_CONSTANT_Class entries are present in the class file, but are not
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   213
// stored in memory as such until they are resolved. The entries are not
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   214
// resolved unless they are used because resolution is expensive. During class
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   215
// file parsing the entries are initially stored in memory as
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   216
// JVM_CONSTANT_ClassIndex and JVM_CONSTANT_StringIndex entries. These special
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   217
// CP entry types indicate that the JVM_CONSTANT_Class and JVM_CONSTANT_String
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   218
// entries have been parsed, but the index values in the entries have not been
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
// validated. After the entire constant pool has been parsed, the index
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
// values can be validated and then the entries are converted into
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   221
// JVM_CONSTANT_UnresolvedClass and JVM_CONSTANT_String
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
// entries. During this conversion process, the UTF8 values that are
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
// indirectly referenced by the JVM_CONSTANT_ClassIndex and
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   224
// JVM_CONSTANT_StringIndex entries are changed into Symbol*s and the
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   225
// entries are modified to refer to the Symbol*s. This optimization
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
// eliminates one level of indirection for those two CP entry types and
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   227
// gets the entries ready for verification.  Verification expects to
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   228
// find JVM_CONSTANT_UnresolvedClass but not JVM_CONSTANT_Class entries.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
// Now we can get back to the copying complication. When we copy
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
// entries from old_cp to merge_cp, we have to revert any
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
// JVM_CONSTANT_Class entries to JVM_CONSTANT_UnresolvedClass entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
// or verification will fail.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
// It is important to explicitly state that the merging algorithm
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
// effectively unresolves JVM_CONSTANT_Class entries that were in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
// old_cp when they are changed into JVM_CONSTANT_UnresolvedClass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
// entries in the merge_cp. This is done both to make verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
// happy and to avoid adding more brittleness between RedefineClasses
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
// and the constant pool cache. By allowing the constant pool cache
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
// implementation to (re)resolve JVM_CONSTANT_UnresolvedClass entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
// into JVM_CONSTANT_Class entries, we avoid having to embed knowledge
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
// about those algorithms in RedefineClasses.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
// Appending unique entries from scratch_cp to merge_cp is straight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
// forward for direct CP entries and most indirect CP entries. For the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
// indirect CP entry type JVM_CONSTANT_NameAndType and for the double-
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
// indirect CP entry types, the presence of more than one piece of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
// interesting data makes appending the entries more complicated.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
// For the JVM_CONSTANT_{Double,Float,Integer,Long,Utf8} entry types,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
// the entry is simply copied from scratch_cp to the end of merge_cp.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
// If the index in scratch_cp is different than the destination index
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
// in merge_cp, then the change in index value is tracked.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
// Note: the above discussion for the direct CP entries also applies
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   257
// to the JVM_CONSTANT_UnresolvedClass entry types.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
//
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   259
// For the JVM_CONSTANT_Class entry types, since there is only
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
// one data element at the end of the recursion, we know that we have
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
// either one or two unique entries. If the JVM_CONSTANT_Utf8 entry is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
// unique then it is appended to merge_cp before the current entry.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
// If the JVM_CONSTANT_Utf8 entry is not unique, then the current entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
// is updated to refer to the duplicate entry in merge_cp before it is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
// appended to merge_cp. Again, any changes in index values are tracked
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
// as needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
//
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   268
// Note: the above discussion for JVM_CONSTANT_Class entry
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
// types is theoretical. Since those entry types have already been
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   270
// optimized into JVM_CONSTANT_UnresolvedClass entry types,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
// they are handled as direct CP entries.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
// For the JVM_CONSTANT_NameAndType entry type, since there are two
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
// data elements at the end of the recursions, we know that we have
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
// between one and three unique entries. Any unique JVM_CONSTANT_Utf8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
// entries are appended to merge_cp before the current entry. For any
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
// JVM_CONSTANT_Utf8 entries that are not unique, the current entry is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
// updated to refer to the duplicate entry in merge_cp before it is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
// appended to merge_cp. Again, any changes in index values are tracked
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
// as needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
// For the JVM_CONSTANT_{Fieldref,InterfaceMethodref,Methodref} entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
// types, since there are two indirect CP entries and three data
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
// elements at the end of the recursions, we know that we have between
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
// one and six unique entries. See the JVM_CONSTANT_Fieldref diagram
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
// above for an example of all six entries. The uniqueness algorithm
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
// for the JVM_CONSTANT_Class and JVM_CONSTANT_NameAndType entries is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
// covered above. Any unique entries are appended to merge_cp before
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
// the current entry. For any entries that are not unique, the current
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
// entry is updated to refer to the duplicate entry in merge_cp before
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
// it is appended to merge_cp. Again, any changes in index values are
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
// tracked as needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
// Other Details:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
// Details for other parts of RedefineClasses need to be written.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
// This is a placeholder section.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
// Open Issues (in no particular order):
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
// - How do we serialize the RedefineClasses() API without deadlocking?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
// - SystemDictionary::parse_stream() was called with a NULL protection
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
//   domain since the initial version. This has been changed to pass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
//   the_class->protection_domain(). This change has been tested with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
//   all NSK tests and nothing broke, but what will adding it now break
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
//   in ways that we don't test?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
// - GenerateOopMap::rewrite_load_or_store() has a comment in its
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
//   (indirect) use of the Relocator class that the max instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
//   size is 4 bytes. goto_w and jsr_w are 5 bytes and wide/iinc is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
//   6 bytes. Perhaps Relocator only needs a 4 byte buffer to do
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
//   what it does to the bytecodes. More investigation is needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
// - How do we know if redefine_single_class() and the guts of
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   318
//   InstanceKlass are out of sync? I don't think this can be
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
//   automated, but we should probably order the work in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
//   redefine_single_class() to match the order of field
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   321
//   definitions in InstanceKlass. We also need to add some
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
//   comments about keeping things in sync.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
// - set_new_constant_pool() is huge and we should consider refactoring
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
//   it into smaller chunks of work.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
// - The exception table update code in set_new_constant_pool() defines
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
//   const values that are also defined in a local context elsewhere.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
//   The same literal values are also used in elsewhere. We need to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
//   coordinate a cleanup of these constants with Runtime.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
18940
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   333
struct JvmtiCachedClassFileData {
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   334
  jint length;
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   335
  unsigned char data[1];
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   336
};
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   337
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
class VM_RedefineClasses: public VM_Operation {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
 private:
17373
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   340
  // These static fields are needed by ClassLoaderDataGraph::classes_do()
53904
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   341
  // facility and the CheckClass and AdjustAndCleanMetadata helpers.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   342
  static Array<Method*>* _old_methods;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   343
  static Array<Method*>* _new_methods;
53904
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   344
  static Method**        _matching_old_methods;
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   345
  static Method**        _matching_new_methods;
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   346
  static Method**        _deleted_methods;
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   347
  static Method**        _added_methods;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  static int             _matching_methods_length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  static int             _deleted_methods_length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  static int             _added_methods_length;
53904
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   351
  static bool            _has_redefined_Object;
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   352
  static bool            _has_null_class_loader;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  // The instance fields are used to pass information from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  // doit_prologue() to doit() and doit_epilogue().
53904
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   356
  Klass*                      _the_class;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  jint                        _class_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  const jvmtiClassDefinition *_class_defs;  // ptr to _class_count defs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  // This operation is used by both RedefineClasses and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  // RetransformClasses.  Indicate which.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  JvmtiClassLoadKind          _class_load_kind;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  // _index_map_count is just an optimization for knowing if
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  // _index_map_p contains any entries.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  int                         _index_map_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  intArray *                  _index_map_p;
17077
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   368
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   369
  // _operands_index_map_count is just an optimization for knowing if
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   370
  // _operands_index_map_p contains any entries.
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   371
  int                         _operands_cur_length;
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   372
  int                         _operands_index_map_count;
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   373
  intArray *                  _operands_index_map_p;
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   374
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  // ptr to _class_count scratch_classes
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   376
  InstanceKlass**             _scratch_classes;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  jvmtiError                  _res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 46329
diff changeset
   379
  // Set if any of the InstanceKlasses have entries in the ResolvedMethodTable
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 46329
diff changeset
   380
  // to avoid walking after redefinition if the redefined classes do not
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 46329
diff changeset
   381
  // have any entries.
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 46329
diff changeset
   382
  bool _any_class_has_resolved_methods;
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 46329
diff changeset
   383
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  // Performance measurement support. These timers do not cover all
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  // the work done for JVM/TI RedefineClasses() but they do cover
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  // the heavy lifting.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
  elapsedTimer  _timer_rsc_phase1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
  elapsedTimer  _timer_rsc_phase2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
  elapsedTimer  _timer_vm_op_prologue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  // These routines are roughly in call order unless otherwise noted.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  // Load the caller's new class definition(s) into _scratch_classes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  // Constant pool merging work is done here as needed. Also calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  // compare_and_normalize_class_versions() to verify the class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  // definition(s).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
  jvmtiError load_new_class_versions(TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
  // Verify that the caller provided class definition(s) that meet
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
  // the restrictions of RedefineClasses. Normalize the order of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
  // overloaded methods as needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  jvmtiError compare_and_normalize_class_versions(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   403
    InstanceKlass* the_class, InstanceKlass* scratch_class);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
  // Figure out which new methods match old methods in name and signature,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
  // which methods have been added, and which are no longer present
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
  void compute_added_deleted_matching_methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  // Change jmethodIDs to point to the new methods
59056
15936b142f86 8233913: Remove implicit conversion from Method* to methodHandle
coleenp
parents: 53904
diff changeset
   410
  void update_jmethod_ids(Thread* thread);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
26558
b7df27df6384 8055008: Clean up code that saves the previous versions of redefined classes
coleenp
parents: 18940
diff changeset
   412
  // In addition to marking methods as old and/or obsolete, this routine
b7df27df6384 8055008: Clean up code that saves the previous versions of redefined classes
coleenp
parents: 18940
diff changeset
   413
  // counts the number of methods that are EMCP (Equivalent Module Constant Pool).
b7df27df6384 8055008: Clean up code that saves the previous versions of redefined classes
coleenp
parents: 18940
diff changeset
   414
  int check_methods_and_mark_as_obsolete();
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   415
  void transfer_old_native_function_registrations(InstanceKlass* the_class);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
  // Install the redefinition of a class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
  void redefine_single_class(jclass the_jclass,
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   419
    InstanceKlass* scratch_class_oop, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   421
  void swap_annotations(InstanceKlass* new_class,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   422
                        InstanceKlass* scratch_class);
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15591
diff changeset
   423
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   424
  // Increment the classRedefinedCount field in the specific InstanceKlass
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
  // and in all direct and indirect subclasses.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   426
  void increment_class_counter(InstanceKlass *ik, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
15444
ab03781780dc 8006542: JSR 292: the VM_RedefineClasses::append_entry() must support invokedynamic entry kinds
sspitsyn
parents: 15430
diff changeset
   428
  // Support for constant pool merging (these routines are in alpha order):
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   429
  void append_entry(const constantPoolHandle& scratch_cp, int scratch_i,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   431
  void append_operand(const constantPoolHandle& scratch_cp, int scratch_bootstrap_spec_index,
17077
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   432
    constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   433
  void finalize_operands_merge(const constantPoolHandle& merge_cp, TRAPS);
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   434
  int find_or_append_indirect_entry(const constantPoolHandle& scratch_cp, int scratch_i,
15444
ab03781780dc 8006542: JSR 292: the VM_RedefineClasses::append_entry() must support invokedynamic entry kinds
sspitsyn
parents: 15430
diff changeset
   435
    constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   436
  int find_or_append_operand(const constantPoolHandle& scratch_cp, int scratch_bootstrap_spec_index,
17077
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   437
    constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
  int find_new_index(int old_index);
17077
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   439
  int find_new_operand_index(int old_bootstrap_spec_index);
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   440
  bool is_unresolved_class_mismatch(const constantPoolHandle& cp1, int index1,
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   441
    const constantPoolHandle& cp2, int index2);
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   442
  void map_index(const constantPoolHandle& scratch_cp, int old_index, int new_index);
17077
8607f7c33310 8007037: JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands
sspitsyn
parents: 15601
diff changeset
   443
  void map_operand_index(int old_bootstrap_spec_index, int new_bootstrap_spec_index);
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   444
  bool merge_constant_pools(const constantPoolHandle& old_cp,
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   445
    const constantPoolHandle& scratch_cp, constantPoolHandle *merge_cp_p,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
    int *merge_cp_length_p, TRAPS);
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   447
  jvmtiError merge_cp_and_rewrite(InstanceKlass* the_class,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   448
    InstanceKlass* scratch_class, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
  u2 rewrite_cp_ref_in_annotation_data(
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   450
    AnnotationArray* annotations_typeArray, int &byte_i_ref,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
    const char * trace_mesg, TRAPS);
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   452
  bool rewrite_cp_refs(InstanceKlass* scratch_class, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
  bool rewrite_cp_refs_in_annotation_struct(
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   454
    AnnotationArray* class_annotations, int &byte_i_ref, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
  bool rewrite_cp_refs_in_annotations_typeArray(
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   456
    AnnotationArray* annotations_typeArray, int &byte_i_ref, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
  bool rewrite_cp_refs_in_class_annotations(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   458
    InstanceKlass* scratch_class, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
  bool rewrite_cp_refs_in_element_value(
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   460
    AnnotationArray* class_annotations, int &byte_i_ref, TRAPS);
27401
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   461
  bool rewrite_cp_refs_in_type_annotations_typeArray(
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   462
    AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   463
    const char * location_mesg, TRAPS);
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   464
  bool rewrite_cp_refs_in_type_annotation_struct(
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   465
    AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   466
    const char * location_mesg, TRAPS);
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   467
  bool skip_type_annotation_target(
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   468
    AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   469
    const char * location_mesg, TRAPS);
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   470
  bool skip_type_annotation_type_path(
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   471
    AnnotationArray* type_annotations_typeArray, int &byte_i_ref, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
  bool rewrite_cp_refs_in_fields_annotations(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   473
    InstanceKlass* scratch_class, TRAPS);
50735
2f2af62dfac7 8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents: 47216
diff changeset
   474
  bool rewrite_cp_refs_in_nest_attributes(InstanceKlass* scratch_class);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
  void rewrite_cp_refs_in_method(methodHandle method,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
    methodHandle * new_method_p, TRAPS);
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   477
  bool rewrite_cp_refs_in_methods(InstanceKlass* scratch_class, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  bool rewrite_cp_refs_in_methods_annotations(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   479
    InstanceKlass* scratch_class, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  bool rewrite_cp_refs_in_methods_default_annotations(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   481
    InstanceKlass* scratch_class, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
  bool rewrite_cp_refs_in_methods_parameter_annotations(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   483
    InstanceKlass* scratch_class, TRAPS);
27401
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   484
  bool rewrite_cp_refs_in_class_type_annotations(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   485
    InstanceKlass* scratch_class, TRAPS);
27401
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   486
  bool rewrite_cp_refs_in_fields_type_annotations(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   487
    InstanceKlass* scratch_class, TRAPS);
27401
a4697c9502cb 8057043: Type annotations not retained during class redefine / retransform
aeriksso
parents: 26558
diff changeset
   488
  bool rewrite_cp_refs_in_methods_type_annotations(
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   489
    InstanceKlass* scratch_class, TRAPS);
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 31234
diff changeset
   490
  void rewrite_cp_refs_in_stack_map_table(const methodHandle& method, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  void rewrite_cp_refs_in_verification_type_info(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
         address& stackmap_addr_ref, address stackmap_end, u2 frame_i,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
         u1 frame_size, TRAPS);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   494
  void set_new_constant_pool(ClassLoaderData* loader_data,
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 38309
diff changeset
   495
         InstanceKlass* scratch_class,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
   496
         constantPoolHandle scratch_cp, int scratch_cp_length, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
53641
c572eb605087 8139551: Scalability problem with redefinition - multiple code cache walks
coleenp
parents: 53244
diff changeset
   498
  void flush_dependent_code();
c572eb605087 8139551: Scalability problem with redefinition - multiple code cache walks
coleenp
parents: 53244
diff changeset
   499
  void mark_dependent_code(InstanceKlass* ik);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
38309
9b8e9c373740 8155951: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 38259
diff changeset
   501
  // lock classes to redefine since constant pool merging isn't thread safe.
9b8e9c373740 8155951: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 38259
diff changeset
   502
  void lock_classes();
9b8e9c373740 8155951: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 38259
diff changeset
   503
  void unlock_classes();
9b8e9c373740 8155951: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 38259
diff changeset
   504
15591
b8aa0577f137 7182152: Instrumentation hot swap test incorrect monitor count
dcubed
parents: 15444
diff changeset
   505
  static void dump_methods();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
17373
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   507
  // Check that there are no old or obsolete methods
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   508
  class CheckClass : public KlassClosure {
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   509
    Thread* _thread;
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   510
   public:
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   511
    CheckClass(Thread* t) : _thread(t) {}
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   512
    void do_klass(Klass* k);
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   513
  };
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   514
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   515
  // Unevolving classes may point to methods of the_class directly
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   516
  // from their constant pool caches, itables, and/or vtables. We
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   517
  // use the ClassLoaderDataGraph::classes_do() facility and this helper
53904
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   518
  // to fix up these pointers and clean MethodData out.
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   519
  class AdjustAndCleanMetadata : public KlassClosure {
17373
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   520
    Thread* _thread;
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   521
   public:
53904
9c3fe09f69bc 8078725: method adjustments can be done just once for all classes involved into redefinition
coleenp
parents: 53641
diff changeset
   522
    AdjustAndCleanMetadata(Thread* t) : _thread(t) {}
17373
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   523
    void do_klass(Klass* k);
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   524
  };
7d8bb2a8787e 8005056: NPG: Crash after redefining java.lang.Object
coleenp
parents: 17077
diff changeset
   525
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
  VM_RedefineClasses(jint class_count,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
                     const jvmtiClassDefinition *class_defs,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
                     JvmtiClassLoadKind class_load_kind);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
  VMOp_Type type() const { return VMOp_RedefineClasses; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
  bool doit_prologue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
  void doit();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
  void doit_epilogue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
  bool allow_nested_vm_operations() const        { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
  jvmtiError check_error()                       { return _res; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
  // Modifiable test must be shared between IsModifiableClass query
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  // and redefine implementation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
  static bool is_modifiable_class(oop klass_mirror);
18940
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   541
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   542
  static jint get_cached_class_file_len(JvmtiCachedClassFileData *cache) {
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   543
    return cache == NULL ? 0 : cache->length;
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   544
  }
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   545
  static unsigned char * get_cached_class_file_bytes(JvmtiCachedClassFileData *cache) {
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   546
    return cache == NULL ? NULL : cache->data;
d39d4765e6cb 8020309: Eliminate InstanceKlass::_cached_class_file_len.
jiangli
parents: 17373
diff changeset
   547
  }
31234
48000028382c 8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents: 28365
diff changeset
   548
48000028382c 8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents: 28365
diff changeset
   549
  // Error printing
48000028382c 8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents: 28365
diff changeset
   550
  void print_on_error(outputStream* st) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
};
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52877
diff changeset
   552
#endif // SHARE_PRIMS_JVMTIREDEFINECLASSES_HPP