24
25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/classLoaderData.hpp"
29 #include "classfile/javaClasses.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/systemDictionary.hpp"
32 #include "classfile/vmSymbols.hpp"
33 #include "code/codeCache.hpp"
34 #include "code/dependencies.hpp"
35 #include "gc/shared/cardTableModRefBS.hpp"
36 #include "gc/shared/collectedHeap.inline.hpp"
37 #include "gc/shared/gcLocker.inline.hpp"
38 #include "gc/shared/genCollectedHeap.hpp"
39 #include "gc/shared/generation.hpp"
40 #include "gc/shared/gcTraceTime.inline.hpp"
41 #include "gc/shared/space.hpp"
42 #include "interpreter/interpreter.hpp"
43 #include "logging/log.hpp"
44 #include "memory/filemap.hpp"
45 #include "memory/metadataFactory.hpp"
46 #include "memory/metaspaceShared.hpp"
47 #include "memory/oopFactory.hpp"
48 #include "memory/resourceArea.hpp"
49 #include "memory/universe.hpp"
50 #include "memory/universe.inline.hpp"
51 #include "oops/constantPool.hpp"
52 #include "oops/instanceClassLoaderKlass.hpp"
53 #include "oops/instanceKlass.hpp"
54 #include "oops/instanceMirrorKlass.hpp"
55 #include "oops/instanceRefKlass.hpp"
56 #include "oops/objArrayOop.inline.hpp"
57 #include "oops/oop.inline.hpp"
58 #include "oops/typeArrayKlass.hpp"
59 #include "prims/resolvedMethodTable.hpp"
60 #include "runtime/arguments.hpp"
61 #include "runtime/atomic.hpp"
62 #include "runtime/commandLineFlagConstraintList.hpp"
63 #include "runtime/deoptimization.hpp"
743
744 #ifdef _LP64
745 if (UseCompressedOops) {
746 // Subtract a page because something can get allocated at heap base.
747 // This also makes implicit null checking work, because the
748 // memory+1 page below heap_base needs to cause a signal.
749 // See needs_explicit_null_check.
750 // Only set the heap base for compressed oops because it indicates
751 // compressed oops for pstack code.
752 if ((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) {
753 // Didn't reserve heap below 4Gb. Must shift.
754 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
755 }
756 if ((uint64_t)Universe::heap()->reserved_region().end() <= OopEncodingHeapMax) {
757 // Did reserve heap below 32Gb. Can use base == 0;
758 Universe::set_narrow_oop_base(0);
759 }
760
761 Universe::set_narrow_ptrs_base(Universe::narrow_oop_base());
762
763 if (log_is_enabled(Info, gc, heap, coops)) {
764 ResourceMark rm;
765 outputStream* logst = Log(gc, heap, coops)::info_stream();
766 Universe::print_compressed_oops_mode(logst);
767 }
768
769 // Tell tests in which mode we run.
770 Arguments::PropertyList_add(new SystemProperty("java.vm.compressedOopsMode",
771 narrow_oop_mode_to_string(narrow_oop_mode()),
772 false));
773 }
774 // Universe::narrow_oop_base() is one page below the heap.
775 assert((intptr_t)Universe::narrow_oop_base() <= (intptr_t)(Universe::heap()->base() -
776 os::vm_page_size()) ||
777 Universe::narrow_oop_base() == NULL, "invalid value");
778 assert(Universe::narrow_oop_shift() == LogMinObjAlignmentInBytes ||
779 Universe::narrow_oop_shift() == 0, "invalid value");
780 #endif
781
782 // We will never reach the CATCH below since Exceptions::_throw will cause
783 // the VM to exit if an exception is thrown during initialization
784
785 if (UseTLAB) {
786 assert(Universe::heap()->supports_tlab_allocation(),
1079
1080 void Universe::compute_base_vtable_size() {
1081 _base_vtable_size = ClassLoader::compute_Object_vtable();
1082 }
1083
1084 void Universe::print_on(outputStream* st) {
1085 GCMutexLocker hl(Heap_lock); // Heap_lock might be locked by caller thread.
1086 st->print_cr("Heap");
1087 heap()->print_on(st);
1088 }
1089
1090 void Universe::print_heap_at_SIGBREAK() {
1091 if (PrintHeapAtSIGBREAK) {
1092 print_on(tty);
1093 tty->cr();
1094 tty->flush();
1095 }
1096 }
1097
1098 void Universe::print_heap_before_gc() {
1099 Log(gc, heap) log;
1100 if (log.is_debug()) {
1101 log.debug("Heap before GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1102 ResourceMark rm;
1103 heap()->print_on(log.debug_stream());
1104 }
1105 }
1106
1107 void Universe::print_heap_after_gc() {
1108 Log(gc, heap) log;
1109 if (log.is_debug()) {
1110 log.debug("Heap after GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1111 ResourceMark rm;
1112 heap()->print_on(log.debug_stream());
1113 }
1114 }
1115
1116 void Universe::initialize_verify_flags() {
1117 verify_flags = 0;
1118 const char delimiter[] = " ,";
1119
1120 size_t length = strlen(VerifySubSet);
1121 char* subset_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal);
1122 strncpy(subset_list, VerifySubSet, length + 1);
1123
1124 char* token = strtok(subset_list, delimiter);
1125 while (token != NULL) {
1126 if (strcmp(token, "threads") == 0) {
1127 verify_flags |= Verify_Threads;
1128 } else if (strcmp(token, "heap") == 0) {
1129 verify_flags |= Verify_Heap;
1130 } else if (strcmp(token, "symbol_table") == 0) {
1131 verify_flags |= Verify_SymbolTable;
1132 } else if (strcmp(token, "string_table") == 0) {
|
24
25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/classLoaderData.hpp"
29 #include "classfile/javaClasses.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/systemDictionary.hpp"
32 #include "classfile/vmSymbols.hpp"
33 #include "code/codeCache.hpp"
34 #include "code/dependencies.hpp"
35 #include "gc/shared/cardTableModRefBS.hpp"
36 #include "gc/shared/collectedHeap.inline.hpp"
37 #include "gc/shared/gcLocker.inline.hpp"
38 #include "gc/shared/genCollectedHeap.hpp"
39 #include "gc/shared/generation.hpp"
40 #include "gc/shared/gcTraceTime.inline.hpp"
41 #include "gc/shared/space.hpp"
42 #include "interpreter/interpreter.hpp"
43 #include "logging/log.hpp"
44 #include "logging/logStream.hpp"
45 #include "memory/filemap.hpp"
46 #include "memory/metadataFactory.hpp"
47 #include "memory/metaspaceShared.hpp"
48 #include "memory/oopFactory.hpp"
49 #include "memory/resourceArea.hpp"
50 #include "memory/universe.hpp"
51 #include "memory/universe.inline.hpp"
52 #include "oops/constantPool.hpp"
53 #include "oops/instanceClassLoaderKlass.hpp"
54 #include "oops/instanceKlass.hpp"
55 #include "oops/instanceMirrorKlass.hpp"
56 #include "oops/instanceRefKlass.hpp"
57 #include "oops/objArrayOop.inline.hpp"
58 #include "oops/oop.inline.hpp"
59 #include "oops/typeArrayKlass.hpp"
60 #include "prims/resolvedMethodTable.hpp"
61 #include "runtime/arguments.hpp"
62 #include "runtime/atomic.hpp"
63 #include "runtime/commandLineFlagConstraintList.hpp"
64 #include "runtime/deoptimization.hpp"
744
745 #ifdef _LP64
746 if (UseCompressedOops) {
747 // Subtract a page because something can get allocated at heap base.
748 // This also makes implicit null checking work, because the
749 // memory+1 page below heap_base needs to cause a signal.
750 // See needs_explicit_null_check.
751 // Only set the heap base for compressed oops because it indicates
752 // compressed oops for pstack code.
753 if ((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) {
754 // Didn't reserve heap below 4Gb. Must shift.
755 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
756 }
757 if ((uint64_t)Universe::heap()->reserved_region().end() <= OopEncodingHeapMax) {
758 // Did reserve heap below 32Gb. Can use base == 0;
759 Universe::set_narrow_oop_base(0);
760 }
761
762 Universe::set_narrow_ptrs_base(Universe::narrow_oop_base());
763
764 LogTarget(Info, gc, heap, coops) lt;
765 if (lt.is_enabled()) {
766 ResourceMark rm;
767 LogStream ls(lt);
768 Universe::print_compressed_oops_mode(&ls);
769 }
770
771 // Tell tests in which mode we run.
772 Arguments::PropertyList_add(new SystemProperty("java.vm.compressedOopsMode",
773 narrow_oop_mode_to_string(narrow_oop_mode()),
774 false));
775 }
776 // Universe::narrow_oop_base() is one page below the heap.
777 assert((intptr_t)Universe::narrow_oop_base() <= (intptr_t)(Universe::heap()->base() -
778 os::vm_page_size()) ||
779 Universe::narrow_oop_base() == NULL, "invalid value");
780 assert(Universe::narrow_oop_shift() == LogMinObjAlignmentInBytes ||
781 Universe::narrow_oop_shift() == 0, "invalid value");
782 #endif
783
784 // We will never reach the CATCH below since Exceptions::_throw will cause
785 // the VM to exit if an exception is thrown during initialization
786
787 if (UseTLAB) {
788 assert(Universe::heap()->supports_tlab_allocation(),
1081
1082 void Universe::compute_base_vtable_size() {
1083 _base_vtable_size = ClassLoader::compute_Object_vtable();
1084 }
1085
1086 void Universe::print_on(outputStream* st) {
1087 GCMutexLocker hl(Heap_lock); // Heap_lock might be locked by caller thread.
1088 st->print_cr("Heap");
1089 heap()->print_on(st);
1090 }
1091
1092 void Universe::print_heap_at_SIGBREAK() {
1093 if (PrintHeapAtSIGBREAK) {
1094 print_on(tty);
1095 tty->cr();
1096 tty->flush();
1097 }
1098 }
1099
1100 void Universe::print_heap_before_gc() {
1101 LogTarget(Debug, gc, heap) lt;
1102 if (lt.is_enabled()) {
1103 LogStream ls(lt);
1104 ls.print("Heap before GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1105 ResourceMark rm;
1106 heap()->print_on(&ls);
1107 }
1108 }
1109
1110 void Universe::print_heap_after_gc() {
1111 LogTarget(Debug, gc, heap) lt;
1112 if (lt.is_enabled()) {
1113 LogStream ls(lt);
1114 ls.print("Heap after GC invocations=%u (full %u):", heap()->total_collections(), heap()->total_full_collections());
1115 ResourceMark rm;
1116 heap()->print_on(&ls);
1117 }
1118 }
1119
1120 void Universe::initialize_verify_flags() {
1121 verify_flags = 0;
1122 const char delimiter[] = " ,";
1123
1124 size_t length = strlen(VerifySubSet);
1125 char* subset_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal);
1126 strncpy(subset_list, VerifySubSet, length + 1);
1127
1128 char* token = strtok(subset_list, delimiter);
1129 while (token != NULL) {
1130 if (strcmp(token, "threads") == 0) {
1131 verify_flags |= Verify_Threads;
1132 } else if (strcmp(token, "heap") == 0) {
1133 verify_flags |= Verify_Heap;
1134 } else if (strcmp(token, "symbol_table") == 0) {
1135 verify_flags |= Verify_SymbolTable;
1136 } else if (strcmp(token, "string_table") == 0) {
|