< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page

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

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

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

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

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



1607     }
1608   }
1609 #endif // _LP64
1610 }
1611 

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











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

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



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

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