author | ysuenaga |
Fri, 01 Dec 2017 10:04:31 +0900 | |
changeset 48175 | babef393c286 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48175
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
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 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
package sun.jvm.hotspot.runtime; |
|
26 |
||
48175
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
27 |
import java.util.Observer; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
28 |
import sun.jvm.hotspot.types.TypeDataBase; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
29 |
|
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
30 |
|
1 | 31 |
/** Encapsulates the BasicTypeSize enum in globalDefinitions.hpp in |
32 |
the VM. */ |
|
33 |
||
34 |
public class BasicTypeSize { |
|
48175
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
35 |
private static int tBooleanSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
36 |
private static int tCharSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
37 |
private static int tFloatSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
38 |
private static int tDoubleSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
39 |
private static int tByteSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
40 |
private static int tShortSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
41 |
private static int tIntSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
42 |
private static int tLongSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
43 |
private static int tObjectSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
44 |
private static int tArraySize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
45 |
private static int tNarrowOopSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
46 |
private static int tNarrowKlassSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
47 |
private static int tVoidSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
48 |
|
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
49 |
static { |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
50 |
VM.registerVMInitializedObserver( |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
51 |
(o, d) -> initialize(VM.getVM().getTypeDataBase())); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
52 |
} |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
53 |
|
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
54 |
private static synchronized void initialize(TypeDataBase db) { |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
55 |
tBooleanSize = db.lookupIntConstant("T_BOOLEAN_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
56 |
tCharSize = db.lookupIntConstant("T_INT_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
57 |
tFloatSize = db.lookupIntConstant("T_FLOAT_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
58 |
tDoubleSize = db.lookupIntConstant("T_DOUBLE_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
59 |
tByteSize = db.lookupIntConstant("T_BYTE_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
60 |
tShortSize = db.lookupIntConstant("T_SHORT_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
61 |
tIntSize = db.lookupIntConstant("T_INT_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
62 |
tLongSize = db.lookupIntConstant("T_LONG_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
63 |
tObjectSize = db.lookupIntConstant("T_OBJECT_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
64 |
tArraySize = db.lookupIntConstant("T_ARRAY_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
65 |
tNarrowOopSize = db.lookupIntConstant("T_NARROWOOP_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
66 |
tNarrowKlassSize = db.lookupIntConstant("T_NARROWKLASS_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
67 |
tVoidSize = db.lookupIntConstant("T_VOID_size").intValue(); |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
68 |
} |
1 | 69 |
|
70 |
public static int getTBooleanSize() { |
|
71 |
return tBooleanSize; |
|
72 |
} |
|
73 |
||
74 |
public static int getTCharSize() { |
|
75 |
return tCharSize; |
|
76 |
} |
|
77 |
||
78 |
public static int getTFloatSize() { |
|
79 |
return tFloatSize; |
|
80 |
} |
|
81 |
||
82 |
public static int getTDoubleSize() { |
|
83 |
return tDoubleSize; |
|
84 |
} |
|
85 |
||
86 |
public static int getTByteSize() { |
|
87 |
return tByteSize; |
|
88 |
} |
|
89 |
||
90 |
public static int getTShortSize() { |
|
91 |
return tShortSize; |
|
92 |
} |
|
93 |
||
94 |
public static int getTIntSize() { |
|
95 |
return tIntSize; |
|
96 |
} |
|
97 |
||
98 |
public static int getTLongSize() { |
|
99 |
return tLongSize; |
|
100 |
} |
|
101 |
||
102 |
public static int getTObjectSize() { |
|
103 |
return tObjectSize; |
|
104 |
} |
|
105 |
||
106 |
public static int getTArraySize() { |
|
107 |
return tArraySize; |
|
108 |
} |
|
109 |
||
48175
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
110 |
public static int getTNarrowOopSize() { |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
111 |
return tNarrowOopSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
112 |
} |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
113 |
|
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
114 |
public static int getTNarrowKlassSize() { |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
115 |
return tNarrowKlassSize; |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
116 |
} |
babef393c286
8190837: BasicType and BasicTypeSize should refer to HotSpot values
ysuenaga
parents:
47216
diff
changeset
|
117 |
|
1 | 118 |
public static int getTVoidSize() { |
119 |
return tVoidSize; |
|
120 |
} |
|
121 |
} |