comparison src/share/vm/classfile/systemDictionary.hpp @ 6275:957c266d8bc5

Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Aug 2012 10:39:19 +0200
parents 2585af1e26ac 1d7922586cf6
children 2a0c9f20baa1
comparison
equal deleted inserted replaced
5891:fd8832ae511d 6275:957c266d8bc5
30 #include "oops/objArrayOop.hpp" 30 #include "oops/objArrayOop.hpp"
31 #include "oops/symbol.hpp" 31 #include "oops/symbol.hpp"
32 #include "runtime/java.hpp" 32 #include "runtime/java.hpp"
33 #include "runtime/reflectionUtils.hpp" 33 #include "runtime/reflectionUtils.hpp"
34 #include "utilities/hashtable.hpp" 34 #include "utilities/hashtable.hpp"
35 #include "utilities/hashtable.inline.hpp"
35 36
36 // The system dictionary stores all loaded classes and maps: 37 // The system dictionary stores all loaded classes and maps:
37 // 38 //
38 // [class name,class loader] -> class i.e. [Symbol*,oop] -> klassOop 39 // [class name,class loader] -> class i.e. [Symbol*,oop] -> klassOop
39 // 40 //
70 // 71 //
71 72
72 class Dictionary; 73 class Dictionary;
73 class PlaceholderTable; 74 class PlaceholderTable;
74 class LoaderConstraintTable; 75 class LoaderConstraintTable;
75 class HashtableBucket; 76 template <MEMFLAGS F> class HashtableBucket;
76 class ResolutionErrorTable; 77 class ResolutionErrorTable;
77 class SymbolPropertyTable; 78 class SymbolPropertyTable;
78 79
79 // Certain classes are preloaded, such as java.lang.Object and java.lang.String. 80 // Certain classes are preloaded, such as java.lang.Object and java.lang.String.
80 // They are all "well-known", in the sense that no class loader is allowed 81 // They are all "well-known", in the sense that no class loader is allowed
145 \ 146 \
146 /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \ 147 /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
147 template(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292) \ 148 template(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292) \
148 template(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292) \ 149 template(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292) \
149 template(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292) \ 150 template(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292) \
150 template(AdapterMethodHandle_klass, java_lang_invoke_AdapterMethodHandle, Pre_JSR292) \ 151 template(LambdaForm_klass, java_lang_invoke_LambdaForm, Opt) \
151 template(BoundMethodHandle_klass, java_lang_invoke_BoundMethodHandle, Pre_JSR292) \
152 template(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Pre_JSR292) \
153 template(MethodType_klass, java_lang_invoke_MethodType, Pre_JSR292) \ 152 template(MethodType_klass, java_lang_invoke_MethodType, Pre_JSR292) \
154 template(MethodTypeForm_klass, java_lang_invoke_MethodTypeForm, Pre_JSR292) \
155 template(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre_JSR292) \ 153 template(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre_JSR292) \
156 template(WrongMethodTypeException_klass, java_lang_invoke_WrongMethodTypeException, Pre_JSR292) \
157 template(CallSite_klass, java_lang_invoke_CallSite, Pre_JSR292) \ 154 template(CallSite_klass, java_lang_invoke_CallSite, Pre_JSR292) \
158 template(CountingMethodHandle_klass, java_lang_invoke_CountingMethodHandle, Opt) \
159 template(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre_JSR292) \ 155 template(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre_JSR292) \
160 template(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre_JSR292) \ 156 template(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre_JSR292) \
161 template(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre_JSR292) \ 157 template(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre_JSR292) \
162 /* Note: MethodHandle must be first, and VolatileCallSite last in group */ \ 158 /* Note: MethodHandle must be first, and VolatileCallSite last in group */ \
163 \ 159 \
167 /* It's NULL in non-1.4 JDKs. */ \ 163 /* It's NULL in non-1.4 JDKs. */ \
168 template(StackTraceElement_klass, java_lang_StackTraceElement, Opt) \ 164 template(StackTraceElement_klass, java_lang_StackTraceElement, Opt) \
169 /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \ 165 /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \
170 /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ 166 /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
171 template(nio_Buffer_klass, java_nio_Buffer, Opt) \ 167 template(nio_Buffer_klass, java_nio_Buffer, Opt) \
172 \
173 /* If this class isn't present, it won't be referenced. */ \
174 template(AtomicLongCSImpl_klass, sun_misc_AtomicLongCSImpl, Opt) \
175 \ 168 \
176 template(DownloadManager_klass, sun_jkernel_DownloadManager, Opt_Kernel) \ 169 template(DownloadManager_klass, sun_jkernel_DownloadManager, Opt_Kernel) \
177 \ 170 \
178 template(PostVMInitHook_klass, sun_misc_PostVMInitHook, Opt) \ 171 template(PostVMInitHook_klass, sun_misc_PostVMInitHook, Opt) \
179 \ 172 \
406 // Sharing support. 399 // Sharing support.
407 static void reorder_dictionary(); 400 static void reorder_dictionary();
408 static void copy_buckets(char** top, char* end); 401 static void copy_buckets(char** top, char* end);
409 static void copy_table(char** top, char* end); 402 static void copy_table(char** top, char* end);
410 static void reverse(); 403 static void reverse();
411 static void set_shared_dictionary(HashtableBucket* t, int length, 404 static void set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
412 int number_of_entries); 405 int number_of_entries);
413 // Printing 406 // Printing
414 static void print() PRODUCT_RETURN; 407 static void print() PRODUCT_RETURN;
415 static void print_class_statistics() PRODUCT_RETURN; 408 static void print_class_statistics() PRODUCT_RETURN;
416 static void print_method_statistics() PRODUCT_RETURN; 409 static void print_method_statistics() PRODUCT_RETURN;
527 Handle loader2, TRAPS); 520 Handle loader2, TRAPS);
528 static char* check_signature_loaders(Symbol* signature, Handle loader1, 521 static char* check_signature_loaders(Symbol* signature, Handle loader1,
529 Handle loader2, bool is_method, TRAPS); 522 Handle loader2, bool is_method, TRAPS);
530 523
531 // JSR 292 524 // JSR 292
532 // find the java.lang.invoke.MethodHandles::invoke method for a given signature 525 // find a java.lang.invoke.MethodHandle.invoke* method for a given signature
533 static methodOop find_method_handle_invoke(Symbol* name, 526 // (asks Java to compute it if necessary, except in a compiler thread)
534 Symbol* signature, 527 static methodHandle find_method_handle_invoker(Symbol* name,
535 KlassHandle accessing_klass, 528 Symbol* signature,
536 TRAPS); 529 KlassHandle accessing_klass,
537 // ask Java to compute a java.lang.invoke.MethodType object for a given signature 530 Handle *appendix_result,
531 TRAPS);
532 // for a given signature, find the internal MethodHandle method (linkTo* or invokeBasic)
533 // (does not ask Java, since this is a low-level intrinsic defined by the JVM)
534 static methodHandle find_method_handle_intrinsic(vmIntrinsics::ID iid,
535 Symbol* signature,
536 TRAPS);
537 // find a java.lang.invoke.MethodType object for a given signature
538 // (asks Java to compute it if necessary, except in a compiler thread)
538 static Handle find_method_handle_type(Symbol* signature, 539 static Handle find_method_handle_type(Symbol* signature,
539 KlassHandle accessing_klass, 540 KlassHandle accessing_klass,
540 bool for_invokeGeneric,
541 bool& return_bcp_flag,
542 TRAPS); 541 TRAPS);
542
543 // ask Java to compute a java.lang.invoke.MethodHandle object for a given CP entry 543 // ask Java to compute a java.lang.invoke.MethodHandle object for a given CP entry
544 static Handle link_method_handle_constant(KlassHandle caller, 544 static Handle link_method_handle_constant(KlassHandle caller,
545 int ref_kind, //e.g., JVM_REF_invokeVirtual 545 int ref_kind, //e.g., JVM_REF_invokeVirtual
546 KlassHandle callee, 546 KlassHandle callee,
547 Symbol* name, 547 Symbol* name,
548 Symbol* signature, 548 Symbol* signature,
549 TRAPS); 549 TRAPS);
550
550 // ask Java to create a dynamic call site, while linking an invokedynamic op 551 // ask Java to create a dynamic call site, while linking an invokedynamic op
551 static Handle make_dynamic_call_site(Handle bootstrap_method, 552 static methodHandle find_dynamic_call_site_invoker(KlassHandle caller,
552 // Callee information: 553 Handle bootstrap_method,
553 Symbol* name, 554 Symbol* name,
554 methodHandle signature_invoker, 555 Symbol* type,
555 Handle info, 556 Handle *appendix_result,
556 // Caller information: 557 TRAPS);
557 methodHandle caller_method,
558 int caller_bci,
559 TRAPS);
560
561 // coordinate with Java about bootstrap methods
562 static Handle find_bootstrap_method(methodHandle caller_method,
563 int caller_bci, // N.B. must be an invokedynamic
564 int cache_index, // must be corresponding main_entry
565 Handle &argument_info_result, // static BSM arguments, if any
566 TRAPS);
567 558
568 // Utility for printing loader "name" as part of tracing constraints 559 // Utility for printing loader "name" as part of tracing constraints
569 static const char* loader_name(oop loader) { 560 static const char* loader_name(oop loader) {
570 return ((loader) == NULL ? "<bootloader>" : 561 return ((loader) == NULL ? "<bootloader>" :
571 instanceKlass::cast((loader)->klass())->name()->as_C_string() ); 562 instanceKlass::cast((loader)->klass())->name()->as_C_string() );