8022865: [TESTBUG] Compressed Oops testing needs to be revised

Tue, 08 Dec 2015 14:23:56 +0000

author
dbuck
date
Tue, 08 Dec 2015 14:23:56 +0000
changeset 8188
92a6cfbf2d94
parent 8187
3ad3f93fe3d2
child 8190
a045a14d1c81

8022865: [TESTBUG] Compressed Oops testing needs to be revised
Summary: Rewrote compressed oops tests
Reviewed-by: kvn, coleenp, mseledtsov

src/share/vm/memory/universe.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/universe.hpp file | annotate | diff | comparison | revisions
test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/memory/universe.cpp	Mon Dec 07 13:25:13 2015 +0100
     1.2 +++ b/src/share/vm/memory/universe.cpp	Tue Dec 08 14:23:56 2015 +0000
     1.3 @@ -847,12 +847,6 @@
     1.4      // See needs_explicit_null_check.
     1.5      // Only set the heap base for compressed oops because it indicates
     1.6      // compressed oops for pstack code.
     1.7 -    bool verbose = PrintCompressedOopsMode || (PrintMiscellaneous && Verbose);
     1.8 -    if (verbose) {
     1.9 -      tty->cr();
    1.10 -      tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
    1.11 -                 Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M);
    1.12 -    }
    1.13      if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax)) {
    1.14        // Can't reserve heap below 32Gb.
    1.15        // keep the Universe::narrow_oop_base() set in Universe::reserve_heap()
    1.16 @@ -862,16 +856,8 @@
    1.17        // are decoded so that NULL is preserved, so this page will not be accessed.
    1.18        Universe::set_narrow_oop_use_implicit_null_checks(false);
    1.19  #endif
    1.20 -      if (verbose) {
    1.21 -        tty->print(", %s: "PTR_FORMAT,
    1.22 -            narrow_oop_mode_to_string(HeapBasedNarrowOop),
    1.23 -            Universe::narrow_oop_base());
    1.24 -      }
    1.25      } else {
    1.26        Universe::set_narrow_oop_base(0);
    1.27 -      if (verbose) {
    1.28 -        tty->print(", %s", narrow_oop_mode_to_string(ZeroBasedNarrowOop));
    1.29 -      }
    1.30  #ifdef _WIN64
    1.31        if (!Universe::narrow_oop_use_implicit_null_checks()) {
    1.32          // Don't need guard page for implicit checks in indexed addressing
    1.33 @@ -884,17 +870,14 @@
    1.34          Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
    1.35        } else {
    1.36          Universe::set_narrow_oop_shift(0);
    1.37 -        if (verbose) {
    1.38 -          tty->print(", %s", narrow_oop_mode_to_string(UnscaledNarrowOop));
    1.39 -        }
    1.40        }
    1.41      }
    1.42  
    1.43 -    if (verbose) {
    1.44 -      tty->cr();
    1.45 -      tty->cr();
    1.46 +    Universe::set_narrow_ptrs_base(Universe::narrow_oop_base());
    1.47 +
    1.48 +    if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
    1.49 +      Universe::print_compressed_oops_mode();
    1.50      }
    1.51 -    Universe::set_narrow_ptrs_base(Universe::narrow_oop_base());
    1.52    }
    1.53    // Universe::narrow_oop_base() is one page below the heap.
    1.54    assert((intptr_t)Universe::narrow_oop_base() <= (intptr_t)(Universe::heap()->base() -
    1.55 @@ -915,6 +898,24 @@
    1.56    return JNI_OK;
    1.57  }
    1.58  
    1.59 +void Universe::print_compressed_oops_mode() {
    1.60 +  tty->cr();
    1.61 +  tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
    1.62 +              Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M);
    1.63 +
    1.64 +  tty->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode()));
    1.65 +
    1.66 +  if (Universe::narrow_oop_base() != 0) {
    1.67 +    tty->print(":" PTR_FORMAT, Universe::narrow_oop_base());
    1.68 +  }
    1.69 +
    1.70 +  if (Universe::narrow_oop_shift() != 0) {
    1.71 +    tty->print(", Oop shift amount: %d", Universe::narrow_oop_shift());
    1.72 +  }
    1.73 +
    1.74 +  tty->cr();
    1.75 +  tty->cr();
    1.76 +}
    1.77  
    1.78  // Reserve the Java heap, which is now the same for all GCs.
    1.79  ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) {
    1.80 @@ -984,11 +985,11 @@
    1.81  const char* Universe::narrow_oop_mode_to_string(Universe::NARROW_OOP_MODE mode) {
    1.82    switch (mode) {
    1.83      case UnscaledNarrowOop:
    1.84 -      return "32-bits Oops";
    1.85 +      return "32-bit";
    1.86      case ZeroBasedNarrowOop:
    1.87 -      return "zero based Compressed Oops";
    1.88 +      return "Zero based";
    1.89      case HeapBasedNarrowOop:
    1.90 -      return "Compressed Oops with base";
    1.91 +      return "Non-zero based";
    1.92    }
    1.93  
    1.94    ShouldNotReachHere();
     2.1 --- a/src/share/vm/memory/universe.hpp	Mon Dec 07 13:25:13 2015 +0100
     2.2 +++ b/src/share/vm/memory/universe.hpp	Tue Dec 08 14:23:56 2015 +0000
     2.3 @@ -376,6 +376,8 @@
     2.4    static void     set_narrow_ptrs_base(address a)         { _narrow_ptrs_base = a; }
     2.5    static address  narrow_ptrs_base()                      { return _narrow_ptrs_base; }
     2.6  
     2.7 +  static void     print_compressed_oops_mode();
     2.8 +
     2.9    // this is set in vm_version on sparc (and then reset in universe afaict)
    2.10    static void     set_narrow_oop_shift(int shift)         {
    2.11      _narrow_oop._shift   = shift;
     3.1 --- a/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java	Mon Dec 07 13:25:13 2015 +0100
     3.2 +++ b/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java	Tue Dec 08 14:23:56 2015 +0000
     3.3 @@ -74,11 +74,12 @@
     3.4     * @param expectedString String that buffer should contain
     3.5     * @throws RuntimeException If the string was not found
     3.6     */
     3.7 -  public void shouldContain(String expectedString) {
     3.8 +  public OutputAnalyzer shouldContain(String expectedString) {
     3.9      if (!stdout.contains(expectedString) && !stderr.contains(expectedString)) {
    3.10          reportDiagnosticSummary();
    3.11          throw new RuntimeException("'" + expectedString + "' missing from stdout/stderr \n");
    3.12      }
    3.13 +    return this;
    3.14    }
    3.15  
    3.16    /**
    3.17 @@ -87,11 +88,12 @@
    3.18     * @param expectedString String that buffer should contain
    3.19     * @throws RuntimeException If the string was not found
    3.20     */
    3.21 -  public void stdoutShouldContain(String expectedString) {
    3.22 +  public OutputAnalyzer stdoutShouldContain(String expectedString) {
    3.23      if (!stdout.contains(expectedString)) {
    3.24          reportDiagnosticSummary();
    3.25          throw new RuntimeException("'" + expectedString + "' missing from stdout \n");
    3.26      }
    3.27 +    return this;
    3.28    }
    3.29  
    3.30    /**
    3.31 @@ -100,11 +102,12 @@
    3.32     * @param expectedString String that buffer should contain
    3.33     * @throws RuntimeException If the string was not found
    3.34     */
    3.35 -  public void stderrShouldContain(String expectedString) {
    3.36 +  public OutputAnalyzer stderrShouldContain(String expectedString) {
    3.37      if (!stderr.contains(expectedString)) {
    3.38          reportDiagnosticSummary();
    3.39          throw new RuntimeException("'" + expectedString + "' missing from stderr \n");
    3.40      }
    3.41 +    return this;
    3.42    }
    3.43  
    3.44    /**
    3.45 @@ -113,7 +116,7 @@
    3.46     * @param expectedString String that the buffer should not contain
    3.47     * @throws RuntimeException If the string was found
    3.48     */
    3.49 -  public void shouldNotContain(String notExpectedString) {
    3.50 +  public OutputAnalyzer shouldNotContain(String notExpectedString) {
    3.51      if (stdout.contains(notExpectedString)) {
    3.52          reportDiagnosticSummary();
    3.53          throw new RuntimeException("'" + notExpectedString + "' found in stdout \n");
    3.54 @@ -122,6 +125,7 @@
    3.55          reportDiagnosticSummary();
    3.56          throw new RuntimeException("'" + notExpectedString + "' found in stderr \n");
    3.57      }
    3.58 +    return this;
    3.59    }
    3.60  
    3.61    /**
    3.62 @@ -130,11 +134,12 @@
    3.63     * @param expectedString String that the buffer should not contain
    3.64     * @throws RuntimeException If the string was found
    3.65     */
    3.66 -  public void stdoutShouldNotContain(String notExpectedString) {
    3.67 +  public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) {
    3.68      if (stdout.contains(notExpectedString)) {
    3.69          reportDiagnosticSummary();
    3.70          throw new RuntimeException("'" + notExpectedString + "' found in stdout \n");
    3.71      }
    3.72 +    return this;
    3.73    }
    3.74  
    3.75    /**
    3.76 @@ -143,11 +148,12 @@
    3.77     * @param expectedString String that the buffer should not contain
    3.78     * @throws RuntimeException If the string was found
    3.79     */
    3.80 -  public void stderrShouldNotContain(String notExpectedString) {
    3.81 +  public OutputAnalyzer stderrShouldNotContain(String notExpectedString) {
    3.82      if (stderr.contains(notExpectedString)) {
    3.83          reportDiagnosticSummary();
    3.84          throw new RuntimeException("'" + notExpectedString + "' found in stderr \n");
    3.85      }
    3.86 +    return this;
    3.87    }
    3.88  
    3.89    /**
    3.90 @@ -157,7 +163,7 @@
    3.91     * @param pattern
    3.92     * @throws RuntimeException If the pattern was not found
    3.93     */
    3.94 -  public void shouldMatch(String pattern) {
    3.95 +  public OutputAnalyzer shouldMatch(String pattern) {
    3.96        Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
    3.97        Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
    3.98        if (!stdoutMatcher.find() && !stderrMatcher.find()) {
    3.99 @@ -165,6 +171,7 @@
   3.100            throw new RuntimeException("'" + pattern
   3.101                  + "' missing from stdout/stderr \n");
   3.102        }
   3.103 +      return this;
   3.104    }
   3.105  
   3.106    /**
   3.107 @@ -174,13 +181,14 @@
   3.108     * @param pattern
   3.109     * @throws RuntimeException If the pattern was not found
   3.110     */
   3.111 -  public void stdoutShouldMatch(String pattern) {
   3.112 +  public OutputAnalyzer stdoutShouldMatch(String pattern) {
   3.113        Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
   3.114        if (!matcher.find()) {
   3.115            reportDiagnosticSummary();
   3.116            throw new RuntimeException("'" + pattern
   3.117                  + "' missing from stdout \n");
   3.118        }
   3.119 +      return this;
   3.120    }
   3.121  
   3.122    /**
   3.123 @@ -190,13 +198,14 @@
   3.124     * @param pattern
   3.125     * @throws RuntimeException If the pattern was not found
   3.126     */
   3.127 -  public void stderrShouldMatch(String pattern) {
   3.128 +  public OutputAnalyzer stderrShouldMatch(String pattern) {
   3.129        Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
   3.130        if (!matcher.find()) {
   3.131            reportDiagnosticSummary();
   3.132            throw new RuntimeException("'" + pattern
   3.133                  + "' missing from stderr \n");
   3.134        }
   3.135 +      return this;
   3.136    }
   3.137  
   3.138    /**
   3.139 @@ -206,7 +215,7 @@
   3.140     * @param pattern
   3.141     * @throws RuntimeException If the pattern was found
   3.142     */
   3.143 -  public void shouldNotMatch(String pattern) {
   3.144 +  public OutputAnalyzer shouldNotMatch(String pattern) {
   3.145        Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
   3.146        if (matcher.find()) {
   3.147            reportDiagnosticSummary();
   3.148 @@ -219,6 +228,7 @@
   3.149            throw new RuntimeException("'" + pattern
   3.150                    + "' found in stderr: '" + matcher.group() + "' \n");
   3.151        }
   3.152 +      return this;
   3.153    }
   3.154  
   3.155    /**
   3.156 @@ -228,13 +238,14 @@
   3.157     * @param pattern
   3.158     * @throws RuntimeException If the pattern was found
   3.159     */
   3.160 -  public void stdoutShouldNotMatch(String pattern) {
   3.161 +  public OutputAnalyzer stdoutShouldNotMatch(String pattern) {
   3.162        Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
   3.163        if (matcher.find()) {
   3.164            reportDiagnosticSummary();
   3.165            throw new RuntimeException("'" + pattern
   3.166                    + "' found in stdout \n");
   3.167        }
   3.168 +      return this;
   3.169    }
   3.170  
   3.171    /**
   3.172 @@ -244,13 +255,14 @@
   3.173     * @param pattern
   3.174     * @throws RuntimeException If the pattern was found
   3.175     */
   3.176 -  public void stderrShouldNotMatch(String pattern) {
   3.177 +  public OutputAnalyzer stderrShouldNotMatch(String pattern) {
   3.178        Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
   3.179        if (matcher.find()) {
   3.180            reportDiagnosticSummary();
   3.181            throw new RuntimeException("'" + pattern
   3.182                    + "' found in stderr \n");
   3.183        }
   3.184 +      return this;
   3.185    }
   3.186  
   3.187    /**
   3.188 @@ -290,12 +302,13 @@
   3.189     * @param expectedExitValue Expected exit value from process
   3.190     * @throws RuntimeException If the exit value from the process did not match the expected value
   3.191     */
   3.192 -  public void shouldHaveExitValue(int expectedExitValue) {
   3.193 +  public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) {
   3.194        if (getExitValue() != expectedExitValue) {
   3.195            reportDiagnosticSummary();
   3.196            throw new RuntimeException("Expected to get exit value of ["
   3.197                    + expectedExitValue + "]\n");
   3.198        }
   3.199 +      return this;
   3.200    }
   3.201  
   3.202  

mercurial