< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page

1592 
1593   LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1594   NOT_LP64(ShouldNotReachHere(); return 0);
1595 }
1596 
1597 void Arguments::set_use_compressed_oops() {
1598 #ifdef _LP64
1599   // MaxHeapSize is not set up properly at this point, but
1600   // the only value that can override MaxHeapSize if we are
1601   // to use UseCompressedOops are InitialHeapSize and MinHeapSize.
1602   size_t max_heap_size = MAX3(MaxHeapSize, InitialHeapSize, MinHeapSize);
1603 
1604   if (max_heap_size <= max_heap_for_compressed_oops()) {
1605     if (FLAG_IS_DEFAULT(UseCompressedOops)) {
1606       FLAG_SET_ERGO(UseCompressedOops, true);
1607     }
1608   } else {
1609     if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1610       warning("Max heap size too large for Compressed Oops");
1611       FLAG_SET_DEFAULT(UseCompressedOops, false);
1612       if (COMPRESSED_CLASS_POINTERS_DEPENDS_ON_COMPRESSED_OOPS) {
1613         FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
1614       }
1615     }
1616   }
1617 #endif // _LP64
1618 }
1619 
1620 
1621 // NOTE: set_use_compressed_klass_ptrs() must be called after calling
1622 // set_use_compressed_oops().
1623 void Arguments::set_use_compressed_klass_ptrs() {
1624 #ifdef _LP64
1625   // On some architectures, the use of UseCompressedClassPointers implies the use of
1626   // UseCompressedOops. The reason is that the rheap_base register of said platforms
1627   // is reused to perform some optimized spilling, in order to use rheap_base as a
1628   // temp register. But by treating it as any other temp register, spilling can typically
1629   // be completely avoided instead. So it is better not to perform this trick. And by
1630   // not having that reliance, large heaps, or heaps not supporting compressed oops,
1631   // can still use compressed class pointers.
1632   if (COMPRESSED_CLASS_POINTERS_DEPENDS_ON_COMPRESSED_OOPS && !UseCompressedOops) {
1633     if (UseCompressedClassPointers) {
1634       warning("UseCompressedClassPointers requires UseCompressedOops");
1635     }
1636     FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
1637   } else {
1638     // Turn on UseCompressedClassPointers too
1639     if (FLAG_IS_DEFAULT(UseCompressedClassPointers)) {
1640       FLAG_SET_ERGO(UseCompressedClassPointers, true);
1641     }
1642     // Check the CompressedClassSpaceSize to make sure we use compressed klass ptrs.
1643     if (UseCompressedClassPointers) {
1644       if (CompressedClassSpaceSize > KlassEncodingMetaspaceMax) {
1645         warning("CompressedClassSpaceSize is too large for UseCompressedClassPointers");
1646         FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
1647       }
1648     }
1649   }
1650 #endif // _LP64
1651 }
1652 
1653 void Arguments::set_conservative_max_heap_alignment() {
1654   // The conservative maximum required alignment for the heap is the maximum of
1655   // the alignments imposed by several sources: any requirements from the heap
1656   // itself and the maximum page size we may run the VM with.
1657   size_t heap_alignment = GCConfig::arguments()->conservative_max_heap_alignment();
1658   _conservative_max_heap_alignment = MAX4(heap_alignment,
1659                                           (size_t)os::vm_allocation_granularity(),
1660                                           os::max_page_size(),
1661                                           GCArguments::compute_heap_alignment());
1662 }
1663 
1664 jint Arguments::set_ergonomics_flags() {
1665   GCConfig::initialize();
1666 
1667   set_conservative_max_heap_alignment();
1668 
1669 #ifdef _LP64

1792       // Limit the heap size to the maximum possible when using compressed oops
1793       julong max_coop_heap = (julong)max_heap_for_compressed_oops();
1794 
1795       if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) {
1796         // Heap should be above HeapBaseMinAddress to get zero based compressed oops
1797         // but it should be not less than default MaxHeapSize.
1798         max_coop_heap -= HeapBaseMinAddress;
1799       }
1800 
1801       // If user specified flags prioritizing os physical
1802       // memory limits, then disable compressed oops if
1803       // limits exceed max_coop_heap and UseCompressedOops
1804       // was not specified.
1805       if (reasonable_max > max_coop_heap) {
1806         if (FLAG_IS_ERGO(UseCompressedOops) && override_coop_limit) {
1807           log_info(cds)("UseCompressedOops and UseCompressedClassPointers have been disabled due to"
1808             " max heap " SIZE_FORMAT " > compressed oop heap " SIZE_FORMAT ". "
1809             "Please check the setting of MaxRAMPercentage %5.2f."
1810             ,(size_t)reasonable_max, (size_t)max_coop_heap, MaxRAMPercentage);
1811           FLAG_SET_ERGO(UseCompressedOops, false);
1812           if (COMPRESSED_CLASS_POINTERS_DEPENDS_ON_COMPRESSED_OOPS) {
1813             FLAG_SET_ERGO(UseCompressedClassPointers, false);
1814           }
1815         } else {
1816           reasonable_max = MIN2(reasonable_max, max_coop_heap);
1817         }
1818       }
1819     }
1820 #endif // _LP64
1821 
1822     log_trace(gc, heap)("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
1823     FLAG_SET_ERGO(MaxHeapSize, (size_t)reasonable_max);
1824   }
1825 
1826   // If the minimum or initial heap_size have not been set or requested to be set
1827   // ergonomically, set them accordingly.
1828   if (InitialHeapSize == 0 || MinHeapSize == 0) {
1829     julong reasonable_minimum = (julong)(OldSize + NewSize);
1830 
1831     reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize);
1832 
1833     reasonable_minimum = limit_heap_by_allocatable_memory(reasonable_minimum);
1834 

4193       if (!EnableVectorReboxing) {
4194         warning("Disabling EnableVectorAggressiveReboxing since EnableVectorReboxing is turned off.");
4195       } else {
4196         warning("Disabling EnableVectorAggressiveReboxing since EnableVectorSupport is turned off.");
4197       }
4198     }
4199     FLAG_SET_DEFAULT(EnableVectorAggressiveReboxing, false);
4200 
4201     if (!FLAG_IS_DEFAULT(UseVectorStubs) && UseVectorStubs) {
4202       warning("Disabling UseVectorStubs since EnableVectorSupport is turned off.");
4203     }
4204     FLAG_SET_DEFAULT(UseVectorStubs, false);
4205   }
4206 #endif // COMPILER2
4207 
4208   if (FLAG_IS_CMDLINE(DiagnoseSyncOnValueBasedClasses)) {
4209     if (DiagnoseSyncOnValueBasedClasses == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, valuebasedclasses)) {
4210       LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(valuebasedclasses));
4211     }
4212   }

4213   return JNI_OK;
4214 }
4215 
4216 jint Arguments::adjust_after_os() {
4217   if (UseNUMA) {
4218     if (UseParallelGC) {
4219       if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
4220          FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
4221       }
4222     }
4223   }
4224   return JNI_OK;
4225 }
4226 
4227 int Arguments::PropertyList_count(SystemProperty* pl) {
4228   int count = 0;
4229   while(pl != NULL) {
4230     count++;
4231     pl = pl->next();
4232   }

1592 
1593   LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1594   NOT_LP64(ShouldNotReachHere(); return 0);
1595 }
1596 
1597 void Arguments::set_use_compressed_oops() {
1598 #ifdef _LP64
1599   // MaxHeapSize is not set up properly at this point, but
1600   // the only value that can override MaxHeapSize if we are
1601   // to use UseCompressedOops are InitialHeapSize and MinHeapSize.
1602   size_t max_heap_size = MAX3(MaxHeapSize, InitialHeapSize, MinHeapSize);
1603 
1604   if (max_heap_size <= max_heap_for_compressed_oops()) {
1605     if (FLAG_IS_DEFAULT(UseCompressedOops)) {
1606       FLAG_SET_ERGO(UseCompressedOops, true);
1607     }
1608   } else {
1609     if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1610       warning("Max heap size too large for Compressed Oops");
1611       FLAG_SET_DEFAULT(UseCompressedOops, false);



1612     }
1613   }
1614 #endif // _LP64
1615 }
1616 

1617 // NOTE: set_use_compressed_klass_ptrs() must be called after calling
1618 // set_use_compressed_oops().
1619 void Arguments::set_use_compressed_klass_ptrs() {
1620 #ifdef _LP64
1621   if (!UseCompressedClassPointers) {
1622     // Lilliput requires compressed class pointers. Default shall reflect that.
1623     // If user specifies -UseCompressedClassPointers, it should be reverted with
1624     // a warning.
1625     assert(!FLAG_IS_DEFAULT(UseCompressedClassPointers), "Wrong default for UseCompressedClassPointers");
1626     warning("Lilliput reqires compressed class pointers.");
1627     FLAG_SET_ERGO(UseCompressedClassPointers, true);
1628   }
1629   // Assert validity of compressed class space size. User arg should have been checked at this point
1630   // (see CompressedClassSpaceSizeConstraintFunc()), so no need to be nice about it, this fires in
1631   // case the default is wrong.
1632   assert(CompressedClassSpaceSize <= Metaspace::max_class_space_size(),
1633          "CompressedClassSpaceSize " SIZE_FORMAT " too large (max: " SIZE_FORMAT ")",
1634          CompressedClassSpaceSize, Metaspace::max_class_space_size());











1635 #endif // _LP64
1636 }
1637 
1638 void Arguments::set_conservative_max_heap_alignment() {
1639   // The conservative maximum required alignment for the heap is the maximum of
1640   // the alignments imposed by several sources: any requirements from the heap
1641   // itself and the maximum page size we may run the VM with.
1642   size_t heap_alignment = GCConfig::arguments()->conservative_max_heap_alignment();
1643   _conservative_max_heap_alignment = MAX4(heap_alignment,
1644                                           (size_t)os::vm_allocation_granularity(),
1645                                           os::max_page_size(),
1646                                           GCArguments::compute_heap_alignment());
1647 }
1648 
1649 jint Arguments::set_ergonomics_flags() {
1650   GCConfig::initialize();
1651 
1652   set_conservative_max_heap_alignment();
1653 
1654 #ifdef _LP64

1777       // Limit the heap size to the maximum possible when using compressed oops
1778       julong max_coop_heap = (julong)max_heap_for_compressed_oops();
1779 
1780       if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) {
1781         // Heap should be above HeapBaseMinAddress to get zero based compressed oops
1782         // but it should be not less than default MaxHeapSize.
1783         max_coop_heap -= HeapBaseMinAddress;
1784       }
1785 
1786       // If user specified flags prioritizing os physical
1787       // memory limits, then disable compressed oops if
1788       // limits exceed max_coop_heap and UseCompressedOops
1789       // was not specified.
1790       if (reasonable_max > max_coop_heap) {
1791         if (FLAG_IS_ERGO(UseCompressedOops) && override_coop_limit) {
1792           log_info(cds)("UseCompressedOops and UseCompressedClassPointers have been disabled due to"
1793             " max heap " SIZE_FORMAT " > compressed oop heap " SIZE_FORMAT ". "
1794             "Please check the setting of MaxRAMPercentage %5.2f."
1795             ,(size_t)reasonable_max, (size_t)max_coop_heap, MaxRAMPercentage);
1796           FLAG_SET_ERGO(UseCompressedOops, false);



1797         } else {
1798           reasonable_max = MIN2(reasonable_max, max_coop_heap);
1799         }
1800       }
1801     }
1802 #endif // _LP64
1803 
1804     log_trace(gc, heap)("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
1805     FLAG_SET_ERGO(MaxHeapSize, (size_t)reasonable_max);
1806   }
1807 
1808   // If the minimum or initial heap_size have not been set or requested to be set
1809   // ergonomically, set them accordingly.
1810   if (InitialHeapSize == 0 || MinHeapSize == 0) {
1811     julong reasonable_minimum = (julong)(OldSize + NewSize);
1812 
1813     reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize);
1814 
1815     reasonable_minimum = limit_heap_by_allocatable_memory(reasonable_minimum);
1816 

4175       if (!EnableVectorReboxing) {
4176         warning("Disabling EnableVectorAggressiveReboxing since EnableVectorReboxing is turned off.");
4177       } else {
4178         warning("Disabling EnableVectorAggressiveReboxing since EnableVectorSupport is turned off.");
4179       }
4180     }
4181     FLAG_SET_DEFAULT(EnableVectorAggressiveReboxing, false);
4182 
4183     if (!FLAG_IS_DEFAULT(UseVectorStubs) && UseVectorStubs) {
4184       warning("Disabling UseVectorStubs since EnableVectorSupport is turned off.");
4185     }
4186     FLAG_SET_DEFAULT(UseVectorStubs, false);
4187   }
4188 #endif // COMPILER2
4189 
4190   if (FLAG_IS_CMDLINE(DiagnoseSyncOnValueBasedClasses)) {
4191     if (DiagnoseSyncOnValueBasedClasses == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, valuebasedclasses)) {
4192       LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(valuebasedclasses));
4193     }
4194   }
4195 
4196   return JNI_OK;
4197 }
4198 
4199 jint Arguments::adjust_after_os() {
4200   if (UseNUMA) {
4201     if (UseParallelGC) {
4202       if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
4203          FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
4204       }
4205     }
4206   }
4207   return JNI_OK;
4208 }
4209 
4210 int Arguments::PropertyList_count(SystemProperty* pl) {
4211   int count = 0;
4212   while(pl != NULL) {
4213     count++;
4214     pl = pl->next();
4215   }
< prev index next >