summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MLKCompiledClosure.m1
-rw-r--r--MLKLLVMCompiler.h1
-rw-r--r--MLKLLVMCompiler.mm11
3 files changed, 11 insertions, 2 deletions
diff --git a/MLKCompiledClosure.m b/MLKCompiledClosure.m
index 32caf74..9227008 100644
--- a/MLKCompiledClosure.m
+++ b/MLKCompiledClosure.m
@@ -93,6 +93,7 @@
// }
ffi_call (&cif, FFI_FN (_code), &return_value, (void**)argv);
+// return_value = ((id (*)(void *, ...))_code) (_data, argpointers[0], argpointers[1], MLKEndOfArgumentsMarker);
// FIXME: multiple values
return [NSArray arrayWithObject:nullify((id)return_value)];
diff --git a/MLKLLVMCompiler.h b/MLKLLVMCompiler.h
index cdcda0d..44f1b33 100644
--- a/MLKLLVMCompiler.h
+++ b/MLKLLVMCompiler.h
@@ -77,6 +77,7 @@ using namespace llvm;
+(Value *) insertClassLookup:(NSString *)className;
+(void) insertTrace:(NSString *)message;
++(void) insertPointerTrace:(Value *)value;
#endif
@end
diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm
index b3a47d3..39741ff 100644
--- a/MLKLLVMCompiler.mm
+++ b/MLKLLVMCompiler.mm
@@ -164,7 +164,7 @@ static Constant
//module->dump();
//NSLog (@"%p", fn);
- [pool release];
+ LRELEASE (pool);
//NSLog (@"Code compiled.");
#if 1
@@ -537,6 +537,9 @@ static Constant
closureDataCell = builder.Insert ([_context closureDataPointerValueForSymbol:_head]);
closureDataPtr = builder.CreateLoad (closureDataCell);
+ //[_compiler insertTrace:[NSString stringWithFormat:@"Call: %@", MLKPrintToString(_head)]];
+ //[_compiler insertPointerTrace:functionPtr];
+
args.push_back (closureDataPtr);
NSEnumerator *e = [_argumentForms objectEnumerator];
@@ -556,7 +559,11 @@ static Constant
PointerTy);
args.push_back (endmarker);
- //[_compiler insertTrace:[NSString stringWithFormat:@"Function call: %@.", MLKPrintToString(_head)]];
+ // If the pointer output here is different from the one above,
+ // there's some stack smashing going on.
+ //[_compiler insertTrace:[NSString stringWithFormat:@"Now calling: %@.", MLKPrintToString(_head)]];
+ //[_compiler insertPointerTrace:functionPtr];
+
CallInst *call = builder.CreateCall (functionPtr,
args.begin(),
args.end(),