annotate src/share/vm/runtime/vmStructs.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 1d1603768966
children 7c15faa95ce7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_RUNTIME_VMSTRUCTS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_RUNTIME_VMSTRUCTS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #ifndef VM_STRUCTS_KERNEL
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "utilities/debug.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #ifdef COMPILER1
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "c1/c1_Runtime1.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // This table encapsulates the debugging information required by the
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // serviceability agent in order to run. Specifically, we need to
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // understand the layout of certain C data structures (offsets, in
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // bytes, of their fields.)
a61af66fc99e Initial load
duke
parents:
diff changeset
39 //
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // There are alternatives for the design of this mechanism, including
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // parsing platform-specific debugging symbols from a debug build into
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // a program database. While this current mechanism can be considered
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // to be a workaround for the inability to debug arbitrary C and C++
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // programs at the present time, it does have certain advantages.
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // First, it is platform-independent, which will vastly simplify the
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // initial bringup of the system both now and on future platforms.
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // Second, it is embedded within the VM, as opposed to being in a
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // separate program database; experience has shown that whenever
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // portions of a system are decoupled, version skew is problematic.
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // Third, generating a program database, for example for a product
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // build, would probably require two builds to be done: the desired
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // product build as well as an intermediary build with the PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // flag turned on but also compiled with -g, leading to a doubling of
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // the time required to get a serviceability agent-debuggable product
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // build. Fourth, and very significantly, this table probably
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // preserves more information about field types than stabs do; for
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // example, it preserves the fact that a field is a "jlong" rather
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // than transforming the type according to the typedef in jni_md.h,
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // which allows the Java-side code to identify "Java-sized" fields in
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // C++ data structures. If the symbol parsing mechanism was redone
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // using stabs, it might still be necessary to have a table somewhere
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // containing this information.
a61af66fc99e Initial load
duke
parents:
diff changeset
63 //
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // Do not change the sizes or signedness of the integer values in
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // these data structures; they are fixed over in the serviceability
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // agent's Java code (for bootstrapping).
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 const char* typeName; // The type name containing the given field (example: "Klass")
a61af66fc99e Initial load
duke
parents:
diff changeset
70 const char* fieldName; // The field name within the type (example: "_name")
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
71 const char* typeString; // Quoted name of the type of this field (example: "Symbol*";
0
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // parsed in Java to ensure type correctness
a61af66fc99e Initial load
duke
parents:
diff changeset
73 int32_t isStatic; // Indicates whether following field is an offset or an address
a61af66fc99e Initial load
duke
parents:
diff changeset
74 uint64_t offset; // Offset of field within structure; only used for nonstatic fields
a61af66fc99e Initial load
duke
parents:
diff changeset
75 void* address; // Address of field; only used for static fields
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // ("offset" can not be reused because of apparent SparcWorks compiler bug
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // in generation of initializer data)
a61af66fc99e Initial load
duke
parents:
diff changeset
78 } VMStructEntry;
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 typedef struct {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
81 const char* typeName; // Type name (example: "Method")
0
a61af66fc99e Initial load
duke
parents:
diff changeset
82 const char* superclassName; // Superclass name, or null if none (example: "oopDesc")
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
83 int32_t isOopType; // Does this type represent an oop typedef? (i.e., "Method*" or
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
84 // "Klass*", but NOT "Method")
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85 int32_t isIntegerType; // Does this type represent an integer type (of arbitrary size)?
a61af66fc99e Initial load
duke
parents:
diff changeset
86 int32_t isUnsigned; // If so, is it unsigned?
a61af66fc99e Initial load
duke
parents:
diff changeset
87 uint64_t size; // Size, in bytes, of the type
a61af66fc99e Initial load
duke
parents:
diff changeset
88 } VMTypeEntry;
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 const char* name; // Name of constant (example: "_thread_in_native")
a61af66fc99e Initial load
duke
parents:
diff changeset
92 int32_t value; // Value of constant
a61af66fc99e Initial load
duke
parents:
diff changeset
93 } VMIntConstantEntry;
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 const char* name; // Name of constant (example: "_thread_in_native")
a61af66fc99e Initial load
duke
parents:
diff changeset
97 uint64_t value; // Value of constant
a61af66fc99e Initial load
duke
parents:
diff changeset
98 } VMLongConstantEntry;
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // This class is a friend of most classes, to be able to access
a61af66fc99e Initial load
duke
parents:
diff changeset
101 // private fields
a61af66fc99e Initial load
duke
parents:
diff changeset
102 class VMStructs {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // The last entry is identified over in the serviceability agent by
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // the fact that it has a NULL fieldName
a61af66fc99e Initial load
duke
parents:
diff changeset
106 static VMStructEntry localHotSpotVMStructs[];
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // The last entry is identified over in the serviceability agent by
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // the fact that it has a NULL typeName
a61af66fc99e Initial load
duke
parents:
diff changeset
110 static VMTypeEntry localHotSpotVMTypes[];
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // Table of integer constants required by the serviceability agent.
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // The last entry is identified over in the serviceability agent by
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // the fact that it has a NULL typeName
a61af66fc99e Initial load
duke
parents:
diff changeset
115 static VMIntConstantEntry localHotSpotVMIntConstants[];
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // Table of long constants required by the serviceability agent.
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // The last entry is identified over in the serviceability agent by
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // the fact that it has a NULL typeName
a61af66fc99e Initial load
duke
parents:
diff changeset
120 static VMLongConstantEntry localHotSpotVMLongConstants[];
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // This is used to run any checking code necessary for validation of
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // the data structure (debug build only)
a61af66fc99e Initial load
duke
parents:
diff changeset
124 static void init();
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // Look up a type in localHotSpotVMTypes using strcmp() (debug build only).
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // Returns 1 if found, 0 if not.
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // debug_only(static int findType(const char* typeName);)
a61af66fc99e Initial load
duke
parents:
diff changeset
130 static int findType(const char* typeName);
a61af66fc99e Initial load
duke
parents:
diff changeset
131 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
132
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
133 #endif // SHARE_VM_RUNTIME_VMSTRUCTS_HPP