8138917: Back out change for 8130681
authormockner
Tue, 06 Oct 2015 14:27:39 -0400
changeset 33127 0dfbcf8b7d7a
parent 33123 8a67e36f19d3
child 33128 0d1360a45a3b
8138917: Back out change for 8130681 Summary: Change 8130681 has been backed out. Reviewed-by: coleenp, gtriantafill
hotspot/src/share/vm/services/virtualMemoryTracker.cpp
hotspot/test/runtime/NMT/CommitOverlappingRegions.java
--- a/hotspot/src/share/vm/services/virtualMemoryTracker.cpp	Tue Oct 06 08:05:11 2015 +0200
+++ b/hotspot/src/share/vm/services/virtualMemoryTracker.cpp	Tue Oct 06 14:27:39 2015 -0400
@@ -84,10 +84,7 @@
         return _committed_regions.insert_after(committed_rgn, node) != NULL;
       }
     }
-    // If we have reached this point, then we are trying to commit a region that overlaps with some existing committed regions.
-    remove_uncommitted_region(addr, size);
-    add_committed_region(committed_rgn);
-
+    assert(rgn->contain_region(addr, size), "Must cover this region");
     return true;
   } else {
     // New committed region
--- a/hotspot/test/runtime/NMT/CommitOverlappingRegions.java	Tue Oct 06 08:05:11 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2015, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary Test commits of overlapping regions of memory.
- * @key nmt jcmd
- * @library /testlibrary /../../test/lib
- * @modules java.base/sun.misc
- *          java.management
- * @build   CommitOverlappingRegions
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail CommitOverlappingRegions
- */
-
-import jdk.test.lib.*;
-import sun.hotspot.WhiteBox;
-
-public class CommitOverlappingRegions {
-    public static WhiteBox wb = WhiteBox.getWhiteBox();
-    public static void main(String args[]) throws Exception {
-        OutputAnalyzer output;
-        long size = 32 * 1024;
-        long addr;
-
-        String pid = Integer.toString(ProcessTools.getProcessId());
-        ProcessBuilder pb = new ProcessBuilder();
-
-        addr = wb.NMTReserveMemory(8*size);        // [                ]
-        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
-        // Test output before commits
-        output = new OutputAnalyzer(pb.start());
-        output.shouldContain("(reserved=256KB, committed=0KB)");
-
-        // Commit regions 1 and 2, then test output.
-        wb.NMTCommitMemory(addr + 0*size, 3*size); // [       ]
-        wb.NMTCommitMemory(addr + 4*size, 3*size); //           [      ]
-
-        output = new OutputAnalyzer(pb.start());
-        output.shouldContain("(reserved=256KB, committed=192KB)");
-
-        // Commit the final region which overlaps partially with both regions.
-        wb.NMTCommitMemory(addr + 2*size, 3*size); //     [        ]
-
-        output = new OutputAnalyzer(pb.start());
-        output.getOutput();
-        output.shouldContain("(reserved=256KB, committed=224KB)");
-    }
-}