summaryrefslogtreecommitdiff
path: root/MLKInterpreter.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-18 01:00:01 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-18 01:22:01 +0200
commita46dd37ba3832c9418c24d4b44f87d72df50585f (patch)
treec1f798f69fde17379658785af5244177554f3fd0 /MLKInterpreter.m
parente3dad17e0d389ebd473ed32d38ae8d3387903c36 (diff)
LOAD: Always compile code when loading it.
Diffstat (limited to 'MLKInterpreter.m')
-rw-r--r--MLKInterpreter.m10
1 files changed, 9 insertions, 1 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m
index 3f91814..540b9b5 100644
--- a/MLKInterpreter.m
+++ b/MLKInterpreter.m
@@ -29,6 +29,7 @@
#import "MLKInterpreter.h"
#import "MLKLexicalContext.h"
#import "MLKLexicalEnvironment.h"
+#import "MLKLLVMCompiler.h"
#import "MLKPackage.h"
#import "MLKReader.h"
#import "MLKRoot.h"
@@ -1242,7 +1243,8 @@
if (code == eofValue)
break;
- if ([code isKindOfClass:[MLKCons class]] && [code cdr])
+ if (MLKInstanceP(code)
+ && [code isKindOfClass:[MLKCons class]] && [code cdr])
formdesc = [NSString stringWithFormat:@"(%@ %@ ...)",
MLKPrintToString([code car]),
MLKPrintToString([[code cdr] car])];
@@ -1254,6 +1256,11 @@
for (i = 0; i < level; i++)
fprintf (stderr, "| ");
fprintf (stderr, "LOAD: %s\n", [formdesc UTF8String]);
+
+#ifdef USE_LLVM
+ expansion = code;
+ result = [MLKLLVMCompiler eval:code];
+#else // !USE_LLVM
expansion = denullify([[MLKInterpreter
eval:code
inLexicalContext:[MLKLexicalContext
@@ -1277,6 +1284,7 @@
withEnvironment:[MLKLexicalEnvironment globalEnvironment]
expandOnly:NO];
//NSLog (@"; LOAD: Top-level form evaluated.");
+#endif //!USE_LLVM
LRELEASE (pool);