Mercurial > hg > graal-jvmci-8
annotate agent/src/share/classes/sun/jvm/hotspot/types/TypeDataBase.java @ 17524:89152779163c
Merge with jdk8-b132
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 11:59:32 +0200 |
parents | f6f3bb0ee072 |
children |
rev | line source |
---|---|
0 | 1 /* |
3939 | 2 * Copyright (c) 2000, 2011, 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 | |
25 package sun.jvm.hotspot.types; | |
26 | |
27 import java.util.Iterator; | |
28 import sun.jvm.hotspot.debugger.Address; | |
29 | |
30 public interface TypeDataBase { | |
31 /** Equivalent to lookupType(cTypeName, true) */ | |
32 public Type lookupType(String cTypeName); | |
33 | |
34 /** For simplicity of the initial implementation, this is not | |
35 guaranteed to work for primitive types. If throwException is | |
36 true, throws an (unspecified) run-time exception if the type is | |
37 not found. */ | |
38 public Type lookupType(String cTypeName, boolean throwException); | |
39 | |
40 /** Equivalent to lookupIntConstant(constantName, true) */ | |
41 public Integer lookupIntConstant(String constantName); | |
42 | |
43 /* For convenience, this interface also encapsulates the fetching of | |
44 integer constants, i.e., enums. If no constant of this name was | |
45 present, either throws an (unspecified) run-time exception or | |
46 returns null. */ | |
47 public Integer lookupIntConstant(String constantName, boolean throwException); | |
48 | |
49 /** Equivalent to lookupLongConstant(constantName, true) */ | |
50 public Long lookupLongConstant(String constantName); | |
51 | |
52 /* For convenience, this interface also encapsulates the fetching of | |
53 long constants (those requiring 64 bits on 64-bit platforms). If | |
54 no constant of this name was present, either throws an | |
55 (unspecified) run-time exception or returns null. */ | |
56 public Long lookupLongConstant(String constantName, boolean throwException); | |
57 | |
58 /** Accessors for types representing the Java primitive types; used | |
59 for both proper type checking and for walking down Java arrays. */ | |
60 public Type getJBooleanType(); | |
61 public Type getJByteType(); | |
62 public Type getJCharType(); | |
63 public Type getJDoubleType(); | |
64 public Type getJFloatType(); | |
65 public Type getJIntType(); | |
66 public Type getJLongType(); | |
67 public Type getJShortType(); | |
68 | |
69 /** Returns the size of a C address in bytes. This is currently | |
70 needed in order to properly traverse an array of pointers. | |
71 Traversing an array of structs, for example, is possible by | |
72 looking up the type of the struct and multiplying the index by | |
73 its size when indexing off of a base Address. (FIXME: what about | |
74 alignment?) */ | |
75 public long getAddressSize(); | |
76 | |
77 /** Returns the size of an oop in bytes. This is currently needed in | |
78 order to properly traverse an array of oops; it is distinguished | |
79 from the address size, above, because object pointers could | |
80 conceivably have a different representation than direct | |
81 pointers. Traversing an array of structs, for example, is | |
82 possible by looking up the type of the struct and multiplying | |
83 the index by its size when indexing off of a base Address. */ | |
84 public long getOopSize(); | |
85 | |
86 /** <P> This is an experimental interface emulating C++'s run-time | |
87 type information (RTTI) mechanism: determines whether the given | |
88 address is a pointer to the start of a C++ object of precisely | |
89 the given type -- it does not search superclasses of the type. | |
90 The convention is that this returns false for the null pointer. | |
91 It is needed to allow wrapper Java objects of the appropriate | |
92 type to be constructed for existing C++ objects of polymorphic | |
93 type. This method is only intended to work for C++ types | |
94 (implying that we should rename this package and the classes | |
95 contained within back to "ctypes"). Further, since the vptr | |
96 offset in an object is known at compile time but not necessarily | |
97 at runtime (unless debugging information is available), it is | |
98 reasonable for an implementation of this method to search nearby | |
99 memory for the (known) vtbl value for the given type. For this | |
100 reason, this method is not intended to support scans through | |
101 memory finding C++ objects, but is instead targeted towards | |
102 discovering the true type of a pointer assumed to be | |
103 intact. </P> | |
104 | |
105 <P> The reason this method was placed in the type database is | |
106 that the latter is the first level at which it could be exposed, | |
107 and placing it here could avoid modifying the Type interface. It | |
108 is unclear what other, if any, vtbl access would be useful (or | |
109 implementable), so we are trying to avoid changing interfaces at | |
110 this point to support this kind of functionality. </P> | |
111 | |
112 <P> This method necessarily does not support multiple | |
113 inheritance. </P> */ | |
114 public boolean addressTypeIsEqualToType(Address addr, Type type); | |
115 | |
116 /** Helper routine for guessing the most derived type of a | |
117 polymorphic C++ object. Iterates the type database calling | |
118 addressTypeIsEqualToType for all known types. Returns a matching | |
119 Type for the given address if one was found, or null if none was | |
120 found. */ | |
121 public Type guessTypeForAddress(Address addr); | |
122 | |
3939 | 123 /** Helper routine for guessing the most derived type of a |
124 polymorphic C++ object. Requires a baseType that must be virtual | |
125 so that lookup can be performed without false positives */ | |
126 public Type findDynamicTypeForAddress(Address addr, Type baseType); | |
127 | |
0 | 128 /** Returns an Iterator over the Types in the database. */ |
129 public Iterator getTypes(); | |
130 | |
131 /** Returns an Iterator over the String names of the integer | |
132 constants in the database. */ | |
133 public Iterator getIntConstants(); | |
134 | |
135 /** Returns an Iterator over the String names of the long constants | |
136 in the database. */ | |
137 public Iterator getLongConstants(); | |
138 } |