Merge
authorccheung
Thu, 31 Aug 2017 17:06:10 +0000
changeset 47104 6bdc0c9c44af
parent 47103 a993ec29ec75 (current diff)
parent 47102 2f0905582ea4 (diff)
child 47105 d8bd7f7d5147
child 47106 bed18a111b90
Merge
hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Thu Aug 31 17:06:10 2017 +0000
@@ -1437,12 +1437,7 @@
 }
 
 void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
-  st->print("CPU:");
-  st->print("total %d", os::processor_count());
-  // It's not safe to query number of active processors after crash.
-  // st->print("(active %d)", os::active_processor_count());
-  st->print(" %s", VM_Version::features());
-  st->cr();
+  // Nothing to do beyond what os::print_cpu_info() does.
 }
 
 static void print_signal_handler(outputStream* st, int sig,
--- a/hotspot/src/share/vm/code/nmethod.cpp	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Thu Aug 31 17:06:10 2017 +0000
@@ -1220,7 +1220,7 @@
     // for stack scanning.
     if (state == not_entrant) {
       mark_as_seen_on_stack();
-      OrderAccess::storestore();
+      OrderAccess::storestore(); // _stack_traversal_mark and _state
     }
 
     // Change state
--- a/hotspot/src/share/vm/code/nmethod.hpp	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Thu Aug 31 17:06:10 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,7 +136,7 @@
   // stack.  An not_entrant method can be removed when there are no
   // more activations, i.e., when the _stack_traversal_mark is less than
   // current sweep traversal index.
-  volatile jlong _stack_traversal_mark;
+  volatile long _stack_traversal_mark;
 
   // The _hotness_counter indicates the hotness of a method. The higher
   // the value the hotter the method. The hotness counter of a nmethod is
@@ -396,8 +396,8 @@
  public:
 
   // Sweeper support
-  jlong  stack_traversal_mark()                    { return OrderAccess::load_acquire(&_stack_traversal_mark); }
-  void  set_stack_traversal_mark(jlong l)          { OrderAccess::release_store(&_stack_traversal_mark, l); }
+  long  stack_traversal_mark()                    { return _stack_traversal_mark; }
+  void  set_stack_traversal_mark(long l)          { _stack_traversal_mark = l; }
 
   // implicit exceptions support
   address continuation_for_implicit_exception(address pc);
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Aug 31 17:06:10 2017 +0000
@@ -379,6 +379,9 @@
   { "MaxGCMinorPauseMillis",        JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
   { "UseConcMarkSweepGC",           JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
   { "MonitorInUseLists",            JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() },
+  { "MaxRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
+  { "MinRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
+  { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
 
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
@@ -2067,20 +2070,33 @@
     }
   }
 
+  // Convert deprecated flags
+  if (FLAG_IS_DEFAULT(MaxRAMPercentage) &&
+      !FLAG_IS_DEFAULT(MaxRAMFraction))
+    MaxRAMPercentage = 100.0 / MaxRAMFraction;
+
+  if (FLAG_IS_DEFAULT(MinRAMPercentage) &&
+      !FLAG_IS_DEFAULT(MinRAMFraction))
+    MinRAMPercentage = 100.0 / MinRAMFraction;
+
+  if (FLAG_IS_DEFAULT(InitialRAMPercentage) &&
+      !FLAG_IS_DEFAULT(InitialRAMFraction))
+    InitialRAMPercentage = 100.0 / InitialRAMFraction;
+
   // If the maximum heap size has not been set with -Xmx,
   // then set it as fraction of the size of physical memory,
   // respecting the maximum and minimum sizes of the heap.
   if (FLAG_IS_DEFAULT(MaxHeapSize)) {
-    julong reasonable_max = phys_mem / MaxRAMFraction;
-
-    if (phys_mem <= MaxHeapSize * MinRAMFraction) {
+    julong reasonable_max = (julong)((phys_mem * MaxRAMPercentage) / 100);
+    if (phys_mem <= (julong)((MaxHeapSize * MinRAMPercentage) / 100)) {
       // Small physical memory, so use a minimum fraction of it for the heap
-      reasonable_max = phys_mem / MinRAMFraction;
+      reasonable_max = (julong)((phys_mem * MinRAMPercentage) / 100);
     } else {
       // Not-small physical memory, so require a heap at least
       // as large as MaxHeapSize
       reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize);
     }
+
     if (!FLAG_IS_DEFAULT(ErgoHeapSizeLimit) && ErgoHeapSizeLimit != 0) {
       // Limit the heap size to ErgoHeapSizeLimit
       reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit);
@@ -2133,7 +2149,7 @@
     reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum);
 
     if (InitialHeapSize == 0) {
-      julong reasonable_initial = phys_mem / InitialRAMFraction;
+      julong reasonable_initial = (julong)((phys_mem * InitialRAMPercentage) / 100);
 
       reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)min_heap_size());
       reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
--- a/hotspot/src/share/vm/runtime/globals.hpp	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Thu Aug 31 17:06:10 2017 +0000
@@ -2037,7 +2037,7 @@
                                                                             \
   product(size_t, ErgoHeapSizeLimit, 0,                                     \
           "Maximum ergonomically set heap size (in bytes); zero means use " \
-          "MaxRAM / MaxRAMFraction")                                        \
+          "MaxRAM * MaxRAMPercentage / 100")                                \
           range(0, max_uintx)                                               \
                                                                             \
   experimental(bool, UseCGroupMemoryLimitForHeap, false,                    \
@@ -2046,18 +2046,34 @@
                                                                             \
   product(uintx, MaxRAMFraction, 4,                                         \
           "Maximum fraction (1/n) of real memory used for maximum heap "    \
-          "size")                                                           \
+          "size. "                                                          \
+          "Deprecated, use MaxRAMPercentage instead")                       \
           range(1, max_uintx)                                               \
                                                                             \
   product(uintx, MinRAMFraction, 2,                                         \
           "Minimum fraction (1/n) of real memory used for maximum heap "    \
-          "size on systems with small physical memory size")                \
+          "size on systems with small physical memory size. "               \
+          "Deprecated, use MinRAMPercentage instead")                       \
           range(1, max_uintx)                                               \
                                                                             \
   product(uintx, InitialRAMFraction, 64,                                    \
-          "Fraction (1/n) of real memory used for initial heap size")       \
+          "Fraction (1/n) of real memory used for initial heap size. "      \
+          "Deprecated, use InitialRAMPercentage instead")                   \
           range(1, max_uintx)                                               \
                                                                             \
+  product(double, MaxRAMPercentage, 25.0,                                   \
+          "Maximum percentage of real memory used for maximum heap size")   \
+          range(0.0, 100.0)                                                 \
+                                                                            \
+  product(double, MinRAMPercentage, 50.0,                                   \
+          "Minimum percentage of real memory used for maximum heap"         \
+          "size on systems with small physical memory size")                \
+          range(0.0, 100.0)                                                 \
+                                                                            \
+  product(double, InitialRAMPercentage, 1.5625,                             \
+          "Percentage of real memory used for initial heap size")           \
+          range(0.0, 100.0)                                                 \
+                                                                            \
   develop(uintx, MaxVirtMemFraction, 2,                                     \
           "Maximum fraction (1/n) of virtual memory used for ergonomically "\
           "determining maximum heap size")                                  \
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Thu Aug 31 17:06:10 2017 +0000
@@ -53,7 +53,7 @@
  public:
   int traversal;
   int compile_id;
-  jlong traversal_mark;
+  long traversal_mark;
   int state;
   const char* kind;
   address vep;
@@ -62,7 +62,7 @@
 
   void print() {
       tty->print_cr("traversal = %d compile_id = %d %s uep = " PTR_FORMAT " vep = "
-                    PTR_FORMAT " state = %d traversal_mark "JLONG_FORMAT" line = %d",
+                    PTR_FORMAT " state = %d traversal_mark %ld line = %d",
                     traversal,
                     compile_id,
                     kind == NULL ? "" : kind,
@@ -629,6 +629,7 @@
   } else if (cm->is_not_entrant()) {
     // If there are no current activations of this method on the
     // stack we can safely convert it to a zombie method
+    OrderAccess::loadload(); // _stack_traversal_mark and _state
     if (cm->can_convert_to_zombie()) {
       // Clear ICStubs to prevent back patching stubs of zombie or flushed
       // nmethods during the next safepoint (see ICStub::finalize).
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Aug 31 17:06:10 2017 +0000
@@ -841,7 +841,7 @@
   nonstatic_field(nmethod,                     _verified_entry_point,                         address)                               \
   nonstatic_field(nmethod,                     _osr_entry_point,                              address)                               \
   volatile_nonstatic_field(nmethod,            _lock_count,                                   jint)                                  \
-  volatile_nonstatic_field(nmethod,            _stack_traversal_mark,                         jlong)                                 \
+  volatile_nonstatic_field(nmethod,            _stack_traversal_mark,                         long)                                  \
   nonstatic_field(nmethod,                     _compile_id,                                   int)                                   \
   nonstatic_field(nmethod,                     _comp_level,                                   int)                                   \
                                                                                                                                      \
--- a/hotspot/test/Makefile	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/test/Makefile	Thu Aug 31 17:06:10 2017 +0000
@@ -70,8 +70,8 @@
   CONCURRENCY := 12
 endif
 
-# Make sure MaxRAMFraction is high enough to not cause OOM or swapping since we may end up with a lot of JVM's
-JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMFraction=$(shell expr $(CONCURRENCY) \* 4)
+# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since we may end up with a lot of JVM's
+JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(shell expr 25 / $(CONCURRENCY))
 
 # Include the common base file with most of the logic
 include ../../test/TestCommon.gmk
--- a/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java	Thu Aug 31 17:06:10 2017 +0000
@@ -36,10 +36,10 @@
 public class FlagWithInvalidValue {
   public static void main(String[] args) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:MaxRAMFraction=v", "-version");
+        "-XX:MaxRAMPercentage=v", "-version");
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Improperly specified VM option 'MaxRAMFraction=v'");
+    output.shouldContain("Improperly specified VM option 'MaxRAMPercentage=v'");
     output.shouldHaveExitValue(1);
   }
 }
--- a/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java	Thu Aug 31 17:06:10 2017 +0000
@@ -36,17 +36,17 @@
 public class NonBooleanFlagWithInvalidBooleanPrefix {
   public static void main(String[] args) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:-MaxRAMFraction=16", "-version");
+        "-XX:-MaxRAMPercentage=1", "-version");
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMFraction=16'");
+    output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMPercentage=1'");
     output.shouldHaveExitValue(1);
 
     pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:+MaxRAMFraction=16", "-version");
+        "-XX:+MaxRAMPercentage=1", "-version");
 
     output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMFraction=16'");
+    output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMPercentage=1'");
     output.shouldHaveExitValue(1);
 
   }
--- a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java	Mon Aug 28 15:34:04 2017 -0700
+++ b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java	Thu Aug 31 17:06:10 2017 +0000
@@ -43,6 +43,9 @@
         {"MaxGCMinorPauseMillis",     "1032"},
         {"MustCallLoadClassInternal", "false"},
         {"UnsyncloadClass",           "false"},
+        {"MaxRAMFraction",            "8"},
+        {"MinRAMFraction",            "2"},
+        {"InitialRAMFraction",        "64"},
 
         // deprecated alias flags (see also aliased_jvm_flags):
         {"DefaultMaxRAMFraction", "4"},