Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/classLoader.cpp @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | 75efcee5ac47 |
children | d25d4ca69222 34457f6ac818 |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
39 #include "memory/universe.inline.hpp" | 39 #include "memory/universe.inline.hpp" |
40 #include "oops/constantPoolKlass.hpp" | 40 #include "oops/constantPoolKlass.hpp" |
41 #include "oops/instanceKlass.hpp" | 41 #include "oops/instanceKlass.hpp" |
42 #include "oops/instanceRefKlass.hpp" | 42 #include "oops/instanceRefKlass.hpp" |
43 #include "oops/oop.inline.hpp" | 43 #include "oops/oop.inline.hpp" |
44 #include "oops/symbolOop.hpp" | 44 #include "oops/symbol.hpp" |
45 #include "prims/jvm_misc.hpp" | 45 #include "prims/jvm_misc.hpp" |
46 #include "runtime/arguments.hpp" | 46 #include "runtime/arguments.hpp" |
47 #include "runtime/compilationPolicy.hpp" | 47 #include "runtime/compilationPolicy.hpp" |
48 #include "runtime/fprofiler.hpp" | 48 #include "runtime/fprofiler.hpp" |
49 #include "runtime/handles.hpp" | 49 #include "runtime/handles.hpp" |
750 pp = pp->next()) { | 750 pp = pp->next()) { |
751 n += (int)(strlen(pp->pkgname()) + 1); | 751 n += (int)(strlen(pp->pkgname()) + 1); |
752 } | 752 } |
753 } | 753 } |
754 if (*top + n + sizeof(intptr_t) >= end) { | 754 if (*top + n + sizeof(intptr_t) >= end) { |
755 warning("\nThe shared miscellaneous data space is not large " | 755 report_out_of_shared_space(SharedMiscData); |
756 "enough to \npreload requested classes. Use " | |
757 "-XX:SharedMiscDataSize= to increase \nthe initial " | |
758 "size of the miscellaneous data space.\n"); | |
759 exit(2); | |
760 } | 756 } |
761 | 757 |
762 // Copy the table data (the strings) to the shared space. | 758 // Copy the table data (the strings) to the shared space. |
763 n = align_size_up(n, sizeof(HeapWord)); | 759 n = align_size_up(n, sizeof(HeapWord)); |
764 *(intptr_t*)(*top) = n; | 760 *(intptr_t*)(*top) = n; |
873 | 869 |
874 return result(); | 870 return result(); |
875 } | 871 } |
876 | 872 |
877 | 873 |
878 instanceKlassHandle ClassLoader::load_classfile(symbolHandle h_name, TRAPS) { | 874 instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) { |
879 ResourceMark rm(THREAD); | 875 ResourceMark rm(THREAD); |
880 EventMark m("loading class " INTPTR_FORMAT, (address)h_name()); | 876 EventMark m("loading class " INTPTR_FORMAT, (address)h_name); |
881 ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion); | 877 ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion); |
882 | 878 |
883 stringStream st; | 879 stringStream st; |
884 // st.print() uses too much stack space while handling a StackOverflowError | 880 // st.print() uses too much stack space while handling a StackOverflowError |
885 // st.print("%s.class", h_name->as_utf8()); | 881 // st.print("%s.class", h_name->as_utf8()); |
910 | 906 |
911 // class file found, parse it | 907 // class file found, parse it |
912 ClassFileParser parser(stream); | 908 ClassFileParser parser(stream); |
913 Handle class_loader; | 909 Handle class_loader; |
914 Handle protection_domain; | 910 Handle protection_domain; |
915 symbolHandle parsed_name; | 911 TempNewSymbol parsed_name = NULL; |
916 instanceKlassHandle result = parser.parseClassFile(h_name, | 912 instanceKlassHandle result = parser.parseClassFile(h_name, |
917 class_loader, | 913 class_loader, |
918 protection_domain, | 914 protection_domain, |
919 parsed_name, | 915 parsed_name, |
920 false, | 916 false, |
1306 if (strchr(buffer, '.') == NULL) { | 1302 if (strchr(buffer, '.') == NULL) { |
1307 _compile_the_world_counter++; | 1303 _compile_the_world_counter++; |
1308 if (_compile_the_world_counter > CompileTheWorldStopAt) return; | 1304 if (_compile_the_world_counter > CompileTheWorldStopAt) return; |
1309 | 1305 |
1310 // Construct name without extension | 1306 // Construct name without extension |
1311 symbolHandle sym = oopFactory::new_symbol_handle(buffer, CHECK); | 1307 TempNewSymbol sym = SymbolTable::new_symbol(buffer, CHECK); |
1312 // Use loader to load and initialize class | 1308 // Use loader to load and initialize class |
1313 klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD); | 1309 klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD); |
1314 instanceKlassHandle k (THREAD, ik); | 1310 instanceKlassHandle k (THREAD, ik); |
1315 if (k.not_null() && !HAS_PENDING_EXCEPTION) { | 1311 if (k.not_null() && !HAS_PENDING_EXCEPTION) { |
1316 k->initialize(THREAD); | 1312 k->initialize(THREAD); |