|
1 /* |
|
2 * Copyright 1997-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 * |
|
23 */ |
|
24 |
|
25 // The classes vmSymbols and vmSymbolHandles are a name spaces for fast lookup of |
|
26 // symbols commonly used in the VM. The first class return a symbolOop, while the |
|
27 // second class returns a SymbolHandle. The underlying data structure is shared |
|
28 // between the two classes. |
|
29 // |
|
30 // Sample usage: |
|
31 // |
|
32 // symbolOop obj = vmSymbols::java_lang_Object()(); |
|
33 // SymbolHandle handle = vmSymbolHandles::java_lang_Object(); |
|
34 |
|
35 |
|
36 // Useful sub-macros exported by this header file: |
|
37 |
|
38 #define VM_SYMBOL_ENUM_NAME(name) name##_enum |
|
39 #define VM_INTRINSIC_IGNORE(id, class, name, sig, flags) /*ignored*/ |
|
40 #define VM_SYMBOL_IGNORE(id, name) /*ignored*/ |
|
41 #define VM_ALIAS_IGNORE(id, id2) /*ignored*/ |
|
42 |
|
43 |
|
44 // Mapping function names to values. New entries should be added below. |
|
45 |
|
46 #define VM_SYMBOLS_DO(template, do_alias) \ |
|
47 /* commonly used class names */ \ |
|
48 template(java_lang_System, "java/lang/System") \ |
|
49 template(java_lang_Object, "java/lang/Object") \ |
|
50 template(java_lang_Class, "java/lang/Class") \ |
|
51 template(java_lang_String, "java/lang/String") \ |
|
52 template(java_lang_Thread, "java/lang/Thread") \ |
|
53 template(java_lang_ThreadGroup, "java/lang/ThreadGroup") \ |
|
54 template(java_lang_Cloneable, "java/lang/Cloneable") \ |
|
55 template(java_lang_Throwable, "java/lang/Throwable") \ |
|
56 template(java_lang_ClassLoader, "java/lang/ClassLoader") \ |
|
57 template(java_lang_ClassLoader_NativeLibrary, "java/lang/ClassLoader\x024NativeLibrary") \ |
|
58 template(java_lang_ThreadDeath, "java/lang/ThreadDeath") \ |
|
59 template(java_lang_Boolean, "java/lang/Boolean") \ |
|
60 template(java_lang_Character, "java/lang/Character") \ |
|
61 template(java_lang_Float, "java/lang/Float") \ |
|
62 template(java_lang_Double, "java/lang/Double") \ |
|
63 template(java_lang_Byte, "java/lang/Byte") \ |
|
64 template(java_lang_Short, "java/lang/Short") \ |
|
65 template(java_lang_Integer, "java/lang/Integer") \ |
|
66 template(java_lang_Long, "java/lang/Long") \ |
|
67 template(java_lang_Shutdown, "java/lang/Shutdown") \ |
|
68 template(java_lang_ref_Reference, "java/lang/ref/Reference") \ |
|
69 template(java_lang_ref_SoftReference, "java/lang/ref/SoftReference") \ |
|
70 template(java_lang_ref_WeakReference, "java/lang/ref/WeakReference") \ |
|
71 template(java_lang_ref_FinalReference, "java/lang/ref/FinalReference") \ |
|
72 template(java_lang_ref_PhantomReference, "java/lang/ref/PhantomReference") \ |
|
73 template(java_lang_ref_Finalizer, "java/lang/ref/Finalizer") \ |
|
74 template(java_lang_reflect_AccessibleObject, "java/lang/reflect/AccessibleObject") \ |
|
75 template(java_lang_reflect_Method, "java/lang/reflect/Method") \ |
|
76 template(java_lang_reflect_Constructor, "java/lang/reflect/Constructor") \ |
|
77 template(java_lang_reflect_Field, "java/lang/reflect/Field") \ |
|
78 template(java_lang_reflect_Array, "java/lang/reflect/Array") \ |
|
79 template(java_lang_StringBuffer, "java/lang/StringBuffer") \ |
|
80 template(java_lang_CharSequence, "java/lang/CharSequence") \ |
|
81 template(java_security_AccessControlContext, "java/security/AccessControlContext") \ |
|
82 template(java_security_ProtectionDomain, "java/security/ProtectionDomain") \ |
|
83 template(java_io_OutputStream, "java/io/OutputStream") \ |
|
84 template(java_io_Reader, "java/io/Reader") \ |
|
85 template(java_io_BufferedReader, "java/io/BufferedReader") \ |
|
86 template(java_io_FileInputStream, "java/io/FileInputStream") \ |
|
87 template(java_io_ByteArrayInputStream, "java/io/ByteArrayInputStream") \ |
|
88 template(java_io_Serializable, "java/io/Serializable") \ |
|
89 template(java_util_Arrays, "java/util/Arrays") \ |
|
90 template(java_util_Properties, "java/util/Properties") \ |
|
91 template(java_util_Vector, "java/util/Vector") \ |
|
92 template(java_util_AbstractList, "java/util/AbstractList") \ |
|
93 template(java_util_Hashtable, "java/util/Hashtable") \ |
|
94 template(java_lang_Compiler, "java/lang/Compiler") \ |
|
95 template(sun_misc_Signal, "sun/misc/Signal") \ |
|
96 template(java_lang_AssertionStatusDirectives, "java/lang/AssertionStatusDirectives") \ |
|
97 template(sun_jkernel_DownloadManager, "sun/jkernel/DownloadManager") \ |
|
98 template(getBootClassPathEntryForClass_name, "getBootClassPathEntryForClass") \ |
|
99 \ |
|
100 /* class file format tags */ \ |
|
101 template(tag_source_file, "SourceFile") \ |
|
102 template(tag_inner_classes, "InnerClasses") \ |
|
103 template(tag_constant_value, "ConstantValue") \ |
|
104 template(tag_code, "Code") \ |
|
105 template(tag_exceptions, "Exceptions") \ |
|
106 template(tag_line_number_table, "LineNumberTable") \ |
|
107 template(tag_local_variable_table, "LocalVariableTable") \ |
|
108 template(tag_local_variable_type_table, "LocalVariableTypeTable") \ |
|
109 template(tag_stack_map_table, "StackMapTable") \ |
|
110 template(tag_synthetic, "Synthetic") \ |
|
111 template(tag_deprecated, "Deprecated") \ |
|
112 template(tag_source_debug_extension, "SourceDebugExtension") \ |
|
113 template(tag_signature, "Signature") \ |
|
114 template(tag_runtime_visible_annotations, "RuntimeVisibleAnnotations") \ |
|
115 template(tag_runtime_invisible_annotations, "RuntimeInvisibleAnnotations") \ |
|
116 template(tag_runtime_visible_parameter_annotations, "RuntimeVisibleParameterAnnotations") \ |
|
117 template(tag_runtime_invisible_parameter_annotations,"RuntimeInvisibleParameterAnnotations") \ |
|
118 template(tag_annotation_default, "AnnotationDefault") \ |
|
119 template(tag_enclosing_method, "EnclosingMethod") \ |
|
120 \ |
|
121 /* exception klasses: at least all exceptions thrown by the VM have entries here */ \ |
|
122 template(java_lang_ArithmeticException, "java/lang/ArithmeticException") \ |
|
123 template(java_lang_ArrayIndexOutOfBoundsException, "java/lang/ArrayIndexOutOfBoundsException") \ |
|
124 template(java_lang_ArrayStoreException, "java/lang/ArrayStoreException") \ |
|
125 template(java_lang_ClassCastException, "java/lang/ClassCastException") \ |
|
126 template(java_lang_ClassNotFoundException, "java/lang/ClassNotFoundException") \ |
|
127 template(java_lang_CloneNotSupportedException, "java/lang/CloneNotSupportedException") \ |
|
128 template(java_lang_IllegalAccessException, "java/lang/IllegalAccessException") \ |
|
129 template(java_lang_IllegalArgumentException, "java/lang/IllegalArgumentException") \ |
|
130 template(java_lang_IllegalMonitorStateException, "java/lang/IllegalMonitorStateException") \ |
|
131 template(java_lang_IllegalThreadStateException, "java/lang/IllegalThreadStateException") \ |
|
132 template(java_lang_IndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException") \ |
|
133 template(java_lang_InstantiationException, "java/lang/InstantiationException") \ |
|
134 template(java_lang_InstantiationError, "java/lang/InstantiationError") \ |
|
135 template(java_lang_InterruptedException, "java/lang/InterruptedException") \ |
|
136 template(java_lang_LinkageError, "java/lang/LinkageError") \ |
|
137 template(java_lang_NegativeArraySizeException, "java/lang/NegativeArraySizeException") \ |
|
138 template(java_lang_NoSuchFieldException, "java/lang/NoSuchFieldException") \ |
|
139 template(java_lang_NoSuchMethodException, "java/lang/NoSuchMethodException") \ |
|
140 template(java_lang_NullPointerException, "java/lang/NullPointerException") \ |
|
141 template(java_lang_StringIndexOutOfBoundsException, "java/lang/StringIndexOutOfBoundsException")\ |
|
142 template(java_lang_InvalidClassException, "java/lang/InvalidClassException") \ |
|
143 template(java_lang_reflect_InvocationTargetException, "java/lang/reflect/InvocationTargetException") \ |
|
144 template(java_lang_Exception, "java/lang/Exception") \ |
|
145 template(java_lang_RuntimeException, "java/lang/RuntimeException") \ |
|
146 template(java_io_IOException, "java/io/IOException") \ |
|
147 template(java_security_PrivilegedActionException, "java/security/PrivilegedActionException") \ |
|
148 \ |
|
149 /* error klasses: at least all errors thrown by the VM have entries here */ \ |
|
150 template(java_lang_AbstractMethodError, "java/lang/AbstractMethodError") \ |
|
151 template(java_lang_ClassCircularityError, "java/lang/ClassCircularityError") \ |
|
152 template(java_lang_ClassFormatError, "java/lang/ClassFormatError") \ |
|
153 template(java_lang_UnsupportedClassVersionError, "java/lang/UnsupportedClassVersionError") \ |
|
154 template(java_lang_Error, "java/lang/Error") \ |
|
155 template(java_lang_ExceptionInInitializerError, "java/lang/ExceptionInInitializerError") \ |
|
156 template(java_lang_IllegalAccessError, "java/lang/IllegalAccessError") \ |
|
157 template(java_lang_IncompatibleClassChangeError, "java/lang/IncompatibleClassChangeError") \ |
|
158 template(java_lang_InternalError, "java/lang/InternalError") \ |
|
159 template(java_lang_NoClassDefFoundError, "java/lang/NoClassDefFoundError") \ |
|
160 template(java_lang_NoSuchFieldError, "java/lang/NoSuchFieldError") \ |
|
161 template(java_lang_NoSuchMethodError, "java/lang/NoSuchMethodError") \ |
|
162 template(java_lang_OutOfMemoryError, "java/lang/OutOfMemoryError") \ |
|
163 template(java_lang_UnsatisfiedLinkError, "java/lang/UnsatisfiedLinkError") \ |
|
164 template(java_lang_VerifyError, "java/lang/VerifyError") \ |
|
165 template(java_lang_SecurityException, "java/lang/SecurityException") \ |
|
166 template(java_lang_VirtualMachineError, "java/lang/VirtualMachineError") \ |
|
167 template(java_lang_StackOverflowError, "java/lang/StackOverflowError") \ |
|
168 template(java_lang_StackTraceElement, "java/lang/StackTraceElement") \ |
|
169 template(java_util_concurrent_locks_AbstractOwnableSynchronizer, "java/util/concurrent/locks/AbstractOwnableSynchronizer") \ |
|
170 \ |
|
171 /* class symbols needed by intrinsics */ \ |
|
172 VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, template, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) \ |
|
173 \ |
|
174 /* Support for reflection based on dynamic bytecode generation (JDK 1.4 and above) */ \ |
|
175 \ |
|
176 template(sun_reflect_FieldInfo, "sun/reflect/FieldInfo") \ |
|
177 template(sun_reflect_MethodInfo, "sun/reflect/MethodInfo") \ |
|
178 template(sun_reflect_MagicAccessorImpl, "sun/reflect/MagicAccessorImpl") \ |
|
179 template(sun_reflect_MethodAccessorImpl, "sun/reflect/MethodAccessorImpl") \ |
|
180 template(sun_reflect_ConstructorAccessorImpl, "sun/reflect/ConstructorAccessorImpl") \ |
|
181 template(sun_reflect_SerializationConstructorAccessorImpl, "sun/reflect/SerializationConstructorAccessorImpl") \ |
|
182 template(sun_reflect_DelegatingClassLoader, "sun/reflect/DelegatingClassLoader") \ |
|
183 template(sun_reflect_Reflection, "sun/reflect/Reflection") \ |
|
184 template(checkedExceptions_name, "checkedExceptions") \ |
|
185 template(clazz_name, "clazz") \ |
|
186 template(exceptionTypes_name, "exceptionTypes") \ |
|
187 template(modifiers_name, "modifiers") \ |
|
188 template(newConstructor_name, "newConstructor") \ |
|
189 template(newConstructor_signature, "(Lsun/reflect/MethodInfo;)Ljava/lang/reflect/Constructor;") \ |
|
190 template(newField_name, "newField") \ |
|
191 template(newField_signature, "(Lsun/reflect/FieldInfo;)Ljava/lang/reflect/Field;") \ |
|
192 template(newMethod_name, "newMethod") \ |
|
193 template(newMethod_signature, "(Lsun/reflect/MethodInfo;)Ljava/lang/reflect/Method;") \ |
|
194 template(invoke_name, "invoke") \ |
|
195 template(override_name, "override") \ |
|
196 template(parameterTypes_name, "parameterTypes") \ |
|
197 template(returnType_name, "returnType") \ |
|
198 template(signature_name, "signature") \ |
|
199 template(slot_name, "slot") \ |
|
200 \ |
|
201 /* Support for annotations (JDK 1.5 and above) */ \ |
|
202 \ |
|
203 template(annotations_name, "annotations") \ |
|
204 template(parameter_annotations_name, "parameterAnnotations") \ |
|
205 template(annotation_default_name, "annotationDefault") \ |
|
206 template(sun_reflect_ConstantPool, "sun/reflect/ConstantPool") \ |
|
207 template(constantPoolOop_name, "constantPoolOop") \ |
|
208 template(sun_reflect_UnsafeStaticFieldAccessorImpl, "sun/reflect/UnsafeStaticFieldAccessorImpl")\ |
|
209 template(base_name, "base") \ |
|
210 \ |
|
211 /* common method names */ \ |
|
212 template(object_initializer_name, "<init>") \ |
|
213 template(class_initializer_name, "<clinit>") \ |
|
214 template(println_name, "println") \ |
|
215 template(printStackTrace_name, "printStackTrace") \ |
|
216 template(main_name, "main") \ |
|
217 template(name_name, "name") \ |
|
218 template(priority_name, "priority") \ |
|
219 template(stillborn_name, "stillborn") \ |
|
220 template(group_name, "group") \ |
|
221 template(daemon_name, "daemon") \ |
|
222 template(eetop_name, "eetop") \ |
|
223 template(thread_status_name, "threadStatus") \ |
|
224 template(run_method_name, "run") \ |
|
225 template(exit_method_name, "exit") \ |
|
226 template(add_method_name, "add") \ |
|
227 template(parent_name, "parent") \ |
|
228 template(threads_name, "threads") \ |
|
229 template(groups_name, "groups") \ |
|
230 template(maxPriority_name, "maxPriority") \ |
|
231 template(destroyed_name, "destroyed") \ |
|
232 template(vmAllowSuspension_name, "vmAllowSuspension") \ |
|
233 template(nthreads_name, "nthreads") \ |
|
234 template(ngroups_name, "ngroups") \ |
|
235 template(shutdown_method_name, "shutdown") \ |
|
236 template(finalize_method_name, "finalize") \ |
|
237 template(reference_lock_name, "lock") \ |
|
238 template(reference_discovered_name, "discovered") \ |
|
239 template(run_finalizers_on_exit_name, "runFinalizersOnExit") \ |
|
240 template(uncaughtException_name, "uncaughtException") \ |
|
241 template(dispatchUncaughtException_name, "dispatchUncaughtException") \ |
|
242 template(initializeSystemClass_name, "initializeSystemClass") \ |
|
243 template(loadClass_name, "loadClass") \ |
|
244 template(loadClassInternal_name, "loadClassInternal") \ |
|
245 template(get_name, "get") \ |
|
246 template(put_name, "put") \ |
|
247 template(type_name, "type") \ |
|
248 template(findNative_name, "findNative") \ |
|
249 template(deadChild_name, "deadChild") \ |
|
250 template(addClass_name, "addClass") \ |
|
251 template(getFromClass_name, "getFromClass") \ |
|
252 template(dispatch_name, "dispatch") \ |
|
253 template(getSystemClassLoader_name, "getSystemClassLoader") \ |
|
254 template(fillInStackTrace_name, "fillInStackTrace") \ |
|
255 template(getCause_name, "getCause") \ |
|
256 template(initCause_name, "initCause") \ |
|
257 template(setProperty_name, "setProperty") \ |
|
258 template(getProperty_name, "getProperty") \ |
|
259 template(context_name, "context") \ |
|
260 template(privilegedContext_name, "privilegedContext") \ |
|
261 template(contextClassLoader_name, "contextClassLoader") \ |
|
262 template(inheritedAccessControlContext_name, "inheritedAccessControlContext") \ |
|
263 template(isPrivileged_name, "isPrivileged") \ |
|
264 template(wait_name, "wait") \ |
|
265 template(checkPackageAccess_name, "checkPackageAccess") \ |
|
266 template(stackSize_name, "stackSize") \ |
|
267 template(thread_id_name, "tid") \ |
|
268 template(newInstance0_name, "newInstance0") \ |
|
269 template(limit_name, "limit") \ |
|
270 template(forName_name, "forName") \ |
|
271 template(forName0_name, "forName0") \ |
|
272 template(isJavaIdentifierStart_name, "isJavaIdentifierStart") \ |
|
273 template(isJavaIdentifierPart_name, "isJavaIdentifierPart") \ |
|
274 template(exclusive_owner_thread_name, "exclusiveOwnerThread") \ |
|
275 template(park_blocker_name, "parkBlocker") \ |
|
276 template(park_event_name, "nativeParkEventPointer") \ |
|
277 template(value_name, "value") \ |
|
278 \ |
|
279 /* non-intrinsic name/signature pairs: */ \ |
|
280 template(register_method_name, "register") \ |
|
281 do_alias(register_method_signature, object_void_signature) \ |
|
282 \ |
|
283 /* name symbols needed by intrinsics */ \ |
|
284 VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, VM_SYMBOL_IGNORE, template, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) \ |
|
285 \ |
|
286 /* common signatures names */ \ |
|
287 template(void_method_signature, "()V") \ |
|
288 template(void_int_signature, "()I") \ |
|
289 template(void_long_signature, "()J") \ |
|
290 template(void_boolean_signature, "()Z") \ |
|
291 template(int_void_signature, "(I)V") \ |
|
292 template(int_int_signature, "(I)I") \ |
|
293 template(int_bool_signature, "(I)Z") \ |
|
294 template(float_int_signature, "(F)I") \ |
|
295 template(double_long_signature, "(D)J") \ |
|
296 template(double_double_signature, "(D)D") \ |
|
297 template(int_float_signature, "(I)F") \ |
|
298 template(long_long_signature, "(J)J") \ |
|
299 template(long_double_signature, "(J)D") \ |
|
300 template(byte_signature, "B") \ |
|
301 template(char_signature, "C") \ |
|
302 template(double_signature, "D") \ |
|
303 template(float_signature, "F") \ |
|
304 template(int_signature, "I") \ |
|
305 template(long_signature, "J") \ |
|
306 template(short_signature, "S") \ |
|
307 template(bool_signature, "Z") \ |
|
308 template(void_signature, "V") \ |
|
309 template(byte_array_signature, "[B") \ |
|
310 template(char_array_signature, "[C") \ |
|
311 template(object_void_signature, "(Ljava/lang/Object;)V") \ |
|
312 template(object_int_signature, "(Ljava/lang/Object;)I") \ |
|
313 template(object_boolean_signature, "(Ljava/lang/Object;)Z") \ |
|
314 template(string_void_signature, "(Ljava/lang/String;)V") \ |
|
315 template(string_int_signature, "(Ljava/lang/String;)I") \ |
|
316 template(throwable_void_signature, "(Ljava/lang/Throwable;)V") \ |
|
317 template(void_throwable_signature, "()Ljava/lang/Throwable;") \ |
|
318 template(throwable_throwable_signature, "(Ljava/lang/Throwable;)Ljava/lang/Throwable;") \ |
|
319 template(class_void_signature, "(Ljava/lang/Class;)V") \ |
|
320 template(class_int_signature, "(Ljava/lang/Class;)I") \ |
|
321 template(class_boolean_signature, "(Ljava/lang/Class;)Z") \ |
|
322 template(throwable_string_void_signature, "(Ljava/lang/Throwable;Ljava/lang/String;)V") \ |
|
323 template(string_array_void_signature, "([Ljava/lang/String;)V") \ |
|
324 template(string_array_string_array_void_signature, "([Ljava/lang/String;[Ljava/lang/String;)V") \ |
|
325 template(thread_throwable_void_signature, "(Ljava/lang/Thread;Ljava/lang/Throwable;)V") \ |
|
326 template(thread_void_signature, "(Ljava/lang/Thread;)V") \ |
|
327 template(threadgroup_runnable_void_signature, "(Ljava/lang/ThreadGroup;Ljava/lang/Runnable;)V") \ |
|
328 template(threadgroup_string_void_signature, "(Ljava/lang/ThreadGroup;Ljava/lang/String;)V") \ |
|
329 template(string_class_signature, "(Ljava/lang/String;)Ljava/lang/Class;") \ |
|
330 template(object_object_object_signature, "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \ |
|
331 template(string_string_string_signature, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;") \ |
|
332 template(string_string_signature, "(Ljava/lang/String;)Ljava/lang/String;") \ |
|
333 template(classloader_string_long_signature, "(Ljava/lang/ClassLoader;Ljava/lang/String;)J") \ |
|
334 template(byte_array_void_signature, "([B)V") \ |
|
335 template(char_array_void_signature, "([C)V") \ |
|
336 template(int_int_void_signature, "(II)V") \ |
|
337 template(long_long_void_signature, "(JJ)V") \ |
|
338 template(void_classloader_signature, "()Ljava/lang/ClassLoader;") \ |
|
339 template(void_object_signature, "()Ljava/lang/Object;") \ |
|
340 template(void_class_signature, "()Ljava/lang/Class;") \ |
|
341 template(object_array_object_object_signature, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;")\ |
|
342 template(exception_void_signature, "(Ljava/lang/Exception;)V") \ |
|
343 template(protectiondomain_signature, "[Ljava/security/ProtectionDomain;") \ |
|
344 template(accesscontrolcontext_signature, "Ljava/security/AccessControlContext;") \ |
|
345 template(class_protectiondomain_signature, "(Ljava/lang/Class;Ljava/security/ProtectionDomain;)V") \ |
|
346 template(thread_signature, "Ljava/lang/Thread;") \ |
|
347 template(thread_array_signature, "[Ljava/lang/Thread;") \ |
|
348 template(threadgroup_signature, "Ljava/lang/ThreadGroup;") \ |
|
349 template(threadgroup_array_signature, "[Ljava/lang/ThreadGroup;") \ |
|
350 template(class_array_signature, "[Ljava/lang/Class;") \ |
|
351 template(classloader_signature, "Ljava/lang/ClassLoader;") \ |
|
352 template(object_signature, "Ljava/lang/Object;") \ |
|
353 template(class_signature, "Ljava/lang/Class;") \ |
|
354 template(string_signature, "Ljava/lang/String;") \ |
|
355 template(reference_signature, "Ljava/lang/ref/Reference;") \ |
|
356 /* signature symbols needed by intrinsics */ \ |
|
357 VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, template, VM_ALIAS_IGNORE) \ |
|
358 \ |
|
359 /* symbol aliases needed by intrinsics */ \ |
|
360 VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, do_alias) \ |
|
361 \ |
|
362 /* returned by the C1 compiler in case there's not enough memory to allocate a new symbol*/ \ |
|
363 template(dummy_symbol_oop, "illegal symbol") \ |
|
364 \ |
|
365 /* used by ClassFormatError when class name is not known yet */ \ |
|
366 template(unknown_class_name, "<Unknown>") \ |
|
367 \ |
|
368 /* JVM monitoring and management support */ \ |
|
369 template(java_lang_StackTraceElement_array, "[Ljava/lang/StackTraceElement;") \ |
|
370 template(java_lang_management_ThreadState, "java/lang/management/ThreadState") \ |
|
371 template(java_lang_management_MemoryUsage, "java/lang/management/MemoryUsage") \ |
|
372 template(java_lang_management_ThreadInfo, "java/lang/management/ThreadInfo") \ |
|
373 template(sun_management_ManagementFactory, "sun/management/ManagementFactory") \ |
|
374 template(sun_management_Sensor, "sun/management/Sensor") \ |
|
375 template(sun_management_Agent, "sun/management/Agent") \ |
|
376 template(createMemoryPoolMBean_name, "createMemoryPoolMBean") \ |
|
377 template(createMemoryManagerMBean_name, "createMemoryManagerMBean") \ |
|
378 template(createGarbageCollectorMBean_name, "createGarbageCollectorMBean") \ |
|
379 template(createMemoryPoolMBean_signature, "(Ljava/lang/String;ZJJ)Ljava/lang/management/MemoryPoolMBean;") \ |
|
380 template(createMemoryManagerMBean_signature, "(Ljava/lang/String;)Ljava/lang/management/MemoryManagerMBean;") \ |
|
381 template(createGarbageCollectorMBean_signature, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/management/GarbageCollectorMBean;") \ |
|
382 template(trigger_name, "trigger") \ |
|
383 template(clear_name, "clear") \ |
|
384 template(trigger_method_signature, "(ILjava/lang/management/MemoryUsage;)V") \ |
|
385 template(startAgent_name, "startAgent") \ |
|
386 template(java_lang_management_ThreadInfo_constructor_signature, "(Ljava/lang/Thread;ILjava/lang/Object;Ljava/lang/Thread;JJJJ[Ljava/lang/StackTraceElement;)V") \ |
|
387 template(java_lang_management_ThreadInfo_with_locks_constructor_signature, "(Ljava/lang/Thread;ILjava/lang/Object;Ljava/lang/Thread;JJJJ[Ljava/lang/StackTraceElement;[Ljava/lang/Object;[I[Ljava/lang/Object;)V") \ |
|
388 template(long_long_long_long_void_signature, "(JJJJ)V") \ |
|
389 \ |
|
390 template(java_lang_management_MemoryPoolMXBean, "java/lang/management/MemoryPoolMXBean") \ |
|
391 template(java_lang_management_MemoryManagerMXBean, "java/lang/management/MemoryManagerMXBean") \ |
|
392 template(java_lang_management_GarbageCollectorMXBean,"java/lang/management/GarbageCollectorMXBean") \ |
|
393 template(createMemoryPool_name, "createMemoryPool") \ |
|
394 template(createMemoryManager_name, "createMemoryManager") \ |
|
395 template(createGarbageCollector_name, "createGarbageCollector") \ |
|
396 template(createMemoryPool_signature, "(Ljava/lang/String;ZJJ)Ljava/lang/management/MemoryPoolMXBean;") \ |
|
397 template(createMemoryManager_signature, "(Ljava/lang/String;)Ljava/lang/management/MemoryManagerMXBean;") \ |
|
398 template(createGarbageCollector_signature, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/management/GarbageCollectorMXBean;") \ |
|
399 template(addThreadDumpForMonitors_name, "addThreadDumpForMonitors") \ |
|
400 template(addThreadDumpForSynchronizers_name, "addThreadDumpForSynchronizers") \ |
|
401 template(addThreadDumpForMonitors_signature, "(Ljava/lang/management/ThreadInfo;[Ljava/lang/Object;[I)V") \ |
|
402 template(addThreadDumpForSynchronizers_signature, "(Ljava/lang/management/ThreadInfo;[Ljava/lang/Object;)V") \ |
|
403 \ |
|
404 /* JVMTI/java.lang.instrument support and VM Attach mechanism */ \ |
|
405 template(sun_misc_VMSupport, "sun/misc/VMSupport") \ |
|
406 template(appendToClassPathForInstrumentation_name, "appendToClassPathForInstrumentation") \ |
|
407 do_alias(appendToClassPathForInstrumentation_signature, string_void_signature) \ |
|
408 template(serializePropertiesToByteArray_name, "serializePropertiesToByteArray") \ |
|
409 template(serializePropertiesToByteArray_signature, "()[B") \ |
|
410 template(serializeAgentPropertiesToByteArray_name, "serializeAgentPropertiesToByteArray") \ |
|
411 template(classRedefinedCount_name, "classRedefinedCount") \ |
|
412 /*end*/ |
|
413 |
|
414 |
|
415 |
|
416 // Here are all the intrinsics known to the runtime and the CI. |
|
417 // Each intrinsic consists of a public enum name (like _hashCode), |
|
418 // followed by a specification of its klass, name, and signature: |
|
419 // template(<id>, <klass>, <name>, <sig>, <FCODE>) |
|
420 // |
|
421 // If you add an intrinsic here, you must also define its name |
|
422 // and signature as members of the VM symbols. The VM symbols for |
|
423 // the intrinsic name and signature may be defined above. |
|
424 // |
|
425 // Because the VM_SYMBOLS_DO macro makes reference to VM_INTRINSICS_DO, |
|
426 // you can also define an intrinsic's name and/or signature locally to the |
|
427 // intrinsic, if this makes sense. (It often does make sense.) |
|
428 // |
|
429 // For example: |
|
430 // do_intrinsic(_foo, java_lang_Object, foo_name, foo_signature, F_xx) |
|
431 // do_name( foo_name, "foo") |
|
432 // do_signature(foo_signature, "()F") |
|
433 // klass = vmSymbols::java_lang_Object() |
|
434 // name = vmSymbols::foo_name() |
|
435 // signature = vmSymbols::foo_signature() |
|
436 // |
|
437 // The name and/or signature might be a "well known" symbol |
|
438 // like "equal" or "()I", in which case there will be no local |
|
439 // re-definition of the symbol. |
|
440 // |
|
441 // The do_class, do_name, and do_signature calls are all used for the |
|
442 // same purpose: Define yet another VM symbol. They could all be merged |
|
443 // into a common 'do_symbol' call, but it seems useful to record our |
|
444 // intentions here about kinds of symbols (class vs. name vs. signature). |
|
445 // |
|
446 // The F_xx is one of the Flags enum; see below. |
|
447 // |
|
448 // for Emacs: (let ((c-backslash-column 120) (c-backslash-max-column 120)) (c-backslash-region (point) (point-max) nil t)) |
|
449 #define VM_INTRINSICS_DO(do_intrinsic, do_class, do_name, do_signature, do_alias) \ |
|
450 do_intrinsic(_Object_init, java_lang_Object, object_initializer_name, void_method_signature, F_R) \ |
|
451 /* (symbol object_initializer_name defined above) */ \ |
|
452 \ |
|
453 do_intrinsic(_hashCode, java_lang_Object, hashCode_name, void_int_signature, F_R) \ |
|
454 do_name( hashCode_name, "hashCode") \ |
|
455 do_intrinsic(_getClass, java_lang_Object, getClass_name, void_class_signature, F_R) \ |
|
456 do_name( getClass_name, "getClass") \ |
|
457 do_intrinsic(_clone, java_lang_Object, clone_name, void_object_signature, F_R) \ |
|
458 do_name( clone_name, "clone") \ |
|
459 \ |
|
460 /* Math & StrictMath intrinsics are defined in terms of just a few signatures: */ \ |
|
461 do_class(java_lang_Math, "java/lang/Math") \ |
|
462 do_class(java_lang_StrictMath, "java/lang/StrictMath") \ |
|
463 do_signature(double2_double_signature, "(DD)D") \ |
|
464 do_signature(int2_int_signature, "(II)I") \ |
|
465 \ |
|
466 /* here are the math names, all together: */ \ |
|
467 do_name(abs_name,"abs") do_name(sin_name,"sin") do_name(cos_name,"cos") \ |
|
468 do_name(tan_name,"tan") do_name(atan2_name,"atan2") do_name(sqrt_name,"sqrt") \ |
|
469 do_name(log_name,"log") do_name(log10_name,"log10") do_name(pow_name,"pow") \ |
|
470 do_name(exp_name,"exp") do_name(min_name,"min") do_name(max_name,"max") \ |
|
471 \ |
|
472 do_intrinsic(_dabs, java_lang_Math, abs_name, double_double_signature, F_S) \ |
|
473 do_intrinsic(_dsin, java_lang_Math, sin_name, double_double_signature, F_S) \ |
|
474 do_intrinsic(_dcos, java_lang_Math, cos_name, double_double_signature, F_S) \ |
|
475 do_intrinsic(_dtan, java_lang_Math, tan_name, double_double_signature, F_S) \ |
|
476 do_intrinsic(_datan2, java_lang_Math, atan2_name, double2_double_signature, F_S) \ |
|
477 do_intrinsic(_dsqrt, java_lang_Math, sqrt_name, double_double_signature, F_S) \ |
|
478 do_intrinsic(_dlog, java_lang_Math, log_name, double_double_signature, F_S) \ |
|
479 do_intrinsic(_dlog10, java_lang_Math, log10_name, double_double_signature, F_S) \ |
|
480 do_intrinsic(_dpow, java_lang_Math, pow_name, double2_double_signature, F_S) \ |
|
481 do_intrinsic(_dexp, java_lang_Math, exp_name, double_double_signature, F_S) \ |
|
482 do_intrinsic(_min, java_lang_Math, min_name, int2_int_signature, F_S) \ |
|
483 do_intrinsic(_max, java_lang_Math, max_name, int2_int_signature, F_S) \ |
|
484 \ |
|
485 do_intrinsic(_floatToRawIntBits, java_lang_Float, floatToRawIntBits_name, float_int_signature, F_S) \ |
|
486 do_name( floatToRawIntBits_name, "floatToRawIntBits") \ |
|
487 do_intrinsic(_floatToIntBits, java_lang_Float, floatToIntBits_name, float_int_signature, F_S) \ |
|
488 do_name( floatToIntBits_name, "floatToIntBits") \ |
|
489 do_intrinsic(_intBitsToFloat, java_lang_Float, intBitsToFloat_name, int_float_signature, F_S) \ |
|
490 do_name( intBitsToFloat_name, "intBitsToFloat") \ |
|
491 do_intrinsic(_doubleToRawLongBits, java_lang_Double, doubleToRawLongBits_name, double_long_signature, F_S) \ |
|
492 do_name( doubleToRawLongBits_name, "doubleToRawLongBits") \ |
|
493 do_intrinsic(_doubleToLongBits, java_lang_Double, doubleToLongBits_name, double_long_signature, F_S) \ |
|
494 do_name( doubleToLongBits_name, "doubleToLongBits") \ |
|
495 do_intrinsic(_longBitsToDouble, java_lang_Double, longBitsToDouble_name, long_double_signature, F_S) \ |
|
496 do_name( longBitsToDouble_name, "longBitsToDouble") \ |
|
497 do_intrinsic(_reverseBytes_i, java_lang_Integer, reverseBytes_name, int_int_signature, F_S) \ |
|
498 do_name( reverseBytes_name, "reverseBytes") \ |
|
499 do_intrinsic(_reverseBytes_l, java_lang_Long, reverseBytes_name, long_long_signature, F_S) \ |
|
500 /* (symbol reverseBytes_name defined above) */ \ |
|
501 \ |
|
502 do_intrinsic(_identityHashCode, java_lang_System, identityHashCode_name, object_int_signature, F_S) \ |
|
503 do_name( identityHashCode_name, "identityHashCode") \ |
|
504 do_intrinsic(_currentTimeMillis, java_lang_System, currentTimeMillis_name, void_long_signature, F_S) \ |
|
505 \ |
|
506 do_name( currentTimeMillis_name, "currentTimeMillis") \ |
|
507 do_intrinsic(_nanoTime, java_lang_System, nanoTime_name, void_long_signature, F_S) \ |
|
508 do_name( nanoTime_name, "nanoTime") \ |
|
509 \ |
|
510 do_intrinsic(_arraycopy, java_lang_System, arraycopy_name, arraycopy_signature, F_S) \ |
|
511 do_name( arraycopy_name, "arraycopy") \ |
|
512 do_signature(arraycopy_signature, "(Ljava/lang/Object;ILjava/lang/Object;II)V") \ |
|
513 do_intrinsic(_isInterrupted, java_lang_Thread, isInterrupted_name, isInterrupted_signature, F_R) \ |
|
514 do_name( isInterrupted_name, "isInterrupted") \ |
|
515 do_signature(isInterrupted_signature, "(Z)Z") \ |
|
516 do_intrinsic(_currentThread, java_lang_Thread, currentThread_name, currentThread_signature, F_S) \ |
|
517 do_name( currentThread_name, "currentThread") \ |
|
518 do_signature(currentThread_signature, "()Ljava/lang/Thread;") \ |
|
519 \ |
|
520 /* reflective intrinsics, for java/lang/Class, etc. */ \ |
|
521 do_intrinsic(_isAssignableFrom, java_lang_Class, isAssignableFrom_name, class_boolean_signature, F_RN) \ |
|
522 do_name( isAssignableFrom_name, "isAssignableFrom") \ |
|
523 do_intrinsic(_isInstance, java_lang_Class, isInstance_name, object_boolean_signature, F_RN) \ |
|
524 do_name( isInstance_name, "isInstance") \ |
|
525 do_intrinsic(_getModifiers, java_lang_Class, getModifiers_name, void_int_signature, F_RN) \ |
|
526 do_name( getModifiers_name, "getModifiers") \ |
|
527 do_intrinsic(_isInterface, java_lang_Class, isInterface_name, void_boolean_signature, F_RN) \ |
|
528 do_name( isInterface_name, "isInterface") \ |
|
529 do_intrinsic(_isArray, java_lang_Class, isArray_name, void_boolean_signature, F_RN) \ |
|
530 do_name( isArray_name, "isArray") \ |
|
531 do_intrinsic(_isPrimitive, java_lang_Class, isPrimitive_name, void_boolean_signature, F_RN) \ |
|
532 do_name( isPrimitive_name, "isPrimitive") \ |
|
533 do_intrinsic(_getSuperclass, java_lang_Class, getSuperclass_name, void_class_signature, F_RN) \ |
|
534 do_name( getSuperclass_name, "getSuperclass") \ |
|
535 do_intrinsic(_getComponentType, java_lang_Class, getComponentType_name, void_class_signature, F_RN) \ |
|
536 do_name( getComponentType_name, "getComponentType") \ |
|
537 \ |
|
538 do_intrinsic(_getClassAccessFlags, sun_reflect_Reflection, getClassAccessFlags_name, class_int_signature, F_SN) \ |
|
539 do_name( getClassAccessFlags_name, "getClassAccessFlags") \ |
|
540 do_intrinsic(_getLength, java_lang_reflect_Array, getLength_name, object_int_signature, F_SN) \ |
|
541 do_name( getLength_name, "getLength") \ |
|
542 \ |
|
543 do_intrinsic(_getCallerClass, sun_reflect_Reflection, getCallerClass_name, getCallerClass_signature, F_SN) \ |
|
544 do_name( getCallerClass_name, "getCallerClass") \ |
|
545 do_signature(getCallerClass_signature, "(I)Ljava/lang/Class;") \ |
|
546 \ |
|
547 do_intrinsic(_newArray, java_lang_reflect_Array, newArray_name, newArray_signature, F_SN) \ |
|
548 do_name( newArray_name, "newArray") \ |
|
549 do_signature(newArray_signature, "(Ljava/lang/Class;I)Ljava/lang/Object;") \ |
|
550 \ |
|
551 do_intrinsic(_copyOf, java_util_Arrays, copyOf_name, copyOf_signature, F_S) \ |
|
552 do_name( copyOf_name, "copyOf") \ |
|
553 do_signature(copyOf_signature, "([Ljava/lang/Object;ILjava/lang/Class;)[Ljava/lang/Object;") \ |
|
554 \ |
|
555 do_intrinsic(_copyOfRange, java_util_Arrays, copyOfRange_name, copyOfRange_signature, F_S) \ |
|
556 do_name( copyOfRange_name, "copyOfRange") \ |
|
557 do_signature(copyOfRange_signature, "([Ljava/lang/Object;IILjava/lang/Class;)[Ljava/lang/Object;") \ |
|
558 \ |
|
559 do_intrinsic(_invoke, java_lang_reflect_Method, invoke_name, object_array_object_object_signature, F_R) \ |
|
560 /* (symbols invoke_name and invoke_signature defined above) */ \ |
|
561 \ |
|
562 do_intrinsic(_compareTo, java_lang_String, compareTo_name, string_int_signature, F_R) \ |
|
563 do_name( compareTo_name, "compareTo") \ |
|
564 do_intrinsic(_indexOf, java_lang_String, indexOf_name, string_int_signature, F_R) \ |
|
565 do_name( indexOf_name, "indexOf") \ |
|
566 \ |
|
567 do_class(java_nio_Buffer, "java/nio/Buffer") \ |
|
568 do_intrinsic(_checkIndex, java_nio_Buffer, checkIndex_name, int_int_signature, F_R) \ |
|
569 do_name( checkIndex_name, "checkIndex") \ |
|
570 \ |
|
571 do_class(sun_misc_AtomicLongCSImpl, "sun/misc/AtomicLongCSImpl") \ |
|
572 do_intrinsic(_get_AtomicLong, sun_misc_AtomicLongCSImpl, get_name, void_long_signature, F_R) \ |
|
573 /* (symbols get_name and void_long_signature defined above) */ \ |
|
574 \ |
|
575 do_intrinsic(_attemptUpdate, sun_misc_AtomicLongCSImpl, attemptUpdate_name, attemptUpdate_signature, F_R) \ |
|
576 do_name( attemptUpdate_name, "attemptUpdate") \ |
|
577 do_signature(attemptUpdate_signature, "(JJ)Z") \ |
|
578 \ |
|
579 /* support for sun.misc.Unsafe */ \ |
|
580 do_class(sun_misc_Unsafe, "sun/misc/Unsafe") \ |
|
581 \ |
|
582 do_intrinsic(_allocateInstance, sun_misc_Unsafe, allocateInstance_name, allocateInstance_signature, F_RN) \ |
|
583 do_name( allocateInstance_name, "allocateInstance") \ |
|
584 do_signature(allocateInstance_signature, "(Ljava/lang/Class;)Ljava/lang/Object;") \ |
|
585 do_intrinsic(_copyMemory, sun_misc_Unsafe, copyMemory_name, copyMemory_signature, F_RN) \ |
|
586 do_name( copyMemory_name, "copyMemory") \ |
|
587 do_signature(copyMemory_signature, "(Ljava/lang/Object;JLjava/lang/Object;JJ)V") \ |
|
588 do_intrinsic(_park, sun_misc_Unsafe, park_name, park_signature, F_RN) \ |
|
589 do_name( park_name, "park") \ |
|
590 do_signature(park_signature, "(ZJ)V") \ |
|
591 do_intrinsic(_unpark, sun_misc_Unsafe, unpark_name, unpark_signature, F_RN) \ |
|
592 do_name( unpark_name, "unpark") \ |
|
593 do_alias( unpark_signature, /*(LObject;)V*/ object_void_signature) \ |
|
594 \ |
|
595 /* unsafe memory references (there are a lot of them...) */ \ |
|
596 do_signature(getObject_signature, "(Ljava/lang/Object;J)Ljava/lang/Object;") \ |
|
597 do_signature(putObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)V") \ |
|
598 do_signature(getBoolean_signature, "(Ljava/lang/Object;J)Z") \ |
|
599 do_signature(putBoolean_signature, "(Ljava/lang/Object;JZ)V") \ |
|
600 do_signature(getByte_signature, "(Ljava/lang/Object;J)B") \ |
|
601 do_signature(putByte_signature, "(Ljava/lang/Object;JB)V") \ |
|
602 do_signature(getShort_signature, "(Ljava/lang/Object;J)S") \ |
|
603 do_signature(putShort_signature, "(Ljava/lang/Object;JS)V") \ |
|
604 do_signature(getChar_signature, "(Ljava/lang/Object;J)C") \ |
|
605 do_signature(putChar_signature, "(Ljava/lang/Object;JC)V") \ |
|
606 do_signature(getInt_signature, "(Ljava/lang/Object;J)I") \ |
|
607 do_signature(putInt_signature, "(Ljava/lang/Object;JI)V") \ |
|
608 do_signature(getLong_signature, "(Ljava/lang/Object;J)J") \ |
|
609 do_signature(putLong_signature, "(Ljava/lang/Object;JJ)V") \ |
|
610 do_signature(getFloat_signature, "(Ljava/lang/Object;J)F") \ |
|
611 do_signature(putFloat_signature, "(Ljava/lang/Object;JF)V") \ |
|
612 do_signature(getDouble_signature, "(Ljava/lang/Object;J)D") \ |
|
613 do_signature(putDouble_signature, "(Ljava/lang/Object;JD)V") \ |
|
614 \ |
|
615 do_name(getObject_name,"getObject") do_name(putObject_name,"putObject") \ |
|
616 do_name(getBoolean_name,"getBoolean") do_name(putBoolean_name,"putBoolean") \ |
|
617 do_name(getByte_name,"getByte") do_name(putByte_name,"putByte") \ |
|
618 do_name(getShort_name,"getShort") do_name(putShort_name,"putShort") \ |
|
619 do_name(getChar_name,"getChar") do_name(putChar_name,"putChar") \ |
|
620 do_name(getInt_name,"getInt") do_name(putInt_name,"putInt") \ |
|
621 do_name(getLong_name,"getLong") do_name(putLong_name,"putLong") \ |
|
622 do_name(getFloat_name,"getFloat") do_name(putFloat_name,"putFloat") \ |
|
623 do_name(getDouble_name,"getDouble") do_name(putDouble_name,"putDouble") \ |
|
624 \ |
|
625 do_intrinsic(_getObject, sun_misc_Unsafe, getObject_name, getObject_signature, F_RN) \ |
|
626 do_intrinsic(_getBoolean, sun_misc_Unsafe, getBoolean_name, getBoolean_signature, F_RN) \ |
|
627 do_intrinsic(_getByte, sun_misc_Unsafe, getByte_name, getByte_signature, F_RN) \ |
|
628 do_intrinsic(_getShort, sun_misc_Unsafe, getShort_name, getShort_signature, F_RN) \ |
|
629 do_intrinsic(_getChar, sun_misc_Unsafe, getChar_name, getChar_signature, F_RN) \ |
|
630 do_intrinsic(_getInt, sun_misc_Unsafe, getInt_name, getInt_signature, F_RN) \ |
|
631 do_intrinsic(_getLong, sun_misc_Unsafe, getLong_name, getLong_signature, F_RN) \ |
|
632 do_intrinsic(_getFloat, sun_misc_Unsafe, getFloat_name, getFloat_signature, F_RN) \ |
|
633 do_intrinsic(_getDouble, sun_misc_Unsafe, getDouble_name, getDouble_signature, F_RN) \ |
|
634 do_intrinsic(_putObject, sun_misc_Unsafe, putObject_name, putObject_signature, F_RN) \ |
|
635 do_intrinsic(_putBoolean, sun_misc_Unsafe, putBoolean_name, putBoolean_signature, F_RN) \ |
|
636 do_intrinsic(_putByte, sun_misc_Unsafe, putByte_name, putByte_signature, F_RN) \ |
|
637 do_intrinsic(_putShort, sun_misc_Unsafe, putShort_name, putShort_signature, F_RN) \ |
|
638 do_intrinsic(_putChar, sun_misc_Unsafe, putChar_name, putChar_signature, F_RN) \ |
|
639 do_intrinsic(_putInt, sun_misc_Unsafe, putInt_name, putInt_signature, F_RN) \ |
|
640 do_intrinsic(_putLong, sun_misc_Unsafe, putLong_name, putLong_signature, F_RN) \ |
|
641 do_intrinsic(_putFloat, sun_misc_Unsafe, putFloat_name, putFloat_signature, F_RN) \ |
|
642 do_intrinsic(_putDouble, sun_misc_Unsafe, putDouble_name, putDouble_signature, F_RN) \ |
|
643 \ |
|
644 do_name(getObjectVolatile_name,"getObjectVolatile") do_name(putObjectVolatile_name,"putObjectVolatile") \ |
|
645 do_name(getBooleanVolatile_name,"getBooleanVolatile") do_name(putBooleanVolatile_name,"putBooleanVolatile") \ |
|
646 do_name(getByteVolatile_name,"getByteVolatile") do_name(putByteVolatile_name,"putByteVolatile") \ |
|
647 do_name(getShortVolatile_name,"getShortVolatile") do_name(putShortVolatile_name,"putShortVolatile") \ |
|
648 do_name(getCharVolatile_name,"getCharVolatile") do_name(putCharVolatile_name,"putCharVolatile") \ |
|
649 do_name(getIntVolatile_name,"getIntVolatile") do_name(putIntVolatile_name,"putIntVolatile") \ |
|
650 do_name(getLongVolatile_name,"getLongVolatile") do_name(putLongVolatile_name,"putLongVolatile") \ |
|
651 do_name(getFloatVolatile_name,"getFloatVolatile") do_name(putFloatVolatile_name,"putFloatVolatile") \ |
|
652 do_name(getDoubleVolatile_name,"getDoubleVolatile") do_name(putDoubleVolatile_name,"putDoubleVolatile") \ |
|
653 \ |
|
654 do_intrinsic(_getObjectVolatile, sun_misc_Unsafe, getObjectVolatile_name, getObject_signature, F_RN) \ |
|
655 do_intrinsic(_getBooleanVolatile, sun_misc_Unsafe, getBooleanVolatile_name, getBoolean_signature, F_RN) \ |
|
656 do_intrinsic(_getByteVolatile, sun_misc_Unsafe, getByteVolatile_name, getByte_signature, F_RN) \ |
|
657 do_intrinsic(_getShortVolatile, sun_misc_Unsafe, getShortVolatile_name, getShort_signature, F_RN) \ |
|
658 do_intrinsic(_getCharVolatile, sun_misc_Unsafe, getCharVolatile_name, getChar_signature, F_RN) \ |
|
659 do_intrinsic(_getIntVolatile, sun_misc_Unsafe, getIntVolatile_name, getInt_signature, F_RN) \ |
|
660 do_intrinsic(_getLongVolatile, sun_misc_Unsafe, getLongVolatile_name, getLong_signature, F_RN) \ |
|
661 do_intrinsic(_getFloatVolatile, sun_misc_Unsafe, getFloatVolatile_name, getFloat_signature, F_RN) \ |
|
662 do_intrinsic(_getDoubleVolatile, sun_misc_Unsafe, getDoubleVolatile_name, getDouble_signature, F_RN) \ |
|
663 do_intrinsic(_putObjectVolatile, sun_misc_Unsafe, putObjectVolatile_name, putObject_signature, F_RN) \ |
|
664 do_intrinsic(_putBooleanVolatile, sun_misc_Unsafe, putBooleanVolatile_name, putBoolean_signature, F_RN) \ |
|
665 do_intrinsic(_putByteVolatile, sun_misc_Unsafe, putByteVolatile_name, putByte_signature, F_RN) \ |
|
666 do_intrinsic(_putShortVolatile, sun_misc_Unsafe, putShortVolatile_name, putShort_signature, F_RN) \ |
|
667 do_intrinsic(_putCharVolatile, sun_misc_Unsafe, putCharVolatile_name, putChar_signature, F_RN) \ |
|
668 do_intrinsic(_putIntVolatile, sun_misc_Unsafe, putIntVolatile_name, putInt_signature, F_RN) \ |
|
669 do_intrinsic(_putLongVolatile, sun_misc_Unsafe, putLongVolatile_name, putLong_signature, F_RN) \ |
|
670 do_intrinsic(_putFloatVolatile, sun_misc_Unsafe, putFloatVolatile_name, putFloat_signature, F_RN) \ |
|
671 do_intrinsic(_putDoubleVolatile, sun_misc_Unsafe, putDoubleVolatile_name, putDouble_signature, F_RN) \ |
|
672 \ |
|
673 /* %%% these are redundant except perhaps for getAddress, but Unsafe has native methods for them */ \ |
|
674 do_signature(getByte_raw_signature, "(J)B") \ |
|
675 do_signature(putByte_raw_signature, "(JB)V") \ |
|
676 do_signature(getShort_raw_signature, "(J)S") \ |
|
677 do_signature(putShort_raw_signature, "(JS)V") \ |
|
678 do_signature(getChar_raw_signature, "(J)C") \ |
|
679 do_signature(putChar_raw_signature, "(JC)V") \ |
|
680 do_signature(getInt_raw_signature, "(J)I") \ |
|
681 do_signature(putInt_raw_signature, "(JI)V") \ |
|
682 do_alias(getLong_raw_signature, /*(J)J*/ long_long_signature) \ |
|
683 do_alias(putLong_raw_signature, /*(JJ)V*/ long_long_void_signature) \ |
|
684 do_signature(getFloat_raw_signature, "(J)F") \ |
|
685 do_signature(putFloat_raw_signature, "(JF)V") \ |
|
686 do_alias(getDouble_raw_signature, /*(J)D*/ long_double_signature) \ |
|
687 do_signature(putDouble_raw_signature, "(JD)V") \ |
|
688 do_alias(getAddress_raw_signature, /*(J)J*/ long_long_signature) \ |
|
689 do_alias(putAddress_raw_signature, /*(JJ)V*/ long_long_void_signature) \ |
|
690 \ |
|
691 do_name( getAddress_name, "getAddress") \ |
|
692 do_name( putAddress_name, "putAddress") \ |
|
693 \ |
|
694 do_intrinsic(_getByte_raw, sun_misc_Unsafe, getByte_name, getByte_raw_signature, F_RN) \ |
|
695 do_intrinsic(_getShort_raw, sun_misc_Unsafe, getShort_name, getShort_raw_signature, F_RN) \ |
|
696 do_intrinsic(_getChar_raw, sun_misc_Unsafe, getChar_name, getChar_raw_signature, F_RN) \ |
|
697 do_intrinsic(_getInt_raw, sun_misc_Unsafe, getInt_name, getInt_raw_signature, F_RN) \ |
|
698 do_intrinsic(_getLong_raw, sun_misc_Unsafe, getLong_name, getLong_raw_signature, F_RN) \ |
|
699 do_intrinsic(_getFloat_raw, sun_misc_Unsafe, getFloat_name, getFloat_raw_signature, F_RN) \ |
|
700 do_intrinsic(_getDouble_raw, sun_misc_Unsafe, getDouble_name, getDouble_raw_signature, F_RN) \ |
|
701 do_intrinsic(_getAddress_raw, sun_misc_Unsafe, getAddress_name, getAddress_raw_signature, F_RN) \ |
|
702 do_intrinsic(_putByte_raw, sun_misc_Unsafe, putByte_name, putByte_raw_signature, F_RN) \ |
|
703 do_intrinsic(_putShort_raw, sun_misc_Unsafe, putShort_name, putShort_raw_signature, F_RN) \ |
|
704 do_intrinsic(_putChar_raw, sun_misc_Unsafe, putChar_name, putChar_raw_signature, F_RN) \ |
|
705 do_intrinsic(_putInt_raw, sun_misc_Unsafe, putInt_name, putInt_raw_signature, F_RN) \ |
|
706 do_intrinsic(_putLong_raw, sun_misc_Unsafe, putLong_name, putLong_raw_signature, F_RN) \ |
|
707 do_intrinsic(_putFloat_raw, sun_misc_Unsafe, putFloat_name, putFloat_raw_signature, F_RN) \ |
|
708 do_intrinsic(_putDouble_raw, sun_misc_Unsafe, putDouble_name, putDouble_raw_signature, F_RN) \ |
|
709 do_intrinsic(_putAddress_raw, sun_misc_Unsafe, putAddress_name, putAddress_raw_signature, F_RN) \ |
|
710 \ |
|
711 do_intrinsic(_compareAndSwapObject, sun_misc_Unsafe, compareAndSwapObject_name, compareAndSwapObject_signature, F_RN) \ |
|
712 do_name( compareAndSwapObject_name, "compareAndSwapObject") \ |
|
713 do_signature(compareAndSwapObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \ |
|
714 do_intrinsic(_compareAndSwapLong, sun_misc_Unsafe, compareAndSwapLong_name, compareAndSwapLong_signature, F_RN) \ |
|
715 do_name( compareAndSwapLong_name, "compareAndSwapLong") \ |
|
716 do_signature(compareAndSwapLong_signature, "(Ljava/lang/Object;JJJ)Z") \ |
|
717 do_intrinsic(_compareAndSwapInt, sun_misc_Unsafe, compareAndSwapInt_name, compareAndSwapInt_signature, F_RN) \ |
|
718 do_name( compareAndSwapInt_name, "compareAndSwapInt") \ |
|
719 do_signature(compareAndSwapInt_signature, "(Ljava/lang/Object;JII)Z") \ |
|
720 do_intrinsic(_putOrderedObject, sun_misc_Unsafe, putOrderedObject_name, putOrderedObject_signature, F_RN) \ |
|
721 do_name( putOrderedObject_name, "putOrderedObject") \ |
|
722 do_alias( putOrderedObject_signature, /*(LObject;JLObject;)V*/ putObject_signature) \ |
|
723 do_intrinsic(_putOrderedLong, sun_misc_Unsafe, putOrderedLong_name, putOrderedLong_signature, F_RN) \ |
|
724 do_name( putOrderedLong_name, "putOrderedLong") \ |
|
725 do_alias( putOrderedLong_signature, /*(Ljava/lang/Object;JJ)V*/ putLong_signature) \ |
|
726 do_intrinsic(_putOrderedInt, sun_misc_Unsafe, putOrderedInt_name, putOrderedInt_signature, F_RN) \ |
|
727 do_name( putOrderedInt_name, "putOrderedInt") \ |
|
728 do_alias( putOrderedInt_signature, /*(Ljava/lang/Object;JI)V*/ putInt_signature) \ |
|
729 \ |
|
730 /* prefetch_signature is shared by all prefetch variants */ \ |
|
731 do_signature( prefetch_signature, "(Ljava/lang/Object;J)V") \ |
|
732 \ |
|
733 do_intrinsic(_prefetchRead, sun_misc_Unsafe, prefetchRead_name, prefetch_signature, F_RN) \ |
|
734 do_name( prefetchRead_name, "prefetchRead") \ |
|
735 do_intrinsic(_prefetchWrite, sun_misc_Unsafe, prefetchWrite_name, prefetch_signature, F_RN) \ |
|
736 do_name( prefetchWrite_name, "prefetchWrite") \ |
|
737 do_intrinsic(_prefetchReadStatic, sun_misc_Unsafe, prefetchReadStatic_name, prefetch_signature, F_SN) \ |
|
738 do_name( prefetchReadStatic_name, "prefetchReadStatic") \ |
|
739 do_intrinsic(_prefetchWriteStatic, sun_misc_Unsafe, prefetchWriteStatic_name, prefetch_signature, F_SN) \ |
|
740 do_name( prefetchWriteStatic_name, "prefetchWriteStatic") \ |
|
741 /*end*/ |
|
742 |
|
743 |
|
744 |
|
745 // Class vmSymbols |
|
746 |
|
747 class vmSymbols: AllStatic { |
|
748 friend class vmSymbolHandles; |
|
749 friend class vmIntrinsics; |
|
750 public: |
|
751 // enum for figuring positions and size of array holding symbolOops |
|
752 enum SID { |
|
753 NO_SID = 0, |
|
754 |
|
755 #define VM_SYMBOL_ENUM(name, string) VM_SYMBOL_ENUM_NAME(name), |
|
756 VM_SYMBOLS_DO(VM_SYMBOL_ENUM, VM_ALIAS_IGNORE) |
|
757 #undef VM_SYMBOL_ENUM |
|
758 |
|
759 SID_LIMIT, |
|
760 |
|
761 #define VM_ALIAS_ENUM(name, def) VM_SYMBOL_ENUM_NAME(name) = VM_SYMBOL_ENUM_NAME(def), |
|
762 VM_SYMBOLS_DO(VM_SYMBOL_IGNORE, VM_ALIAS_ENUM) |
|
763 #undef VM_ALIAS_ENUM |
|
764 |
|
765 FIRST_SID = NO_SID + 1 |
|
766 }; |
|
767 enum { |
|
768 log2_SID_LIMIT = 10 // checked by an assert at start-up |
|
769 }; |
|
770 |
|
771 private: |
|
772 // The symbol array |
|
773 static symbolOop _symbols[]; |
|
774 |
|
775 // Field signatures indexed by BasicType. |
|
776 static symbolOop _type_signatures[T_VOID+1]; |
|
777 |
|
778 public: |
|
779 // Initialization |
|
780 static void initialize(TRAPS); |
|
781 // Accessing |
|
782 #define VM_SYMBOL_DECLARE(name, ignore) \ |
|
783 static symbolOop name() { return _symbols[VM_SYMBOL_ENUM_NAME(name)]; } |
|
784 VM_SYMBOLS_DO(VM_SYMBOL_DECLARE, VM_SYMBOL_DECLARE) |
|
785 #undef VM_SYMBOL_DECLARE |
|
786 |
|
787 // GC support |
|
788 static void oops_do(OopClosure* f, bool do_all = false); |
|
789 |
|
790 static symbolOop type_signature(BasicType t) { |
|
791 assert((uint)t < T_VOID+1, "range check"); |
|
792 assert(_type_signatures[t] != NULL, "domain check"); |
|
793 return _type_signatures[t]; |
|
794 } |
|
795 // inverse of type_signature; returns T_OBJECT if s is not recognized |
|
796 static BasicType signature_type(symbolOop s); |
|
797 |
|
798 static symbolOop symbol_at(SID id) { |
|
799 assert(id >= FIRST_SID && id < SID_LIMIT, "oob"); |
|
800 assert(_symbols[id] != NULL, "init"); |
|
801 return _symbols[id]; |
|
802 } |
|
803 |
|
804 // Returns symbol's SID if one is assigned, else NO_SID. |
|
805 static SID find_sid(symbolOop symbol); |
|
806 |
|
807 #ifndef PRODUCT |
|
808 // No need for this in the product: |
|
809 static const char* name_for(SID sid); |
|
810 #endif //PRODUCT |
|
811 }; |
|
812 |
|
813 |
|
814 // Class vmSymbolHandles |
|
815 |
|
816 class vmSymbolHandles: AllStatic { |
|
817 friend class vmIntrinsics; |
|
818 friend class ciObjectFactory; |
|
819 |
|
820 public: |
|
821 // Accessing |
|
822 #define VM_SYMBOL_HANDLE_DECLARE(name, ignore) \ |
|
823 static symbolHandle name() { return symbol_handle_at(vmSymbols::VM_SYMBOL_ENUM_NAME(name)); } |
|
824 VM_SYMBOLS_DO(VM_SYMBOL_HANDLE_DECLARE, VM_SYMBOL_HANDLE_DECLARE) |
|
825 #undef VM_SYMBOL_HANDLE_DECLARE |
|
826 |
|
827 static symbolHandle symbol_handle_at(vmSymbols::SID id) { |
|
828 return symbolHandle(&vmSymbols::_symbols[(int)id], false); |
|
829 } |
|
830 |
|
831 static symbolHandle type_signature(BasicType t) { |
|
832 assert(vmSymbols::type_signature(t) != NULL, "domain check"); |
|
833 return symbolHandle(&vmSymbols::_type_signatures[t], false); |
|
834 } |
|
835 // inverse of type_signature; returns T_OBJECT if s is not recognized |
|
836 static BasicType signature_type(symbolHandle s) { |
|
837 return vmSymbols::signature_type(s()); |
|
838 } |
|
839 }; |
|
840 |
|
841 // VM Intrinsic ID's uniquely identify some very special methods |
|
842 class vmIntrinsics: AllStatic { |
|
843 friend class vmSymbols; |
|
844 friend class ciObjectFactory; |
|
845 |
|
846 public: |
|
847 // Accessing |
|
848 enum ID { |
|
849 _none = 0, // not an intrinsic (default answer) |
|
850 |
|
851 #define VM_INTRINSIC_ENUM(id, klass, name, sig, flags) id, |
|
852 VM_INTRINSICS_DO(VM_INTRINSIC_ENUM, |
|
853 VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) |
|
854 #undef VM_INTRINSIC_ENUM |
|
855 |
|
856 ID_LIMIT, |
|
857 FIRST_ID = _none + 1 |
|
858 }; |
|
859 |
|
860 enum Flags { |
|
861 // AccessFlags syndromes relevant to intrinsics. |
|
862 F_none = 0, |
|
863 F_R, // !static !synchronized (R="regular") |
|
864 F_S, // static !synchronized |
|
865 F_RN, // !static native !synchronized |
|
866 F_SN // static native !synchronized |
|
867 }; |
|
868 |
|
869 public: |
|
870 static ID ID_from(int raw_id) { |
|
871 assert(raw_id >= (int)_none && raw_id < (int)ID_LIMIT, |
|
872 "must be a valid intrinsic ID"); |
|
873 return (ID)raw_id; |
|
874 } |
|
875 |
|
876 static const char* name_at(ID id); |
|
877 |
|
878 // Given a method's class, name, signature, and access flags, report its ID. |
|
879 static ID find_id(vmSymbols::SID holder, |
|
880 vmSymbols::SID name, |
|
881 vmSymbols::SID sig, |
|
882 jshort flags); |
|
883 |
|
884 static void verify_method(ID actual_id, methodOop m) PRODUCT_RETURN; |
|
885 |
|
886 // No need for these in the product: |
|
887 static vmSymbols::SID class_for(ID id); |
|
888 static vmSymbols::SID name_for(ID id); |
|
889 static vmSymbols::SID signature_for(ID id); |
|
890 static Flags flags_for(ID id); |
|
891 |
|
892 static const char* short_name_as_C_string(ID id, char* buf, int size); |
|
893 }; |