Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/classLoader.cpp @ 2181:d25d4ca69222
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Wed, 16 Feb 2011 13:47:20 +0100 |
parents | 06f017f7daa7 3582bf76420e |
children | 2ab52cda08e5 |
comparison
equal
deleted
inserted
replaced
2108:50b45e2d9725 | 2181:d25d4ca69222 |
---|---|
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); |
1380 } | 1376 } |
1381 } | 1377 } |
1382 } | 1378 } |
1383 | 1379 |
1384 #endif //PRODUCT | 1380 #endif //PRODUCT |
1381 | |
1382 // Please keep following two functions at end of this file. With them placed at top or in middle of the file, | |
1383 // they could get inlined by agressive compiler, an unknown trick, see bug 6966589. | |
1384 void PerfClassTraceTime::initialize() { | |
1385 if (!UsePerfData) return; | |
1386 | |
1387 if (_eventp != NULL) { | |
1388 // increment the event counter | |
1389 _eventp->inc(); | |
1390 } | |
1391 | |
1392 // stop the current active thread-local timer to measure inclusive time | |
1393 _prev_active_event = -1; | |
1394 for (int i=0; i < EVENT_TYPE_COUNT; i++) { | |
1395 if (_timers[i].is_active()) { | |
1396 assert(_prev_active_event == -1, "should have only one active timer"); | |
1397 _prev_active_event = i; | |
1398 _timers[i].stop(); | |
1399 } | |
1400 } | |
1401 | |
1402 if (_recursion_counters == NULL || (_recursion_counters[_event_type])++ == 0) { | |
1403 // start the inclusive timer if not recursively called | |
1404 _t.start(); | |
1405 } | |
1406 | |
1407 // start thread-local timer of the given event type | |
1408 if (!_timers[_event_type].is_active()) { | |
1409 _timers[_event_type].start(); | |
1410 } | |
1411 } | |
1412 | |
1413 PerfClassTraceTime::~PerfClassTraceTime() { | |
1414 if (!UsePerfData) return; | |
1415 | |
1416 // stop the thread-local timer as the event completes | |
1417 // and resume the thread-local timer of the event next on the stack | |
1418 _timers[_event_type].stop(); | |
1419 jlong selftime = _timers[_event_type].ticks(); | |
1420 | |
1421 if (_prev_active_event >= 0) { | |
1422 _timers[_prev_active_event].start(); | |
1423 } | |
1424 | |
1425 if (_recursion_counters != NULL && --(_recursion_counters[_event_type]) > 0) return; | |
1426 | |
1427 // increment the counters only on the leaf call | |
1428 _t.stop(); | |
1429 _timep->inc(_t.ticks()); | |
1430 if (_selftimep != NULL) { | |
1431 _selftimep->inc(selftime); | |
1432 } | |
1433 // add all class loading related event selftime to the accumulated time counter | |
1434 ClassLoader::perf_accumulated_time()->inc(selftime); | |
1435 | |
1436 // reset the timer | |
1437 _timers[_event_type].reset(); | |
1438 } |