summaryrefslogtreecommitdiff
path: root/MLKLLVMCompiler.mm
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-25 10:54:18 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-25 10:54:18 +0200
commit76aa8a27f85fdea83da02e04659028b98e76407e (patch)
tree448cd7515096c44368aa2b6e9cc07dcfff3c39f3 /MLKLLVMCompiler.mm
parentb268ec5ec85fd6da735491a8fbc7560037e613b5 (diff)
Dispatch intrinsic functions statically instead of dynamically.
This is a major simplification.
Diffstat (limited to 'MLKLLVMCompiler.mm')
-rw-r--r--MLKLLVMCompiler.mm45
1 files changed, 7 insertions, 38 deletions
diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm
index 5430900..4a672a0 100644
--- a/MLKLLVMCompiler.mm
+++ b/MLKLLVMCompiler.mm
@@ -478,9 +478,6 @@ static Constant
@implementation MLKFunctionCallForm (MLKLLVMCompilation)
-(Value *) reallyProcessForLLVM
{
- static MLKPackage *sys = [MLKPackage findPackage:@"TOILET-SYSTEM"];
-
- BOOL special_dispatch = NO;
Value *functionCell;
Value *functionPtr;
Value *closureDataCell;
@@ -489,44 +486,16 @@ static Constant
if (![_context symbolNamesFunction:_head])
{
- if (_head && [_head homePackage] == sys)
- {
- special_dispatch = YES;
- }
- else
- {
- NSLog (@"Compiler: Don't know function %@", MLKPrintToString(_head));
- // XXX Issue a style warning.
- }
+ NSLog (@"Compiler: Don't know function %@", MLKPrintToString(_head));
+ // XXX Issue a style warning.
}
- if (!special_dispatch)
- {
- functionCell = builder.Insert ([_context functionCellValueForSymbol:_head]);
- functionPtr = builder.CreateLoad (functionCell);
- closureDataCell = builder.Insert ([_context closureDataPointerValueForSymbol:_head]);
- closureDataPtr = builder.CreateLoad (closureDataCell);
+ functionCell = builder.Insert ([_context functionCellValueForSymbol:_head]);
+ functionPtr = builder.CreateLoad (functionCell);
+ closureDataCell = builder.Insert ([_context closureDataPointerValueForSymbol:_head]);
+ closureDataPtr = builder.CreateLoad (closureDataCell);
- args.push_back (closureDataPtr);
- }
- else
- {
- std::vector<const Type *> argtypes (1, PointerTy);
- functionPtr = builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty,
- (uint64_t)MLKDispatchRootFunction,
- false),
- PointerType::get (FunctionType::get (PointerTy,
- argtypes,
- true),
- 0));
- LRETAIN (_head); // FIXME: release sometime? On the other hand,
- // these symbols will probably never be
- // deallocated anyway.
- args.push_back (builder.CreateIntToPtr (ConstantInt::get(Type::Int64Ty,
- (uint64_t)_head,
- false),
- PointerTy));
- }
+ args.push_back (closureDataPtr);
NSEnumerator *e = [_argumentForms objectEnumerator];
MLKForm *form;