Mercurial > hg > graal-jvmci-8
annotate src/share/vm/runtime/vmStructs.hpp @ 7588:f9eb431c3efe
8006005: Fix constant pool index validation and alignment trap for method parameter reflection
Summary: This patch addresses an alignment trap due to the storage format of method parameters data in constMethod. It also adds code to validate constant pool indexes for method parameters data.
Reviewed-by: jrose, dholmes
Contributed-by: eric.mccorkle@oracle.com
author | coleenp |
---|---|
date | Mon, 14 Jan 2013 11:01:39 -0500 |
parents | 7c15faa95ce7 |
children | 8b46b0196eb0 |
rev | line source |
---|---|
0 | 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 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
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 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_RUNTIME_VMSTRUCTS_HPP |
26 #define SHARE_VM_RUNTIME_VMSTRUCTS_HPP | |
27 | |
28 #ifndef VM_STRUCTS_KERNEL | |
29 #include "utilities/debug.hpp" | |
30 #endif | |
31 #ifdef COMPILER1 | |
32 #include "c1/c1_Runtime1.hpp" | |
33 #endif | |
34 | |
0 | 35 // This table encapsulates the debugging information required by the |
36 // serviceability agent in order to run. Specifically, we need to | |
37 // understand the layout of certain C data structures (offsets, in | |
38 // bytes, of their fields.) | |
39 // | |
40 // There are alternatives for the design of this mechanism, including | |
41 // parsing platform-specific debugging symbols from a debug build into | |
42 // a program database. While this current mechanism can be considered | |
43 // to be a workaround for the inability to debug arbitrary C and C++ | |
44 // programs at the present time, it does have certain advantages. | |
45 // First, it is platform-independent, which will vastly simplify the | |
46 // initial bringup of the system both now and on future platforms. | |
47 // Second, it is embedded within the VM, as opposed to being in a | |
48 // separate program database; experience has shown that whenever | |
49 // portions of a system are decoupled, version skew is problematic. | |
50 // Third, generating a program database, for example for a product | |
51 // build, would probably require two builds to be done: the desired | |
52 // product build as well as an intermediary build with the PRODUCT | |
53 // flag turned on but also compiled with -g, leading to a doubling of | |
54 // the time required to get a serviceability agent-debuggable product | |
55 // build. Fourth, and very significantly, this table probably | |
56 // preserves more information about field types than stabs do; for | |
57 // example, it preserves the fact that a field is a "jlong" rather | |
58 // than transforming the type according to the typedef in jni_md.h, | |
59 // which allows the Java-side code to identify "Java-sized" fields in | |
60 // C++ data structures. If the symbol parsing mechanism was redone | |
61 // using stabs, it might still be necessary to have a table somewhere | |
62 // containing this information. | |
63 // | |
64 // Do not change the sizes or signedness of the integer values in | |
65 // these data structures; they are fixed over in the serviceability | |
66 // agent's Java code (for bootstrapping). | |
67 | |
68 typedef struct { | |
69 const char* typeName; // The type name containing the given field (example: "Klass") | |
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 | 72 // parsed in Java to ensure type correctness |
73 int32_t isStatic; // Indicates whether following field is an offset or an address | |
74 uint64_t offset; // Offset of field within structure; only used for nonstatic fields | |
75 void* address; // Address of field; only used for static fields | |
76 // ("offset" can not be reused because of apparent SparcWorks compiler bug | |
77 // in generation of initializer data) | |
78 } VMStructEntry; | |
79 | |
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 | 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 | 85 int32_t isIntegerType; // Does this type represent an integer type (of arbitrary size)? |
86 int32_t isUnsigned; // If so, is it unsigned? | |
87 uint64_t size; // Size, in bytes, of the type | |
88 } VMTypeEntry; | |
89 | |
90 typedef struct { | |
91 const char* name; // Name of constant (example: "_thread_in_native") | |
92 int32_t value; // Value of constant | |
93 } VMIntConstantEntry; | |
94 | |
95 typedef struct { | |
96 const char* name; // Name of constant (example: "_thread_in_native") | |
97 uint64_t value; // Value of constant | |
98 } VMLongConstantEntry; | |
99 | |
100 // This class is a friend of most classes, to be able to access | |
101 // private fields | |
102 class VMStructs { | |
103 public: | |
104 // The last entry is identified over in the serviceability agent by | |
105 // the fact that it has a NULL fieldName | |
106 static VMStructEntry localHotSpotVMStructs[]; | |
107 | |
108 // The last entry is identified over in the serviceability agent by | |
109 // the fact that it has a NULL typeName | |
110 static VMTypeEntry localHotSpotVMTypes[]; | |
111 | |
112 // Table of integer constants required by the serviceability agent. | |
113 // The last entry is identified over in the serviceability agent by | |
114 // the fact that it has a NULL typeName | |
115 static VMIntConstantEntry localHotSpotVMIntConstants[]; | |
116 | |
117 // Table of long constants required by the serviceability agent. | |
118 // The last entry is identified over in the serviceability agent by | |
119 // the fact that it has a NULL typeName | |
120 static VMLongConstantEntry localHotSpotVMLongConstants[]; | |
121 | |
122 // This is used to run any checking code necessary for validation of | |
123 // the data structure (debug build only) | |
124 static void init(); | |
125 | |
7171 | 126 #ifndef PRODUCT |
127 // Execute unit tests | |
128 static void test(); | |
129 #endif | |
130 | |
0 | 131 private: |
132 // Look up a type in localHotSpotVMTypes using strcmp() (debug build only). | |
133 // Returns 1 if found, 0 if not. | |
134 // debug_only(static int findType(const char* typeName);) | |
135 static int findType(const char* typeName); | |
136 }; | |
1972 | 137 |
138 #endif // SHARE_VM_RUNTIME_VMSTRUCTS_HPP |