Skip to content

Commit 871f8eb

Browse files
committed
More work on moving to machine code emission.
1 parent c677c72 commit 871f8eb

File tree

4 files changed

+224
-269
lines changed

4 files changed

+224
-269
lines changed

examples/sysir/drawing2.janet

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
(defpointer p16 u16)
1515
(defpointer cursor p32)
1616

17-
# Linux syscalls
18-
# (defn-syscall brk:p32 12 [amount:uint])
19-
# (defn-syscall exit:void 60 [code:int])
20-
# (defn-syscall write:void 1 [fd:int data:p32 size:uint])
21-
# (defn-syscall write_string 1 [fd:int data:pointer size:uint])
22-
2317
# External
2418
(defn-external write:void [fd:int mem:pointer size:uint])
2519
(defn-external exit:void [x:int])

examples/sysir/x64.janet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
(defsys doloop [x:int y:int]
77
(var i:int x)
8-
#(printf "i = %d\n" i)
8+
(printf "initial i = %d\n" i)
99
(while (< i y)
1010
(set i (+ 1 i))
1111
(printf "i = %d\n" i))

src/core/sysir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ void janet_sys_ir_lower_to_c(JanetSysIRLinkage *linkage, JanetBuffer *buffer) {
16501650
#define EMITBINOP_NOSUGAR(OP) emit_binop(ir, buffer, tempbuf, instruction, OP, 0)
16511651

16521652
/* Prelude */
1653-
janet_formatb(buffer, "#include <stddef.h>\n#include <stdlib.h>\n#include <stdint.h>\n#include <stdbool.h>\n#include <stdio.h>\n#include <sys/syscall.h>\n#define _t0 void\n\n");
1653+
janet_formatb(buffer, "#include <stddef.h>\n#include <unistd.h>\n#include <stdlib.h>\n#include <stdint.h>\n#include <stdbool.h>\n#include <stdio.h>\n#include <sys/syscall.h>\n#define _t0 void\n\n");
16541654

16551655
/* Emit type defs */
16561656
for (uint32_t j = 0; j < (uint32_t) linkage->ir_ordered->count; j++) {

0 commit comments

Comments
 (0)