From e0e4024b2e3f6fa6feb3ef42f0f072ffb004f8f7 Mon Sep 17 00:00:00 2001 From: Shih-wei Liao Date: Tue, 8 May 2012 01:04:03 -0700 Subject: Reduce memory usage by halving the materialization threshold. Also, functions declared with __attribute__((always_inline)) MUST be inlined. Note that FunctionInlining uses a heuristic to inline direct function calls to small functions. Function size (computed by # of basic blocks * some factors) < Inlining-threshold will be inlined. But invoke* insn should be inlined by other means anyway. Change-Id: I3f06ead75c78dfc83985458809311b7fa78bc1d7 --- src/compiler_llvm/compilation_unit.cc | 4 ++-- src/compiler_llvm/compilation_unit.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc index e7f77e21ce..1c473921cf 100644 --- a/src/compiler_llvm/compilation_unit.cc +++ b/src/compiler_llvm/compilation_unit.cc @@ -347,8 +347,8 @@ bool CompilationUnit::MaterializeToFile(int output_fd, // Add optimization pass llvm::PassManagerBuilder pm_builder; - pm_builder.Inliner = llvm::createFunctionInliningPass(); - //pm_builder.Inliner = llvm::createAlwaysInlinerPass(); + //pm_builder.Inliner = llvm::createFunctionInliningPass(); + pm_builder.Inliner = llvm::createAlwaysInlinerPass(); //pm_builder.Inliner = llvm::createPartialInliningPass(); pm_builder.OptLevel = 3; pm_builder.DisableSimplifyLibCalls = 1; diff --git a/src/compiler_llvm/compilation_unit.h b/src/compiler_llvm/compilation_unit.h index fb5f4e432e..a464df0b8c 100644 --- a/src/compiler_llvm/compilation_unit.h +++ b/src/compiler_llvm/compilation_unit.h @@ -98,7 +98,7 @@ class CompilationUnit { bool IsMaterializeThresholdReached() const { MutexLock GUARD(cunit_lock_); - return (mem_usage_ > 10000000u); // (threshold: 10 MB) + return (mem_usage_ > 5000000u); // (threshold: 5 MB) } void AddMemUsageApproximation(size_t usage) { -- cgit v1.2.3-59-g8ed1b