8187629: NMT: Memory miscounting in compiler (C2)

Fixed memory counting in compiler (C2)

Reviewed-by: adinn, cjplummer, kvn
This commit is contained in:
Zhengyu Gu 2017-09-25 11:56:21 -04:00
parent 6d015ba502
commit 8969bd19e0
4 changed files with 7 additions and 7 deletions

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -49,11 +49,11 @@ class ResourceArea: public Arena {
debug_only(static int _warned;) // to suppress multiple warnings debug_only(static int _warned;) // to suppress multiple warnings
public: public:
ResourceArea() : Arena(mtThread) { ResourceArea(MEMFLAGS flags = mtThread) : Arena(flags) {
debug_only(_nesting = 0;) 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;); debug_only(_nesting = 0;);
} }

View File

@ -348,8 +348,8 @@ void PhaseChaitin::Register_Allocate() {
_alternate = 0; _alternate = 0;
_matcher._allocation_started = true; _matcher._allocation_started = true;
ResourceArea split_arena; // Arena for Split local resources ResourceArea split_arena(mtCompiler); // Arena for Split local resources
ResourceArea live_arena; // Arena for liveness & IFG info ResourceArea live_arena(mtCompiler); // Arena for liveness & IFG info
ResourceMark rm(&live_arena); ResourceMark rm(&live_arena);
// Need live-ness for the IFG; need the IFG for coalescing. If the // Need live-ness for the IFG; need the IFG for coalescing. If the

View File

@ -1424,7 +1424,7 @@ void PhaseCFG::global_code_motion() {
// Enabling the scheduler for register pressure plus finding blocks of size to schedule for it // Enabling the scheduler for register pressure plus finding blocks of size to schedule for it
// is key to enabling this feature. // is key to enabling this feature.
PhaseChaitin regalloc(C->unique(), *this, _matcher, true); 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); ResourceMark rm_live(&live_arena);
PhaseLive live(*this, regalloc._lrg_map.names(), &live_arena, true); PhaseLive live(*this, regalloc._lrg_map.names(), &live_arena, true);
PhaseIFG ifg(&live_arena); PhaseIFG ifg(&live_arena);

View File

@ -69,7 +69,7 @@ Matcher::Matcher()
_register_save_type(register_save_type), _register_save_type(register_save_type),
_ruleName(ruleName), _ruleName(ruleName),
_allocation_started(false), _allocation_started(false),
_states_arena(Chunk::medium_size), _states_arena(Chunk::medium_size, mtCompiler),
_visited(&_states_arena), _visited(&_states_arena),
_shared(&_states_arena), _shared(&_states_arena),
_dontcare(&_states_arena) { _dontcare(&_states_arena) {