1 /*
2 * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.runtime;
26
27 public interface ClassConstants
28 {
29 // constant pool constant types - from JVM spec.
30
31 public static final int JVM_CONSTANT_Utf8 = 1;
32 public static final int JVM_CONSTANT_Unicode = 2; // unused
33 public static final int JVM_CONSTANT_Integer = 3;
34 public static final int JVM_CONSTANT_Float = 4;
35 public static final int JVM_CONSTANT_Long = 5;
36 public static final int JVM_CONSTANT_Double = 6;
37 public static final int JVM_CONSTANT_Class = 7;
38 public static final int JVM_CONSTANT_String = 8;
39 public static final int JVM_CONSTANT_Fieldref = 9;
40 public static final int JVM_CONSTANT_Methodref = 10;
41 public static final int JVM_CONSTANT_InterfaceMethodref = 11;
42 public static final int JVM_CONSTANT_NameAndType = 12;
43 public static final int JVM_CONSTANT_MethodHandle = 15;
44 public static final int JVM_CONSTANT_MethodType = 16;
45 public static final int JVM_CONSTANT_Dynamic = 17;
46 public static final int JVM_CONSTANT_InvokeDynamic = 18;
47 public static final int JVM_CONSTANT_Module = 19;
48 public static final int JVM_CONSTANT_Package = 20;
49
50 // JVM_CONSTANT_MethodHandle subtypes
51 public static final int JVM_REF_getField = 1;
52 public static final int JVM_REF_getStatic = 2;
53 public static final int JVM_REF_putField = 3;
54 public static final int JVM_REF_putStatic = 4;
55 public static final int JVM_REF_invokeVirtual = 5;
56 public static final int JVM_REF_invokeStatic = 6;
57 public static final int JVM_REF_invokeSpecial = 7;
58 public static final int JVM_REF_newInvokeSpecial = 8;
59 public static final int JVM_REF_invokeInterface = 9;
60
61 // HotSpot specific constant pool constant types.
62
63 // For bad value initialization
64 public static final int JVM_CONSTANT_Invalid = 0;
65
66 public static final int JVM_CONSTANT_UnresolvedClass = 100; // Temporary tag until actual use
67 public static final int JVM_CONSTANT_ClassIndex = 101; // Temporary tag while constructing constant pool
68 public static final int JVM_CONSTANT_StringIndex = 102; // Temporary tag while constructing constant pool
69 public static final int JVM_CONSTANT_UnresolvedClassInError = 103; // Error tag due to resolution error
70 public static final int JVM_CONSTANT_MethodHandleInError = 104; // Error tag due to resolution error
71 public static final int JVM_CONSTANT_MethodTypeInError = 105; // Error tag due to resolution error
72
73 // 1.5 major/minor version numbers from JVM spec. 3rd edition
74 public static final short MAJOR_VERSION = 49;
75 public static final short MINOR_VERSION = 0;
76
77 public static final short MAJOR_VERSION_OLD = 46;
78 public static final short MINOR_VERSION_OLD = 0;
79
80 // From jvm.h
81 public static final long JVM_ACC_PUBLIC = 0x0001; /* visible to everyone */
82 public static final long JVM_ACC_PRIVATE = 0x0002; /* visible only to the defining class */
83 public static final long JVM_ACC_PROTECTED = 0x0004; /* visible to subclasses */
84 public static final long JVM_ACC_STATIC = 0x0008; /* instance variable is static */
85 public static final long JVM_ACC_FINAL = 0x0010; /* no further subclassing, overriding */
86 public static final long JVM_ACC_SYNCHRONIZED = 0x0020; /* wrap method call in monitor lock */
87 public static final long JVM_ACC_SUPER = 0x0020; /* funky handling of invokespecial */
88 public static final long JVM_ACC_VOLATILE = 0x0040; /* can not cache in registers */
89 public static final long JVM_ACC_BRIDGE = 0x0040; /* bridge method generated by compiler */
90 public static final long JVM_ACC_TRANSIENT = 0x0080; /* not persistent */
91 public static final long JVM_ACC_VARARGS = 0x0080; /* method declared with variable number of args */
92 public static final long JVM_ACC_NATIVE = 0x0100; /* implemented in C */
93 public static final long JVM_ACC_INTERFACE = 0x0200; /* class is an interface */
94 public static final long JVM_ACC_ABSTRACT = 0x0400; /* no definition provided */
95 public static final long JVM_ACC_STRICT = 0x0800; /* strict floating point */
96 public static final long JVM_ACC_SYNTHETIC = 0x1000; /* compiler-generated class, method or field */
97 public static final long JVM_ACC_ANNOTATION = 0x2000; /* annotation type */
98 public static final long JVM_ACC_ENUM = 0x4000; /* field is declared as element of enum */
99
100
101 // from jvm.h
102 public static final long JVM_RECOGNIZED_CLASS_MODIFIERS = (JVM_ACC_PUBLIC |
103 JVM_ACC_FINAL |
104 JVM_ACC_SUPER |
105 JVM_ACC_INTERFACE |
106 JVM_ACC_ABSTRACT |
107 JVM_ACC_ANNOTATION |
108 JVM_ACC_ENUM |
109 JVM_ACC_SYNTHETIC);
110
111
112 public static final long JVM_RECOGNIZED_FIELD_MODIFIERS = (JVM_ACC_PUBLIC |
113 JVM_ACC_PRIVATE |
114 JVM_ACC_PROTECTED |
115 JVM_ACC_STATIC |
116 JVM_ACC_FINAL |
117 JVM_ACC_VOLATILE |
118 JVM_ACC_TRANSIENT |
119 JVM_ACC_ENUM |
120 JVM_ACC_SYNTHETIC);
121
122 public static final long JVM_RECOGNIZED_METHOD_MODIFIERS = (JVM_ACC_PUBLIC |
123 JVM_ACC_PRIVATE |
124 JVM_ACC_PROTECTED |
125 JVM_ACC_STATIC |
126 JVM_ACC_FINAL |
127 JVM_ACC_SYNCHRONIZED |
128 JVM_ACC_BRIDGE |
129 JVM_ACC_VARARGS |
130 JVM_ACC_NATIVE |
131 JVM_ACC_ABSTRACT |
132 JVM_ACC_STRICT |
133 JVM_ACC_SYNTHETIC);
134 }