Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions con/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
(match e
[(Lit i) (seq (Mov rax i))]
[(Prim1 p e) (compile-prim1 p e)]
[(IfZero e1 e2 e3)
(compile-ifzero e1 e2 e3)]))
[(IfZero e1 e2 e3) (compile-ifzero e1 e2 e3)]))

;; Op1 Expr -> Asm
(define (compile-prim1 p e)
Expand Down
3 changes: 1 addition & 2 deletions dodger/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
(match e
[(Lit d) (compile-datum d)]
[(Prim1 p e) (compile-prim1 p e)]
[(If e1 e2 e3)
(compile-if e1 e2 e3)]))
[(If e1 e2 e3) (compile-if e1 e2 e3)]))

;; Datum -> Asm
(define (compile-datum d)
Expand Down
3 changes: 1 addition & 2 deletions dupe/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
(match e
[(Lit d) (compile-datum d)]
[(Prim1 p e) (compile-prim1 p e)]
[(If e1 e2 e3)
(compile-if e1 e2 e3)]))
[(If e1 e2 e3) (compile-if e1 e2 e3)]))

;; Datum -> Asm
(define (compile-datum d)
Expand Down
6 changes: 3 additions & 3 deletions evildoer/compile-ops.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
(define (compile-op0 p)
(match p
['void (seq (Mov rax (value->bits (void))))]
['read-byte (seq (Call 'read_byte))]
['peek-byte (seq (Call 'peek_byte))]))
['read-byte (seq (Extern 'read_byte) (Call 'read_byte))]
['peek-byte (seq (Extern 'peek_byte) (Call 'peek_byte))]))

;; Op1 -> Asm
(define (compile-op1 p)
Expand Down Expand Up @@ -37,7 +37,7 @@
(seq (Cmp rax (value->bits eof))
if-equal)]
['write-byte
(seq
(seq (Extern 'write_byte)
(Mov rdi rax)
(Call 'write_byte))]))

Expand Down
9 changes: 2 additions & 7 deletions evildoer/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
;; Expr -> Asm
(define (compile e)
(prog (Global 'entry)
(Extern 'peek_byte)
(Extern 'read_byte)
(Extern 'write_byte)
(Label 'entry)
(Sub rsp 8)
(compile-e e)
Expand All @@ -26,10 +23,8 @@
[(Eof) (seq (Mov rax (value->bits eof)))]
[(Prim0 p) (compile-prim0 p)]
[(Prim1 p e) (compile-prim1 p e)]
[(If e1 e2 e3)
(compile-if e1 e2 e3)]
[(Begin e1 e2)
(compile-begin e1 e2)]))
[(If e1 e2 e3) (compile-if e1 e2 e3)]
[(Begin e1 e2) (compile-begin e1 e2)]))

;; Datum -> Asm
(define (compile-datum d)
Expand Down
7 changes: 4 additions & 3 deletions extort/compile-ops.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
(define (compile-op0 p)
(match p
['void (seq (Mov rax (value->bits (void))))]
['read-byte (seq (Call 'read_byte))]
['peek-byte (seq (Call 'peek_byte))]))
['read-byte (seq (Extern 'read_byte) (Call 'read_byte))]
['peek-byte (seq (Extern 'peek_byte) (Call 'peek_byte))]))

;; Op1 -> Asm
(define (compile-op1 p)
Expand Down Expand Up @@ -42,7 +42,8 @@
(seq (Cmp rax (value->bits eof))
if-equal)]
['write-byte
(seq (assert-byte rax)
(seq (Extern 'write_byte)
(assert-byte rax)
(Mov rdi rax)
(Call 'write_byte))]))

Expand Down
11 changes: 3 additions & 8 deletions extort/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
;; Expr -> Asm
(define (compile e)
(prog (Global 'entry)
(Extern 'peek_byte)
(Extern 'read_byte)
(Extern 'write_byte)
(Extern 'raise_error)
(Label 'entry)
(Sub rsp 8)
(compile-e e)
(Add rsp 8)
(Ret)
;; Error handler
(Label 'err)
(Extern 'raise_error)
(Call 'raise_error)))

;; Expr -> Asm
Expand All @@ -30,10 +27,8 @@
[(Eof) (seq (Mov rax (value->bits eof)))]
[(Prim0 p) (compile-prim0 p)]
[(Prim1 p e) (compile-prim1 p e)]
[(If e1 e2 e3)
(compile-if e1 e2 e3)]
[(Begin e1 e2)
(compile-begin e1 e2)]))
[(If e1 e2 e3) (compile-if e1 e2 e3)]
[(Begin e1 e2) (compile-begin e1 e2)]))

;; Datum -> Asm
(define (compile-datum d)
Expand Down
7 changes: 4 additions & 3 deletions fraud/compile-ops.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
(define (compile-op0 p)
(match p
['void (seq (Mov rax (value->bits (void))))]
['read-byte (seq pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq pad-stack (Call 'peek_byte) unpad-stack)]))
['read-byte (seq (Extern 'read_byte) pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq (Extern 'peek_byte) pad-stack (Call 'peek_byte) unpad-stack)]))

;; Op1 -> Asm
(define (compile-op1 p)
Expand Down Expand Up @@ -42,7 +42,8 @@
(seq (Cmp rax (value->bits eof))
if-equal)]
['write-byte
(seq (assert-byte rax)
(seq (Extern 'write_byte)
(assert-byte rax)
pad-stack
(Mov rdi rax)
(Call 'write_byte)
Expand Down
14 changes: 4 additions & 10 deletions fraud/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
;; ClosedExpr -> Asm
(define (compile e)
(prog (Global 'entry)
(Extern 'peek_byte)
(Extern 'read_byte)
(Extern 'write_byte)
(Extern 'raise_error)
(Label 'entry)
;; save callee-saved register
(Push r15)
Expand All @@ -23,6 +19,7 @@
;; Error handler
(Label 'err)
pad-stack
(Extern 'raise_error)
(Call 'raise_error)))

;; type CEnv = (Listof [Maybe Id])
Expand All @@ -35,12 +32,9 @@
[(Prim0 p) (compile-prim0 p)]
[(Prim1 p e) (compile-prim1 p e c)]
[(Prim2 p e1 e2) (compile-prim2 p e1 e2 c)]
[(If e1 e2 e3)
(compile-if e1 e2 e3 c)]
[(Begin e1 e2)
(compile-begin e1 e2 c)]
[(Let x e1 e2)
(compile-let x e1 e2 c)]))
[(If e1 e2 e3) (compile-if e1 e2 e3 c)]
[(Begin e1 e2) (compile-begin e1 e2 c)]
[(Let x e1 e2) (compile-let x e1 e2 c)]))

;; Datum -> Asm
(define (compile-datum d)
Expand Down
7 changes: 4 additions & 3 deletions hoax/compile-ops.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
(define (compile-op0 p)
(match p
['void (seq (Mov rax (value->bits (void))))]
['read-byte (seq pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq pad-stack (Call 'peek_byte) unpad-stack)]))
['read-byte (seq (Extern 'read_byte) pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq (Extern 'peek_byte) pad-stack (Call 'peek_byte) unpad-stack)]))

;; Op1 -> Asm
(define (compile-op1 p)
Expand Down Expand Up @@ -42,7 +42,8 @@
(seq (Cmp rax (value->bits eof))
if-equal)]
['write-byte
(seq (assert-byte rax)
(seq (Extern 'write_byte)
(assert-byte rax)
pad-stack
(Mov rdi rax)
(Call 'write_byte)
Expand Down
14 changes: 4 additions & 10 deletions hoax/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
;; ClosedExpr -> Asm
(define (compile e)
(prog (Global 'entry)
(Extern 'peek_byte)
(Extern 'read_byte)
(Extern 'write_byte)
(Extern 'raise_error)
(Label 'entry)
;; save callee-saved register
(Push r15)
Expand All @@ -27,6 +23,7 @@
;; Error handler
(Label 'err)
pad-stack
(Extern 'raise_error)
(Call 'raise_error)
(Data)
(Label 'empty)
Expand All @@ -43,12 +40,9 @@
[(Prim1 p e) (compile-prim1 p e c)]
[(Prim2 p e1 e2) (compile-prim2 p e1 e2 c)]
[(Prim3 p e1 e2 e3) (compile-prim3 p e1 e2 e3 c)]
[(If e1 e2 e3)
(compile-if e1 e2 e3 c)]
[(Begin e1 e2)
(compile-begin e1 e2 c)]
[(Let x e1 e2)
(compile-let x e1 e2 c)]))
[(If e1 e2 e3) (compile-if e1 e2 e3 c)]
[(Begin e1 e2) (compile-begin e1 e2 c)]
[(Let x e1 e2) (compile-let x e1 e2 c)]))

;; Datum -> Asm
(define (compile-datum d)
Expand Down
7 changes: 4 additions & 3 deletions hustle/compile-ops.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
(define (compile-op0 p)
(match p
['void (seq (Mov rax (value->bits (void))))]
['read-byte (seq pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq pad-stack (Call 'peek_byte) unpad-stack)]))
['read-byte (seq (Extern 'read_byte) pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq (Extern 'peek_byte) pad-stack (Call 'peek_byte) unpad-stack)]))

;; Op1 -> Asm
(define (compile-op1 p)
Expand Down Expand Up @@ -42,7 +42,8 @@
(seq (Cmp rax (value->bits eof))
if-equal)]
['write-byte
(seq (assert-byte rax)
(seq (Extern 'write_byte)
(assert-byte rax)
pad-stack
(Mov rdi rax)
(Call 'write_byte)
Expand Down
14 changes: 4 additions & 10 deletions hustle/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
;; ClosedExpr -> Asm
(define (compile e)
(prog (Global 'entry)
(Extern 'peek_byte)
(Extern 'read_byte)
(Extern 'write_byte)
(Extern 'raise_error)
(Label 'entry)
;; save callee-saved register
(Push r15)
Expand All @@ -27,6 +23,7 @@
;; Error handler
(Label 'err)
pad-stack
(Extern 'raise_error)
(Call 'raise_error)))

;; type CEnv = (Listof [Maybe Id])
Expand All @@ -39,12 +36,9 @@
[(Prim0 p) (compile-prim0 p)]
[(Prim1 p e) (compile-prim1 p e c)]
[(Prim2 p e1 e2) (compile-prim2 p e1 e2 c)]
[(If e1 e2 e3)
(compile-if e1 e2 e3 c)]
[(Begin e1 e2)
(compile-begin e1 e2 c)]
[(Let x e1 e2)
(compile-let x e1 e2 c)]))
[(If e1 e2 e3) (compile-if e1 e2 e3 c)]
[(Begin e1 e2) (compile-begin e1 e2 c)]
[(Let x e1 e2) (compile-let x e1 e2 c)]))

;; Datum -> Asm
(define (compile-datum d)
Expand Down
7 changes: 4 additions & 3 deletions iniquity/compile-ops.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
(define (compile-op0 p)
(match p
['void (seq (Mov rax (value->bits (void))))]
['read-byte (seq pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq pad-stack (Call 'peek_byte) unpad-stack)]))
['read-byte (seq (Extern 'read_byte) pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq (Extern 'peek_byte) pad-stack (Call 'peek_byte) unpad-stack)]))

;; Op1 -> Asm
(define (compile-op1 p)
Expand Down Expand Up @@ -42,7 +42,8 @@
(seq (Cmp rax (value->bits eof))
if-equal)]
['write-byte
(seq (assert-byte rax)
(seq (Extern 'write_byte)
(assert-byte rax)
pad-stack
(Mov rdi rax)
(Call 'write_byte)
Expand Down
17 changes: 5 additions & 12 deletions iniquity/compile.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
(match p
[(Prog ds e)
(prog (Global 'entry)
(Extern 'peek_byte)
(Extern 'read_byte)
(Extern 'write_byte)
(Extern 'raise_error)
(Label 'entry)
(Push rbx) ; save callee-saved register
(Push r15)
Expand All @@ -33,6 +29,7 @@
(compile-defines ds)
(Label 'err)
pad-stack
(Extern 'raise_error)
(Call 'raise_error)
(Data)
(Label 'empty)
Expand Down Expand Up @@ -66,14 +63,10 @@
[(Prim1 p e) (compile-prim1 p e c)]
[(Prim2 p e1 e2) (compile-prim2 p e1 e2 c)]
[(Prim3 p e1 e2 e3) (compile-prim3 p e1 e2 e3 c)]
[(If e1 e2 e3)
(compile-if e1 e2 e3 c)]
[(Begin e1 e2)
(compile-begin e1 e2 c)]
[(Let x e1 e2)
(compile-let x e1 e2 c)]
[(App f es)
(compile-app f es c)]))
[(If e1 e2 e3) (compile-if e1 e2 e3 c)]
[(Begin e1 e2) (compile-begin e1 e2 c)]
[(Let x e1 e2) (compile-let x e1 e2 c)]
[(App f es) (compile-app f es c)]))

;; Datum -> Asm
(define (compile-datum d)
Expand Down
7 changes: 4 additions & 3 deletions jig/compile-ops.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
(define (compile-op0 p)
(match p
['void (seq (Mov rax (value->bits (void))))]
['read-byte (seq pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq pad-stack (Call 'peek_byte) unpad-stack)]))
['read-byte (seq (Extern 'read_byte) pad-stack (Call 'read_byte) unpad-stack)]
['peek-byte (seq (Extern 'peek_byte) pad-stack (Call 'peek_byte) unpad-stack)]))

;; Op1 -> Asm
(define (compile-op1 p)
Expand Down Expand Up @@ -42,7 +42,8 @@
(seq (Cmp rax (value->bits eof))
if-equal)]
['write-byte
(seq (assert-byte rax)
(seq (Extern 'write_byte)
(assert-byte rax)
pad-stack
(Mov rdi rax)
(Call 'write_byte)
Expand Down
Loading
Loading