on master help sign in
New RTS in place
commitf95900845d2d7478ac6e436ad8b7d5129118ba25 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateThu 13 Sep 2012, 22:32 (14 years ago) parent6b46ffc
7 files changed+15−15
rts/idris_gc.c+4−4 rts/idris_main.c+1−1 rts/idris_rts.c+3−3 rts/idris_rts.h+1−1 src/IRTS/CodegenC.hs+1−1 src/IRTS/Compiler.hs+1−1 src/Idris/REPL.hs+4−4
rts/idris_gc.c+4−4
@@ -55,9 +55,9 @@ void cheney(VM *vm) {
5555 case CON:
5656 argptr = (VAL*)(heap_item->info.c.args);
5757 for(i = 0; i < heap_item->info.c.arity; ++i) {
58− printf("Copying %d %p\n", heap_item->info.c.tag, *argptr);
58+ // printf("Copying %d %p\n", heap_item->info.c.tag, *argptr);
5959 VAL newptr = copy(vm, *argptr);
60− printf("Got %p\t\t%p %p\n", newptr, scan, vm->heap_next);
60+ // printf("Got %p\t\t%p %p\n", newptr, scan, vm->heap_next);
6161 *argptr = newptr;
6262 argptr++;
6363 }
@@ -69,7 +69,7 @@ void cheney(VM *vm) {
6969}
7070
7171void gc(VM* vm) {
72− printf("Collecting\n");
72+ // printf("Collecting\n");
7373
7474 char* newheap = malloc(vm -> heap_size);
7575 char* oldheap = vm -> heap;
@@ -99,7 +99,7 @@ void gc(VM* vm) {
9999 }
100100 vm->oldheap = oldheap;
101101
102− gcInfo(vm, 0);
102+ // gcInfo(vm, 0);
103103}
104104
105105void gcInfo(VM* vm, int doGC) {
rts/idris_main.c+1−1
@@ -1,5 +1,5 @@
11int main(int argc, char* argv[]) {
2− VM* vm = init_vm(4096000, 20480); // 1024000);
2+ VM* vm = init_vm(4096000, 512000); // 1024000);
33 _idris__123_runMain0_125_(vm, NULL);
44 //_idris_main(vm, NULL);
55#ifdef IDRIS_TRACE
rts/idris_rts.c+3−3
@@ -100,7 +100,7 @@ VAL MKCON(VM* vm, VAL cl, int tag, int arity, ...) {
100100 cl -> info.c.tag = tag;
101101 cl -> info.c.arity = arity;
102102 VAL* argptr = (VAL*)(cl -> info.c.args);
103− printf("... %p %p\n", cl, argptr);
103+ // printf("... %p %p\n", cl, argptr);
104104
105105 for (i = 0; i < arity; ++i) {
106106 VAL v = va_arg(args, VAL);
@@ -146,7 +146,7 @@ void dumpVal(VAL v) {
146146 if (v==NULL) return;
147147 int i;
148148 if (ISINT(v)) {
149− printf("%ld ", GETINT(v));
149+ printf("%d ", (int)(GETINT(v)));
150150 return;
151151 }
152152 switch(v->ty) {
@@ -172,7 +172,7 @@ VAL idris_castIntStr(VM* vm, VAL i) {
172172 Closure* cl = allocate(vm, sizeof(Closure) + sizeof(char)*16);
173173 cl -> ty = STRING;
174174 cl -> info.str = (char*)cl + sizeof(Closure);
175− sprintf(cl -> info.str, "%ld", GETINT(i));
175+ sprintf(cl -> info.str, "%d", (int)(GETINT(i)));
176176 return cl;
177177}
178178
rts/idris_rts.h+1−1
@@ -93,7 +93,7 @@ typedef intptr_t i_int;
9393#define INITFRAME VAL* myoldbase
9494#define REBASE vm->valstack_base = oldbase
9595#define RESERVE(x) if (vm->valstack_top+(x) > vm->stack_max) { stackOverflow(); } \
96− else { bzero(vm->valstack_top, (x)); }
96+ else { bzero(vm->valstack_top, (x)*sizeof(VAL)); }
9797#define ADDTOP(x) vm->valstack_top += (x)
9898#define TOPBASE(x) vm->valstack_top = vm->valstack_base + (x)
9999#define BASETOP(x) vm->valstack_base = vm->valstack_top + (x)
src/IRTS/CodegenC.hs+1−1
@@ -44,7 +44,7 @@ codegenC defs out exec incs libs dbg
4444 " " ++ tmpn ++
4545 " `idris --link` `idris --include` " ++ libs ++
4646 " -lidris_rts -lgmp -o " ++ out
47−-- putStrLn cout
47+ -- putStrLn cout
4848 exit <- system gcc
4949 when (exit /= ExitSuccess) $
5050 putStrLn ("FAILURE: " ++ gcc)
src/IRTS/Compiler.hs+1−1
@@ -36,7 +36,7 @@ compileC f tm = do checkMVs
3636 let checked = checkDefs defuns (toAlist defuns)
3737 case checked of
3838 OK c -> do -- iputStrLn $ showSep "\n" (map show c)
39− liftIO $ codegenC c f True [] "" TRACE
39+ liftIO $ codegenC c f True [] "" NONE
4040 Error e -> fail $ show e
4141 where checkMVs = do i <- get
4242 case idris_metavars i \\ primDefs of
src/Idris/REPL.hs+4−4
@@ -264,7 +264,7 @@ process fn Execute = do (m, _) <- elabVal toplevel False
264264-- (PRef (FC "main" 0) (NS (UN "main") ["main"]))
265265 (tmpn, tmph) <- liftIO tempfile
266266 liftIO $ hClose tmph
267− compile tmpn m
267+ compileC tmpn m
268268 liftIO $ system tmpn
269269 return ()
270270 where fc = FC "main" 0
@@ -272,13 +272,13 @@ process fn (NewCompile f)
272272 = do (m, _) <- elabVal toplevel False
273273 (PApp fc (PRef fc (UN "run__IO"))
274274 [pexp $ PRef fc (NS (UN "main") ["main"])])
275− compileC f m
275+ compile f m
276276 where fc = FC "main" 0
277277process fn (Compile f)
278278 = do (m, _) <- elabVal toplevel False
279279 (PApp fc (PRef fc (UN "run__IO"))
280− [pexp $ PRef fc (NS (UN "main") ["main"])])
281− compile f m
280+ [pexp $ PRef fc (NS (UN "main") ["main"])])
281+ compileC f m
282282 where fc = FC "main" 0
283283process fn (LogLvl i) = setLogLevel i
284284process fn Metavars