8187629: NMT: Memory miscounting in compiler (C2)
authorzgu
Mon, 25 Sep 2017 11:56:21 -0400
changeset 47537 5390057a4489
parent 47531 6481d7b6c31e
child 47538 23a529acd4a4
8187629: NMT: Memory miscounting in compiler (C2) Summary: Fixed memory counting in compiler (C2) Reviewed-by: adinn, cjplummer, kvn
src/hotspot/share/memory/resourceArea.hpp
src/hotspot/share/opto/chaitin.cpp
src/hotspot/share/opto/gcm.cpp
src/hotspot/share/opto/matcher.cpp
--- a/src/hotspot/share/memory/resourceArea.hpp	Tue Sep 26 17:06:06 2017 +0200
+++ b/src/hotspot/share/memory/resourceArea.hpp	Mon Sep 25 11:56:21 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, 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
@@ -49,11 +49,11 @@
   debug_only(static int _warned;)       // to suppress multiple warnings
 
 public:
-  ResourceArea() : Arena(mtThread) {
+  ResourceArea(MEMFLAGS flags = mtThread) : Arena(flags) {
     debug_only(_nesting = 0;)
   }
 
-  ResourceArea(size_t init_size) : Arena(mtThread, init_size) {
+  ResourceArea(size_t init_size, MEMFLAGS flags = mtThread) : Arena(flags, init_size) {
     debug_only(_nesting = 0;);
   }
 
--- a/src/hotspot/share/opto/chaitin.cpp	Tue Sep 26 17:06:06 2017 +0200
+++ b/src/hotspot/share/opto/chaitin.cpp	Mon Sep 25 11:56:21 2017 -0400
@@ -348,8 +348,8 @@
   _alternate = 0;
   _matcher._allocation_started = true;
 
-  ResourceArea split_arena;     // Arena for Split local resources
-  ResourceArea live_arena;      // Arena for liveness & IFG info
+  ResourceArea split_arena(mtCompiler);     // Arena for Split local resources
+  ResourceArea live_arena(mtCompiler);      // Arena for liveness & IFG info
   ResourceMark rm(&live_arena);
 
   // Need live-ness for the IFG; need the IFG for coalescing.  If the
--- a/src/hotspot/share/opto/gcm.cpp	Tue Sep 26 17:06:06 2017 +0200
+++ b/src/hotspot/share/opto/gcm.cpp	Mon Sep 25 11:56:21 2017 -0400
@@ -1424,7 +1424,7 @@
   // Enabling the scheduler for register pressure plus finding blocks of size to schedule for it
   // is key to enabling this feature.
   PhaseChaitin regalloc(C->unique(), *this, _matcher, true);
-  ResourceArea live_arena;      // Arena for liveness
+  ResourceArea live_arena(mtCompiler);      // Arena for liveness
   ResourceMark rm_live(&live_arena);
   PhaseLive live(*this, regalloc._lrg_map.names(), &live_arena, true);
   PhaseIFG ifg(&live_arena);
--- a/src/hotspot/share/opto/matcher.cpp	Tue Sep 26 17:06:06 2017 +0200
+++ b/src/hotspot/share/opto/matcher.cpp	Mon Sep 25 11:56:21 2017 -0400
@@ -69,7 +69,7 @@
   _register_save_type(register_save_type),
   _ruleName(ruleName),
   _allocation_started(false),
-  _states_arena(Chunk::medium_size),
+  _states_arena(Chunk::medium_size, mtCompiler),
   _visited(&_states_arena),
   _shared(&_states_arena),
   _dontcare(&_states_arena) {