提交 f8a9354f 编写于 作者: Z zgu

8187685: NMT: Tracking compiler memory usage of thread's resource area

Summary: Bias compiler thread's resource area to mtCompiler
Reviewed-by: kvn, coleenp
上级 4ed87548
/*
* Copyright (c) 1997, 2010, 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
......@@ -27,6 +27,15 @@
#include "memory/resourceArea.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/thread.inline.hpp"
#include "services/memTracker.hpp"
void ResourceArea::bias_to(MEMFLAGS new_flags) {
if (new_flags != _flags) {
MemTracker::record_arena_free(_flags);
MemTracker::record_new_arena(new_flags);
_flags = new_flags;
}
}
//------------------------------ResourceMark-----------------------------------
debug_only(int ResourceArea::_warned;) // to suppress multiple warnings
......
......@@ -70,7 +70,11 @@ public:
return (char*)Amalloc(size, alloc_failmode);
}
debug_only(int nesting() const { return _nesting; });
// Bias this resource area to specific memory type
// (by default, ResourceArea is tagged as mtThread, per-thread general purpose storage)
void bias_to(MEMFLAGS flags);
debug_only(int nesting() const { return _nesting; })
};
......
......@@ -3242,6 +3242,9 @@ CompilerThread::CompilerThread(CompileQueue* queue, CompilerCounters* counters)
_scanned_nmethod = NULL;
_compiler = NULL;
// Compiler uses resource area for compilation, let's bias it to mtCompiler
resource_area()->bias_to(mtCompiler);
#ifndef PRODUCT
_ideal_graph_printer = NULL;
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册