From 31eed182d7996b7dbc319bd5f2c474a734492b04 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 28 Sep 2008 21:04:44 +0200 Subject: LLVM compiler: Disable garbage collection for objects embedded in Lisp code. --- MLKLLVMCompiler.mm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 39741ff..4a1095e 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -27,6 +27,11 @@ #import #import +#ifdef __OBJC_GC__ +#import +#endif + + #include #include #include @@ -834,7 +839,14 @@ static Constant { // FIXME: When to release _quotedData? At the same time the code is // released, probably... + // FIXME: In garbage-collected code, _quotedData will be deleted even + // though it is referenced by compiled code! LRETAIN (_quotedData); +#ifdef __OBJC_GC__ + if (_quotedData && MLKInstanceP (_quotedData)) + [[NSGarbageCollector defaultCollector] disableCollectorForPointer:_quotedData]; +#endif + return builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, (uint64_t)_quotedData, false), @@ -848,7 +860,14 @@ static Constant { // FIXME: When to release _form? At the same time the code is // released, probably... + // FIXME: In garbage-collected code, _form will be deleted even + // though it is referenced by compiled code! LRETAIN (_form); +#ifdef __OBJC_GC__ + if (_form && MLKInstanceP (_form)) + [[NSGarbageCollector defaultCollector] disableCollectorForPointer:_form]; +#endif + return builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty, (uint64_t)_form, false), -- cgit v1.2.3