diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-18 00:58:25 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-18 01:21:51 +0200 |
commit | fc68a5a5c6b2b8d9b1a841d45b65701d30b4c612 (patch) | |
tree | 1a4991fbb27750901effb5cd87da0cb6682e6268 | |
parent | eade591251f3f3deaa3502d73b6803206fc69d2d (diff) |
LLVM compiler: Enclose compilation in an autorelease pool.
-rw-r--r-- | MLKLLVMCompiler.mm | 15 |
1 files 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 <http://www.gnu.org/licenses/>. */ +#import "MLKDynamicContext.h" #import "MLKLLVMCompiler.h" #import "MLKPackage.h" #import "globals.h" #import "util.h" #import <Foundation/NSArray.h> +#import <Foundation/NSAutoreleasePool.h> #import <Foundation/NSEnumerator.h> #import <Foundation/NSString.h> @@ -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<const Type*> 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(); |