summaryrefslogtreecommitdiff
path: root/MLKLexicalContext-MLKLLVMCompilation.mm
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-09-01 23:39:42 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-09-01 23:39:42 +0200
commita5364817b1cd751832a4634e4afbd67bb668fa2e (patch)
treeaa17dedb58241b6d9f0462762baf11b4f9291127 /MLKLexicalContext-MLKLLVMCompilation.mm
parent73903e25720a373028a2bf269c2aab27385c4692 (diff)
LLVM compiler: Add support for heap allocation of lexical variables.
Diffstat (limited to 'MLKLexicalContext-MLKLLVMCompilation.mm')
-rw-r--r--MLKLexicalContext-MLKLLVMCompilation.mm20
1 files changed, 17 insertions, 3 deletions
diff --git a/MLKLexicalContext-MLKLLVMCompilation.mm b/MLKLexicalContext-MLKLLVMCompilation.mm
index 45208ed..d3a84b3 100644
--- a/MLKLexicalContext-MLKLLVMCompilation.mm
+++ b/MLKLexicalContext-MLKLLVMCompilation.mm
@@ -76,12 +76,26 @@ id MLKDummyUseLLVMLexicalContext = nil;
PointerType::get(PointerType::get(Type::Int8Ty, 0), 0)));
}
--(Instruction *) bindingCellValueForSymbol:(id)name
+-(Instruction *) globalBindingValueForSymbol:(id)name
{
return (new IntToPtrInst (ConstantInt::get(Type::Int64Ty,
- (uint64_t)[self bindingCellForSymbol:name],
+ (uint64_t)[self bindingForSymbol:name],
false),
- PointerType::get(PointerType::get(Type::Int8Ty, 0), 0)));
+ PointerType::get(Type::Int8Ty, 0)));
+}
+
+-(Value *) bindingValueForSymbol:(id)name
+{
+ return (Value *) [[self deepPropertyForVariable:name
+ key:@"LLVM.variable-binding"]
+ pointerValue];
+}
+
+-(void) setBindingValue:(Value *)value forSymbol:(id)name
+{
+ [self setDeepProperty:[NSValue valueWithPointer:value]
+ forVariable:name
+ key:@"LLVM.variable-binding"];
}
-(Value *) valueValueForSymbol:(id)name