40 #include "classfile/systemDictionary.hpp" |
40 #include "classfile/systemDictionary.hpp" |
41 #include "classfile/vmSymbols.hpp" |
41 #include "classfile/vmSymbols.hpp" |
42 #include "code/codeCache.hpp" |
42 #include "code/codeCache.hpp" |
43 #include "compiler/compileBroker.hpp" |
43 #include "compiler/compileBroker.hpp" |
44 #include "gc/shared/gcLocker.hpp" |
44 #include "gc/shared/gcLocker.hpp" |
|
45 #include "gc/shared/gcTraceTime.inline.hpp" |
45 #include "interpreter/bytecodeStream.hpp" |
46 #include "interpreter/bytecodeStream.hpp" |
46 #include "interpreter/interpreter.hpp" |
47 #include "interpreter/interpreter.hpp" |
|
48 #include "logging/log.hpp" |
47 #include "memory/filemap.hpp" |
49 #include "memory/filemap.hpp" |
48 #include "memory/oopFactory.hpp" |
50 #include "memory/oopFactory.hpp" |
49 #include "memory/resourceArea.hpp" |
51 #include "memory/resourceArea.hpp" |
50 #include "oops/instanceKlass.hpp" |
52 #include "oops/instanceKlass.hpp" |
51 #include "oops/instanceRefKlass.hpp" |
53 #include "oops/instanceRefKlass.hpp" |
55 #include "oops/objArrayOop.inline.hpp" |
57 #include "oops/objArrayOop.inline.hpp" |
56 #include "oops/oop.inline.hpp" |
58 #include "oops/oop.inline.hpp" |
57 #include "oops/symbol.hpp" |
59 #include "oops/symbol.hpp" |
58 #include "oops/typeArrayKlass.hpp" |
60 #include "oops/typeArrayKlass.hpp" |
59 #include "prims/jvmtiEnvBase.hpp" |
61 #include "prims/jvmtiEnvBase.hpp" |
|
62 #include "prims/resolvedMethodTable.hpp" |
60 #include "prims/methodHandles.hpp" |
63 #include "prims/methodHandles.hpp" |
61 #include "runtime/arguments.hpp" |
64 #include "runtime/arguments.hpp" |
62 #include "runtime/biasedLocking.hpp" |
65 #include "runtime/biasedLocking.hpp" |
63 #include "runtime/fieldType.hpp" |
66 #include "runtime/fieldType.hpp" |
64 #include "runtime/handles.inline.hpp" |
67 #include "runtime/handles.inline.hpp" |
1913 #endif |
1916 #endif |
1914 |
1917 |
1915 // Assumes classes in the SystemDictionary are only unloaded at a safepoint |
1918 // Assumes classes in the SystemDictionary are only unloaded at a safepoint |
1916 // Note: anonymous classes are not in the SD. |
1919 // Note: anonymous classes are not in the SD. |
1917 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive, |
1920 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive, |
1918 bool clean_previous_versions) { |
1921 GCTimer* gc_timer, |
1919 // First, mark for unload all ClassLoaderData referencing a dead class loader. |
1922 bool do_cleaning) { |
1920 bool unloading_occurred = ClassLoaderDataGraph::do_unloading(is_alive, |
1923 |
1921 clean_previous_versions); |
1924 |
|
1925 bool unloading_occurred; |
|
1926 { |
|
1927 GCTraceTime(Debug, gc, phases) t("ClassLoaderData", gc_timer); |
|
1928 |
|
1929 // First, mark for unload all ClassLoaderData referencing a dead class loader. |
|
1930 unloading_occurred = ClassLoaderDataGraph::do_unloading(is_alive, |
|
1931 do_cleaning); |
|
1932 } |
|
1933 |
1922 if (unloading_occurred) { |
1934 if (unloading_occurred) { |
|
1935 GCTraceTime(Debug, gc, phases) t("Dictionary", gc_timer); |
1923 dictionary()->do_unloading(); |
1936 dictionary()->do_unloading(); |
1924 constraints()->purge_loader_constraints(); |
1937 constraints()->purge_loader_constraints(); |
1925 resolution_errors()->purge_resolution_errors(); |
1938 resolution_errors()->purge_resolution_errors(); |
1926 } |
1939 } |
1927 // Oops referenced by the system dictionary may get unreachable independently |
1940 |
1928 // of the class loader (eg. cached protection domain oops). So we need to |
1941 { |
1929 // explicitly unlink them here instead of in Dictionary::do_unloading. |
1942 GCTraceTime(Debug, gc, phases) t("ProtectionDomainCacheTable", gc_timer); |
1930 dictionary()->unlink(is_alive); |
1943 // Oops referenced by the system dictionary may get unreachable independently |
|
1944 // of the class loader (eg. cached protection domain oops). So we need to |
|
1945 // explicitly unlink them here instead of in Dictionary::do_unloading. |
|
1946 dictionary()->unlink(is_alive); |
1931 #ifdef ASSERT |
1947 #ifdef ASSERT |
1932 VerifySDReachableAndLiveClosure cl(is_alive); |
1948 VerifySDReachableAndLiveClosure cl(is_alive); |
1933 dictionary()->oops_do(&cl); |
1949 dictionary()->oops_do(&cl); |
1934 #endif |
1950 #endif |
|
1951 } |
|
1952 |
|
1953 if (do_cleaning) { |
|
1954 GCTraceTime(Debug, gc, phases) t("ResolvedMethodTable", gc_timer); |
|
1955 ResolvedMethodTable::unlink(is_alive); |
|
1956 } |
|
1957 |
1935 return unloading_occurred; |
1958 return unloading_occurred; |
1936 } |
1959 } |
1937 |
1960 |
1938 void SystemDictionary::roots_oops_do(OopClosure* strong, OopClosure* weak) { |
1961 void SystemDictionary::roots_oops_do(OopClosure* strong, OopClosure* weak) { |
1939 strong->do_oop(&_java_system_loader); |
1962 strong->do_oop(&_java_system_loader); |
1943 // Adjust dictionary |
1966 // Adjust dictionary |
1944 dictionary()->roots_oops_do(strong, weak); |
1967 dictionary()->roots_oops_do(strong, weak); |
1945 |
1968 |
1946 // Visit extra methods |
1969 // Visit extra methods |
1947 invoke_method_table()->oops_do(strong); |
1970 invoke_method_table()->oops_do(strong); |
|
1971 |
|
1972 if (weak != NULL) { |
|
1973 ResolvedMethodTable::oops_do(weak); |
|
1974 } |
1948 } |
1975 } |
1949 |
1976 |
1950 void SystemDictionary::oops_do(OopClosure* f) { |
1977 void SystemDictionary::oops_do(OopClosure* f) { |
1951 f->do_oop(&_java_system_loader); |
1978 f->do_oop(&_java_system_loader); |
1952 f->do_oop(&_system_loader_lock_obj); |
1979 f->do_oop(&_system_loader_lock_obj); |
1955 // Adjust dictionary |
1982 // Adjust dictionary |
1956 dictionary()->oops_do(f); |
1983 dictionary()->oops_do(f); |
1957 |
1984 |
1958 // Visit extra methods |
1985 // Visit extra methods |
1959 invoke_method_table()->oops_do(f); |
1986 invoke_method_table()->oops_do(f); |
|
1987 |
|
1988 ResolvedMethodTable::oops_do(f); |
1960 } |
1989 } |
1961 |
1990 |
1962 // Just the classes from defining class loaders |
1991 // Just the classes from defining class loaders |
1963 // Don't iterate over placeholders |
1992 // Don't iterate over placeholders |
1964 void SystemDictionary::classes_do(void f(Klass*)) { |
1993 void SystemDictionary::classes_do(void f(Klass*)) { |
2524 objArrayHandle appendix_box, |
2553 objArrayHandle appendix_box, |
2525 Handle* appendix_result, |
2554 Handle* appendix_result, |
2526 TRAPS) { |
2555 TRAPS) { |
2527 methodHandle empty; |
2556 methodHandle empty; |
2528 if (mname.not_null()) { |
2557 if (mname.not_null()) { |
2529 Metadata* vmtarget = java_lang_invoke_MemberName::vmtarget(mname()); |
2558 Method* m = java_lang_invoke_MemberName::vmtarget(mname()); |
2530 if (vmtarget != NULL && vmtarget->is_method()) { |
2559 if (m != NULL) { |
2531 Method* m = (Method*)vmtarget; |
|
2532 oop appendix = appendix_box->obj_at(0); |
2560 oop appendix = appendix_box->obj_at(0); |
2533 if (TraceMethodHandles) { |
2561 if (TraceMethodHandles) { |
2534 #ifndef PRODUCT |
2562 #ifndef PRODUCT |
2535 ttyLocker ttyl; |
2563 ttyLocker ttyl; |
2536 tty->print("Linked method=" INTPTR_FORMAT ": ", p2i(m)); |
2564 tty->print("Linked method=" INTPTR_FORMAT ": ", p2i(m)); |