annotate agent/src/share/classes/sun/jvm/hotspot/types/Type.java @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
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 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.types;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.util.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 /** This is the top-level interface which describes C++ classes and
a61af66fc99e Initial load
duke
parents:
diff changeset
30 primitive types as well as enough about Java primitive and object
a61af66fc99e Initial load
duke
parents:
diff changeset
31 types to allow the oop hierarchy to be constructed. */
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 public interface Type {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 public String getName();
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 /* The supertype of this type. May be null for top-level classes and
a61af66fc99e Initial load
duke
parents:
diff changeset
37 primitive types. NOTE that multiple inheritance is currently not
a61af66fc99e Initial load
duke
parents:
diff changeset
38 handled. However, it could (probably) be by making this return a
a61af66fc99e Initial load
duke
parents:
diff changeset
39 list and adding appropriate routines to cast an address of one
a61af66fc99e Initial load
duke
parents:
diff changeset
40 type to another. */
a61af66fc99e Initial load
duke
parents:
diff changeset
41 public Type getSuperclass();
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 /** The size in bytes, at the machine level, of this type. This
a61af66fc99e Initial load
duke
parents:
diff changeset
44 should be equivalent to the sizeof operator -- i.e., should
a61af66fc99e Initial load
duke
parents:
diff changeset
45 include any compiler-inserted fields like the vtbl for C++
a61af66fc99e Initial load
duke
parents:
diff changeset
46 types. */
a61af66fc99e Initial load
duke
parents:
diff changeset
47 public long getSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 /** Indicates whether this type is a C integer type -- regardless of
a61af66fc99e Initial load
duke
parents:
diff changeset
50 size or signedness. */
a61af66fc99e Initial load
duke
parents:
diff changeset
51 public boolean isCIntegerType();
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 /** Indicates whether this type is const char*. */
a61af66fc99e Initial load
duke
parents:
diff changeset
54 public boolean isCStringType();
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 /** Indicates whether this type is one of the Java primitive types. */
a61af66fc99e Initial load
duke
parents:
diff changeset
57 public boolean isJavaPrimitiveType();
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 /** Indicates whether this type is an oop type in the VM. */
a61af66fc99e Initial load
duke
parents:
diff changeset
60 public boolean isOopType();
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 /** Indicates whether this type is a pointer type. */
a61af66fc99e Initial load
duke
parents:
diff changeset
63 public boolean isPointerType();
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 /** This is permissive and returns the CField regardless of its type
a61af66fc99e Initial load
duke
parents:
diff changeset
66 as long as it is present. Returns null if the field was not
a61af66fc99e Initial load
duke
parents:
diff changeset
67 found, unless throwExceptionIfNotFound is true, in which case a
a61af66fc99e Initial load
duke
parents:
diff changeset
68 RuntimeException is thrown (for debugging purposes). */
a61af66fc99e Initial load
duke
parents:
diff changeset
69 public Field getField(String fieldName, boolean searchSuperclassFields,
a61af66fc99e Initial load
duke
parents:
diff changeset
70 boolean throwExceptionIfNotFound);
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 /** This is permissive and returns the CField regardless of its type
a61af66fc99e Initial load
duke
parents:
diff changeset
73 as long as it is present -- it is equivalent to
a61af66fc99e Initial load
duke
parents:
diff changeset
74 getField(fieldName, searchSuperclassFields, true). Throws a
a61af66fc99e Initial load
duke
parents:
diff changeset
75 RuntimeException if the field was not found. */
a61af66fc99e Initial load
duke
parents:
diff changeset
76 public Field getField(String fieldName, boolean searchSuperclassFields);
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 /** This is permissive and returns the CField regardless of its type
a61af66fc99e Initial load
duke
parents:
diff changeset
79 as long as it is present. This does not search superclasses'
a61af66fc99e Initial load
duke
parents:
diff changeset
80 fields; it is equivalent to getField(fieldName, false). Throws a
a61af66fc99e Initial load
duke
parents:
diff changeset
81 RuntimeException if the field was not found. */
a61af66fc99e Initial load
duke
parents:
diff changeset
82 public Field getField(String fieldName);
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 /** If there is a mismatch between the declared type and the type
a61af66fc99e Initial load
duke
parents:
diff changeset
85 which would otherwise be returned from this routine, it throws a
a61af66fc99e Initial load
duke
parents:
diff changeset
86 WrongTypeException. declaredType must not be null. Throws a
a61af66fc99e Initial load
duke
parents:
diff changeset
87 RuntimeException if field was otherwise not found. */
a61af66fc99e Initial load
duke
parents:
diff changeset
88 public Field getField(String fieldName, Type declaredType,
a61af66fc99e Initial load
duke
parents:
diff changeset
89 boolean searchSuperclassFields) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 /** If there is a mismatch between the declared type and the type
a61af66fc99e Initial load
duke
parents:
diff changeset
92 which would otherwise be returned from this routine, it throws a
a61af66fc99e Initial load
duke
parents:
diff changeset
93 WrongTypeException. declaredType must not be null. This does not
a61af66fc99e Initial load
duke
parents:
diff changeset
94 search superclasses' fields; it is equivalent to
a61af66fc99e Initial load
duke
parents:
diff changeset
95 getField(fieldName, declaredType, false). Throws a
a61af66fc99e Initial load
duke
parents:
diff changeset
96 RuntimeException if field was otherwise not found. */
a61af66fc99e Initial load
duke
parents:
diff changeset
97 public Field getField(String fieldName, Type declaredType) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 /** Iterate over all of the fields in this type but <B>not</B> in
a61af66fc99e Initial load
duke
parents:
diff changeset
100 any of its superclasses. The returned Iterator's "remove" method
a61af66fc99e Initial load
duke
parents:
diff changeset
101 must not be called. */
a61af66fc99e Initial load
duke
parents:
diff changeset
102 public Iterator getFields();
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 /** <P> These accessors are designed to allow strong type checking
a61af66fc99e Initial load
duke
parents:
diff changeset
105 of certain well-known types of fields, specifically Java
a61af66fc99e Initial load
duke
parents:
diff changeset
106 primitive and oop types. Specialized fields for all primitive
a61af66fc99e Initial load
duke
parents:
diff changeset
107 types, as well as oop fields, are required to have strong type
a61af66fc99e Initial load
duke
parents:
diff changeset
108 checking and a WrongTypeException should be thrown if the given
a61af66fc99e Initial load
duke
parents:
diff changeset
109 field is not precisely of the given type. Address and Oop fields
a61af66fc99e Initial load
duke
parents:
diff changeset
110 are more permissive to reduce the complexity of the initial
a61af66fc99e Initial load
duke
parents:
diff changeset
111 implementation. </P>
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 <P> These accessors do not search the superclass's fields. </P>
a61af66fc99e Initial load
duke
parents:
diff changeset
114 */
a61af66fc99e Initial load
duke
parents:
diff changeset
115 public JBooleanField getJBooleanField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
116 public JByteField getJByteField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
117 public JCharField getJCharField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
118 public JDoubleField getJDoubleField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 public JFloatField getJFloatField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
120 public JIntField getJIntField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
121 public JLongField getJLongField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
122 public JShortField getJShortField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
123 public CIntegerField getCIntegerField (String fieldName) throws WrongTypeException;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 public OopField getOopField (String fieldName) throws WrongTypeException;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
125 public NarrowOopField getNarrowOopField (String fieldName) throws WrongTypeException;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
126 public AddressField getAddressField (String fieldName);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 }