summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <mulk@minimulk.mst-plus>2008-09-28 21:04:44 +0200
committerMatthias Benkard <mulk@minimulk.mst-plus>2008-09-28 21:04:44 +0200
commit31eed182d7996b7dbc319bd5f2c474a734492b04 (patch)
treeaba0b84fa6027a0eb95560c0774dabb0f9729213
parentef2536760d6e144f7d903f9f488d3350c2bd2221 (diff)
LLVM compiler: Disable garbage collection for objects embedded in Lisp code.
-rw-r--r--MLKLLVMCompiler.mm19
1 files changed, 19 insertions, 0 deletions
diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm
index 39741ff..4a1095e 100644
--- a/MLKLLVMCompiler.mm
+++ b/MLKLLVMCompiler.mm
@@ -27,6 +27,11 @@
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
+#ifdef __OBJC_GC__
+#import <Foundation/NSGarbageCollector.h>
+#endif
+
+
#include <llvm/Analysis/Verifier.h>
#include <llvm/BasicBlock.h>
#include <llvm/CallingConv.h>
@@ -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),