From 8a98b46ef2b5673fcdf0a9a466857a5de044dfc5 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 20 Apr 2024 10:47:49 +0300 Subject: add lightening jit --- src/core.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src/core.c') diff --git a/src/core.c b/src/core.c index c50860e..44aa130 100644 --- a/src/core.c +++ b/src/core.c @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -12,16 +13,6 @@ #include #include -/** - * Read whole file into a buffer and return pointer to buffer. - * Possibly kind of silly to have both \p file and \p f. - * Apparently there's no standardized way to get the file name of a - * file pointer. - * - * @param fname Name of file to read. - * @param f File pointer. - * @return Pointer to buffer with file contents. - */ static char *read_file(const char *fname, FILE *f) { fseek(f, 0, SEEK_END); @@ -91,12 +82,14 @@ int run(const char *fname) goto out; } - if (lower_ast(ast)) { - ret = -1; - goto out; - } + lower_ast(ast); +#ifdef JIT + compile(ast); + execute_compilation(); +#else execute(); +#endif out: free((void *)buf); -- cgit v1.2.3