changeset 48865:53427ddce0a0

8194934: NMT: Remove MemTracker::get_virtual_memory_xxx_tracker(), create Tracker in place Summary: Create tracker in place to avoid additional locking Reviewed-by: coleenp
author zgu
date Mon, 05 Feb 2018 13:23:26 -0500
parents 42a2dc52a4e9
children b983e6032aa7
files src/hotspot/os/bsd/os_bsd.cpp src/hotspot/os/linux/os_linux.cpp src/hotspot/os/windows/perfMemory_windows.cpp src/hotspot/share/runtime/os.cpp src/hotspot/share/services/memTracker.hpp
diffstat 5 files changed, 8 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/os/bsd/os_bsd.cpp	Mon Feb 05 08:08:01 2018 +0100
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Mon Feb 05 13:23:26 2018 -0500
@@ -2206,7 +2206,7 @@
 
 bool os::release_memory_special(char* base, size_t bytes) {
   if (MemTracker::tracking_level() > NMT_minimal) {
-    Tracker tkr = MemTracker::get_virtual_memory_release_tracker();
+    Tracker tkr(Tracker::release);
     // detaching the SHM segment will also delete it, see reserve_memory_special()
     int rslt = shmdt(base);
     if (rslt == 0) {
--- a/src/hotspot/os/linux/os_linux.cpp	Mon Feb 05 08:08:01 2018 +0100
+++ b/src/hotspot/os/linux/os_linux.cpp	Mon Feb 05 13:23:26 2018 -0500
@@ -3862,7 +3862,7 @@
 bool os::release_memory_special(char* base, size_t bytes) {
   bool res;
   if (MemTracker::tracking_level() > NMT_minimal) {
-    Tracker tkr = MemTracker::get_virtual_memory_release_tracker();
+    Tracker tkr(Tracker::release);
     res = os::Linux::release_memory_special_impl(base, bytes);
     if (res) {
       tkr.record((address)base, bytes);
--- a/src/hotspot/os/windows/perfMemory_windows.cpp	Mon Feb 05 08:08:01 2018 +0100
+++ b/src/hotspot/os/windows/perfMemory_windows.cpp	Mon Feb 05 13:23:26 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, 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
@@ -1840,7 +1840,7 @@
 
   if (MemTracker::tracking_level() > NMT_minimal) {
     // it does not go through os api, the operation has to record from here
-    Tracker tkr = MemTracker::get_virtual_memory_release_tracker();
+    Tracker tkr(Tracker::release);
     remove_file_mapping(addr);
     tkr.record((address)addr, bytes);
   } else {
--- a/src/hotspot/share/runtime/os.cpp	Mon Feb 05 08:08:01 2018 +0100
+++ b/src/hotspot/share/runtime/os.cpp	Mon Feb 05 13:23:26 2018 -0500
@@ -1749,7 +1749,7 @@
 bool os::uncommit_memory(char* addr, size_t bytes) {
   bool res;
   if (MemTracker::tracking_level() > NMT_minimal) {
-    Tracker tkr = MemTracker::get_virtual_memory_uncommit_tracker();
+    Tracker tkr(Tracker::uncommit);
     res = pd_uncommit_memory(addr, bytes);
     if (res) {
       tkr.record((address)addr, bytes);
@@ -1763,7 +1763,7 @@
 bool os::release_memory(char* addr, size_t bytes) {
   bool res;
   if (MemTracker::tracking_level() > NMT_minimal) {
-    Tracker tkr = MemTracker::get_virtual_memory_release_tracker();
+    Tracker tkr(Tracker::release);
     res = pd_release_memory(addr, bytes);
     if (res) {
       tkr.record((address)addr, bytes);
@@ -1800,7 +1800,7 @@
 bool os::unmap_memory(char *addr, size_t bytes) {
   bool result;
   if (MemTracker::tracking_level() > NMT_minimal) {
-    Tracker tkr = MemTracker::get_virtual_memory_release_tracker();
+    Tracker tkr(Tracker::release);
     result = pd_unmap_memory(addr, bytes);
     if (result) {
       tkr.record((address)addr, bytes);
--- a/src/hotspot/share/services/memTracker.hpp	Mon Feb 05 08:08:01 2018 +0100
+++ b/src/hotspot/share/services/memTracker.hpp	Mon Feb 05 13:23:26 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -63,8 +63,6 @@
   static inline void record_virtual_memory_reserve_and_commit(void* addr, size_t size,
     const NativeCallStack& stack, MEMFLAGS flag = mtNone) { }
   static inline void record_virtual_memory_commit(void* addr, size_t size, const NativeCallStack& stack) { }
-  static inline Tracker get_virtual_memory_uncommit_tracker() { return Tracker(); }
-  static inline Tracker get_virtual_memory_release_tracker() { return Tracker(); }
   static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { }
   static inline void record_thread_stack(void* addr, size_t size) { }
   static inline void release_thread_stack(void* addr, size_t size) { }
@@ -227,16 +225,6 @@
     }
   }
 
-  static inline Tracker get_virtual_memory_uncommit_tracker() {
-    assert(tracking_level() >= NMT_summary, "Check by caller");
-    return Tracker(Tracker::uncommit);
-  }
-
-  static inline Tracker get_virtual_memory_release_tracker() {
-    assert(tracking_level() >= NMT_summary, "Check by caller");
-    return Tracker(Tracker::release);
-  }
-
   static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) {
     if (tracking_level() < NMT_summary) return;
     if (addr != NULL) {