From fc68a5a5c6b2b8d9b1a841d45b65701d30b4c612 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Mon, 18 Aug 2008 00:58:25 +0200 Subject: LLVM compiler: Enclose compilation in an autorelease pool. --- MLKLLVMCompiler.mm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 337caf6..1d6d471 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -16,12 +16,14 @@ * along with this program. If not, see . */ +#import "MLKDynamicContext.h" #import "MLKLLVMCompiler.h" #import "MLKPackage.h" #import "globals.h" #import "util.h" #import +#import #import #import @@ -102,6 +104,9 @@ static Constant +(id) compile:(id)object inContext:(MLKLexicalContext *)context { + NSAutoreleasePool *pool; + pool = [[NSAutoreleasePool alloc] init]; + Value *v = NULL; BasicBlock *block; std::vector noargs (0, Type::VoidTy); @@ -114,13 +119,14 @@ static Constant module); id lambdaForm; id (*fn)(); + MLKForm *form = [MLKForm formWithObject:object + inContext:context + forCompiler:self]; block = BasicBlock::Create ("entry", function); builder.SetInsertPoint (block); - v = [self processForm:[MLKForm formWithObject:object - inContext:context - forCompiler:self]]; + v = [self processForm:form]; builder.CreateRet (v); verifyFunction (*function); @@ -131,6 +137,9 @@ static Constant //module->dump(); NSLog (@"%p", fn); + [pool release]; + NSLog (@"Code compiled."); + // Execute. lambdaForm = fn(); -- cgit v1.2.3