Skip to content

Commit 877c54e

Browse files
committed
Remove GC stuff from Iniquity.
1 parent 32acf31 commit 877c54e

File tree

4 files changed

+7
-50
lines changed

4 files changed

+7
-50
lines changed

langs/iniquity/compile-ops.rkt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@
2121
unpad-stack)]
2222
['peek-byte (seq pad-stack
2323
(Call 'peek_byte)
24-
unpad-stack)]
25-
['dump-memory-stats
26-
(seq (Mov rdi rsp)
27-
(Mov 'rsi 'rbp)
28-
(Mov 'rdx rbx)
29-
pad-stack
30-
(Call 'print_memory)
31-
(Mov rax 0)
32-
unpad-stack)]))
24+
unpad-stack)]))
3325

3426
;; Op1 -> Asm
3527
(define (compile-op1 p)

langs/iniquity/compile.rkt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
(prog (externs)
1818
(Global 'entry)
1919
(Label 'entry)
20-
(Mov 'rbp 'rsp) ; save stack base pointer
2120
(Mov rbx rdi) ; recv heap pointer
2221
(compile-e e '())
2322
(Ret)
@@ -30,8 +29,7 @@
3029
(seq (Extern 'peek_byte)
3130
(Extern 'read_byte)
3231
(Extern 'write_byte)
33-
(Extern 'raise_error)
34-
(Extern 'print_memory)))
32+
(Extern 'raise_error)))
3533

3634
;; [Listof Defn] -> Asm
3735
(define (compile-defines ds)

langs/iniquity/main.c

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "print.h"
66
#include "runtime.h"
77

8+
#include "types.h"
9+
810
FILE* in;
911
FILE* out;
1012
void (*error_handler)();
@@ -33,45 +35,10 @@ int main(int argc, char** argv)
3335
result = entry(heap);
3436

3537
print_result(result);
38+
3639
if (val_typeof(result) != T_VOID)
37-
putchar('\n');
40+
putchar('\n');
3841

3942
free(heap);
4043
return 0;
4144
}
42-
43-
const char* val_typeof_string(int64_t t) {
44-
switch (val_typeof(t)) {
45-
case T_INT: return "INT";
46-
case T_BOOL: return "BOOL";
47-
case T_CHAR: return "CHAR";
48-
case T_EOF: return "EOF";
49-
case T_VOID: return "VOID";
50-
case T_EMPTY: return "EMPTY";
51-
case T_BOX: return "BOX";
52-
case T_CONS: return "CONS";
53-
case T_VECT: return "VECT";
54-
case T_STR: return "STR";
55-
default: return "UNKNOWN";
56-
}
57-
}
58-
59-
60-
61-
void print_memory(int64_t* rsp, int64_t rbp, int64_t rbx) {
62-
int stack_count = (rbp-(int64_t)rsp) / 8;
63-
int heap_count = (rbx-(int64_t)heap) / 8;
64-
65-
printf("----------------------------------------------------------------\n");
66-
// printf("rsp: %" PRIx64 ", rbp: %" PRIx64 ", stack count: %d, heap count: %d\n", (int64_t)rsp, rbp, stack_count, heap_count);
67-
int i;
68-
69-
printf("STACK:\n");
70-
for (i = 0; i < stack_count; i++) {
71-
printf("[%" PRIx64 "] = %016" PRIx64 ", %s\n", (int64_t)rsp + i, rsp[i], val_typeof_string(rsp[i]));
72-
}
73-
printf("HEAP:\n");
74-
for (i = 0; i < heap_count; i++) {
75-
printf("[%" PRIx64 "] = %016" PRIx64 ", %s\n", (int64_t)heap + i, heap[i], val_typeof_string(heap[i]));
76-
}
77-
}

langs/iniquity/parse.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
[_ (error "Parse error" s)]))
4848

4949
(define op0
50-
'(read-byte peek-byte void dump-memory-stats))
50+
'(read-byte peek-byte void))
5151

5252
(define op1
5353
'(add1 sub1 zero? char? write-byte eof-object?

0 commit comments

Comments
 (0)