From ba938cbb8d73a0dcf151dfaec4662496da6afdbf Mon Sep 17 00:00:00 2001 From: buzbee Date: Fri, 3 Feb 2012 14:47:55 -0800 Subject: Make the compiler threadsafe The compiler inherited a simple memory management scheme that involved malloc'ng a clump of memory, allocating out of that clump for each unit of compilation, and then resetting after the compilation was complete. Simple & fast, but built with the expectation of a single compiler worker thread. This change moves the memory allocation arena into the CompilationUnit structure, and makes it private for each method compilation. Unlike the old scheme, allocated memory is returned to the system following completion (whereas before it was reused for the next compilation). As of this CL, each compilation is completely independent. The changes involved were mostly mechanical to pass around the cUnit pointer to anything which might need to allocate, but the accretion of crud has moved me much closer to the point that all of this stuff gets ripped out and replaced. Change-Id: I19dda0a7fb5aa228f6baee7ae5293fdd174c8337 --- src/compiler/codegen/arm/ArmRallocUtil.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/compiler/codegen/arm/ArmRallocUtil.cc') diff --git a/src/compiler/codegen/arm/ArmRallocUtil.cc b/src/compiler/codegen/arm/ArmRallocUtil.cc index d5400076c1..1986b0f5ce 100644 --- a/src/compiler/codegen/arm/ArmRallocUtil.cc +++ b/src/compiler/codegen/arm/ArmRallocUtil.cc @@ -132,9 +132,9 @@ extern void oatDoPromotion(CompilationUnit* cUnit) * reg. */ RefCounts *coreRegs = (RefCounts *) - oatNew(sizeof(RefCounts) * numRegs, true, kAllocRegAlloc); + oatNew(cUnit, sizeof(RefCounts) * numRegs, true, kAllocRegAlloc); RefCounts *fpRegs = (RefCounts *) - oatNew(sizeof(RefCounts) * numRegs, true, kAllocRegAlloc); + oatNew(cUnit, sizeof(RefCounts) * numRegs, true, kAllocRegAlloc); for (int i = 0; i < numRegs; i++) { coreRegs[i].sReg = fpRegs[i].sReg = i; } -- cgit v1.2.3-59-g8ed1b