Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: src/IceCfg.cpp

Issue 1746613002: Subzero: Reduce copying of Liveness bitvectors. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix memory over-allocation Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfg.cpp
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 5c51ae6d3893316efe28aff8793de937b902931b..5e5957e866e4429a9aa100c6c314bf63b01132d5 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -1076,6 +1076,14 @@ void Cfg::emitIAS() {
emitJumpTables();
}
+size_t Cfg::getTotalMemoryMB() {
+ constexpr size_t OneMB = 1024 * 1024;
+ using ArbitraryType = int;
+ // CfgLocalAllocator draws from the same memory pool regardless of allocated
+ // object type, so pick an arbitrary type for the template parameter.
+ return CfgLocalAllocator<ArbitraryType>().current()->getTotalMemory() / OneMB;
+}
+
// Dumps the IR with an optional introductory message.
void Cfg::dump(const IceString &Message) {
if (!BuildDefs::dump())
@@ -1087,10 +1095,7 @@ void Cfg::dump(const IceString &Message) {
if (!Message.empty())
Str << "================ " << Message << " ================\n";
if (isVerbose(IceV_Mem)) {
- constexpr size_t OneMB = 1024 * 1024;
- Str << "Memory size = "
- << (CfgLocalAllocator<int>().current()->getTotalMemory() / OneMB)
- << " MB\n";
+ Str << "Memory size = " << getTotalMemoryMB() << " MB\n";
}
setCurrentNode(getEntryNode());
// Print function name+args
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698