Skip to content

Commit efbfc57

Browse files
authored
Merge pull request #64 from cmsc430/mem-revision
Replace [Offset] with [Mem]; re-enable tests
2 parents 43d9850 + deaa369 commit efbfc57

File tree

17 files changed

+189
-188
lines changed

17 files changed

+189
-188
lines changed

.github/workflows/macos.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,23 @@ jobs:
2929
variant: ${{ matrix.racket-variant }}
3030
version: ${{ matrix.racket-version }}
3131

32+
- name: Version info
33+
run: |
34+
uname -a
35+
uname -m
36+
clang --version
37+
gcc --version
38+
3239
- name: Cache Racket packages
3340
uses: actions/cache@v4
3441
with:
3542
path: |
3643
~/.racket
3744
~/.cache/racket
45+
~/.local/share/racket
46+
~/Library/Caches/Racket
3847
key: racket-${{ matrix.racket-variant }}-${{ matrix.racket-version }}-${{ matrix.os }}
3948

40-
- name: Version info
41-
run: |
42-
uname -a
43-
uname -m
44-
clang --version
45-
gcc --version
46-
4749
- name: Install langs package
4850
run: |
4951
raco pkg install --auto ../langs/

.github/workflows/ubuntu.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ jobs:
2929
variant: ${{ matrix.racket-variant }}
3030
version: ${{ matrix.racket-version }}
3131

32-
- name: Cache Racket packages
33-
uses: actions/cache@v4
34-
with:
35-
path: |
36-
~/.racket
37-
~/.cache/racket
38-
key: racket-${{ matrix.racket-variant }}-${{ matrix.racket-version }}-${{ matrix.os }}
39-
4032
- name: Install clang
4133
run: |
4234
sudo apt install -y clang libssl-dev
@@ -46,6 +38,16 @@ jobs:
4638
clang --version
4739
gcc --version
4840
41+
- name: Cache Racket packages
42+
uses: actions/cache@v4
43+
with:
44+
path: |
45+
~/.racket
46+
~/.cache/racket
47+
~/.local/share/racket
48+
~/Library/Caches/Racket
49+
key: racket-${{ matrix.racket-variant }}-${{ matrix.racket-version }}-${{ matrix.os }}
50+
4951
- name: Install langs package
5052
run: |
5153
raco pkg install --auto ../langs/

info.rkt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@
1515

1616
;; To test these, you should do an explicit: raco test -c <lang>
1717
(define test-omit-paths (list "iniquity-gc"
18-
"mountebank"
19-
;; "mug" ;; NOTE: seems to pass currently
20-
"neerdowell"
2118
"outlaw"))

iniquity-gc/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ifeq ($(shell uname), Darwin)
2-
LANGS_CC ?= arch -x86_64 gcc
3-
LANGS_AS ?= nasm -g -f macho64 --gprefix _
2+
LANGS_CC ?= arch -x86_64 clang
3+
LANGS_AS ?= arch -x86_64 clang -c
44
else
5-
LANGS_CC ?= gcc
6-
LANGS_AS ?= nasm -g -f elf64
5+
LANGS_CC ?= clang
6+
LANGS_AS ?= clang -c
77
endif
88

99
objs = \

iniquity-gc/compile-ops.rkt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,22 @@
7979
(seq (Push rax)
8080
(allocate 1)
8181
(Pop rax)
82-
(Mov (Offset rbx 0) rax)
82+
(Mov (Mem rbx 0) rax)
8383
(Mov rax rbx)
8484
(Or rax type-box)
8585
(Add rbx 8))]
8686
['unbox
8787
(seq (assert-box rax)
8888
(Xor rax type-box)
89-
(Mov rax (Offset rax 0)))]
89+
(Mov rax (Mem rax 0)))]
9090
['car
9191
(seq (assert-cons rax)
9292
(Xor rax type-cons)
93-
(Mov rax (Offset rax 8)))]
93+
(Mov rax (Mem rax 8)))]
9494
['cdr
9595
(seq (assert-cons rax)
9696
(Xor rax type-cons)
97-
(Mov rax (Offset rax 0)))]
97+
(Mov rax (Mem rax 0)))]
9898
['empty? (eq-imm '())]
9999
['box?
100100
(type-pred ptr-mask type-box)]
@@ -111,7 +111,7 @@
111111
(Xor rax type-vect)
112112
(Cmp rax 0)
113113
(Je zero)
114-
(Mov rax (Offset rax 0))
114+
(Mov rax (Mem rax 0))
115115
(Sal rax int-shift)
116116
(Jmp done)
117117
(Label zero)
@@ -124,7 +124,7 @@
124124
(Xor rax type-str)
125125
(Cmp rax 0)
126126
(Je zero)
127-
(Mov rax (Offset rax 0))
127+
(Mov rax (Mem rax 0))
128128
(Sal rax int-shift)
129129
(Jmp done)
130130
(Label zero)
@@ -181,9 +181,9 @@
181181
(seq (Push rax)
182182
(allocate 2)
183183
(Pop rax)
184-
(Mov (Offset rbx 0) rax)
184+
(Mov (Mem rbx 0) rax)
185185
(Pop rax)
186-
(Mov (Offset rbx 8) rax)
186+
(Mov (Mem rbx 8) rax)
187187
(Mov rax rbx)
188188
(Or rax type-cons)
189189
(Add rbx 16))]
@@ -212,11 +212,11 @@
212212
(Or r9 type-vect)
213213

214214
(Sar r8 int-shift)
215-
(Mov (Offset rbx 0) r8)
215+
(Mov (Mem rbx 0) r8)
216216
(Add rbx 8)
217217

218218
(Label loop)
219-
(Mov (Offset rbx 0) rax)
219+
(Mov (Mem rbx 0) rax)
220220
(Add rbx 8)
221221
(Sub r8 1)
222222
(Cmp r8 0)
@@ -235,14 +235,14 @@
235235
(Cmp rax 0)
236236
(Jl 'raise_error_align)
237237
(Xor r8 type-vect) ; r8 = ptr
238-
(Mov r9 (Offset r8 0)) ; r9 = len
238+
(Mov r9 (Mem r8 0)) ; r9 = len
239239
(Sar rax int-shift) ; rax = index
240240
(Sub r9 1)
241241
(Cmp r9 rax)
242242
(Jl 'raise_error_align)
243243
(Sal rax 3)
244244
(Add r8 rax)
245-
(Mov rax (Offset r8 8)))]
245+
(Mov rax (Mem r8 8)))]
246246

247247
['make-string
248248
(let ((loop (gensym))
@@ -269,7 +269,7 @@
269269
(Or r9 type-str)
270270

271271
(Sar r8 int-shift)
272-
(Mov (Offset rbx 0) r8)
272+
(Mov (Mem rbx 0) r8)
273273
(Add rbx 8)
274274

275275
(Sar rax char-shift)
@@ -279,7 +279,7 @@
279279
(Sal r8 1) ; len is odd
280280

281281
(Label loop)
282-
(Mov (Offset rbx 0) eax)
282+
(Mov (Mem rbx 0) eax)
283283
(Add rbx 4)
284284
(Sub r8 1)
285285
(Cmp r8 0)
@@ -300,22 +300,22 @@
300300
(Cmp rax 0)
301301
(Jl 'raise_error_align)
302302
(Xor r8 type-str) ; r8 = ptr
303-
(Mov r9 (Offset r8 0)) ; r9 = len
303+
(Mov r9 (Mem r8 0)) ; r9 = len
304304
(Sar rax int-shift) ; rax = index
305305
(Sub r9 1)
306306
(Cmp r9 rax)
307307
(Jl 'raise_error_align)
308308
(Sal rax 2)
309309
(Add r8 rax)
310-
(Mov 'eax (Offset r8 8))
310+
(Mov 'eax (Mem r8 8))
311311
(Sal rax char-shift)
312312
(Or rax type-char))]
313313

314314
['set-box!
315315
(seq (Pop r8)
316316
(assert-box r8)
317317
(Xor r8 type-box)
318-
(Mov (Offset r8 0) rax)
318+
(Mov (Mem r8 0) rax)
319319
(Mov rax (value->bits (void))))]))
320320

321321
;; Op3 -> Asm
@@ -329,14 +329,14 @@
329329
(Cmp r10 0)
330330
(Jl 'raise_error_align)
331331
(Xor r8 type-vect) ; r8 = ptr
332-
(Mov r9 (Offset r8 0)) ; r9 = len
332+
(Mov r9 (Mem r8 0)) ; r9 = len
333333
(Sar r10 int-shift) ; r10 = index
334334
(Sub r9 1)
335335
(Cmp r9 r10)
336336
(Jl 'raise_error_align)
337337
(Sal r10 3)
338338
(Add r8 r10)
339-
(Mov (Offset r8 8) rax)
339+
(Mov (Mem r8 8) rax)
340340
(Mov rax (value->bits (void))))]))
341341

342342

iniquity-gc/compile.rkt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
;; Prog -> Asm
1414
(define (compile p)
1515
(match p
16-
[(Prog ds e)
16+
[(Prog ds e)
1717
(prog (externs)
1818
(Global 'entry)
1919
(Label 'entry)
@@ -82,7 +82,7 @@
8282
;; Id CEnv -> Asm
8383
(define (compile-variable x c)
8484
(let ((i (lookup x c)))
85-
(seq (Mov rax (Offset rsp i)))))
85+
(seq (Mov rax (Mem rsp i)))))
8686

8787
;; String -> Asm
8888
(define (compile-string s)
@@ -91,7 +91,7 @@
9191
(seq (Mov rax type-str))
9292
(seq (allocate (add1 (quotient (add1 len) 2)))
9393
(Mov rax len)
94-
(Mov (Offset rbx 0) rax)
94+
(Mov (Mem rbx 0) rax)
9595
(compile-string-chars (string->list s) 8)
9696
(Mov rax rbx)
9797
(Or rax type-str)
@@ -104,7 +104,7 @@
104104
['() (seq)]
105105
[(cons c cs)
106106
(seq (Mov rax (char->integer c))
107-
(Mov (Offset rbx i) 'eax)
107+
(Mov (Mem rbx i) 'eax)
108108
(compile-string-chars cs (+ 4 i)))]))
109109

110110
;; Op0 CEnv -> Asm

mountebank/compile-datum.rkt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
[else (compile-atom d)]))
1717

1818
(define (load-symbol s)
19-
(Plus (symbol->data-label s) type-symb))
19+
(Mem (symbol->data-label s) type-symb))
2020

2121
(define (load-string s)
22-
(Plus (symbol->data-label (string->symbol s)) type-str))
22+
(Mem (symbol->data-label (string->symbol s)) type-str))
2323

2424
;; Value -> Asm
2525
(define (compile-atom v)
@@ -55,7 +55,7 @@
5555
(match (compile-quoted c)
5656
[(cons l1 is1)
5757
(let ((l (gensym 'box)))
58-
(cons (Plus l type-box)
58+
(cons (Mem l type-box)
5959
(seq (Label l)
6060
(Dq l1)
6161
is1)))]))
@@ -67,7 +67,7 @@
6767
(match (compile-quoted c2)
6868
[(cons l2 is2)
6969
(let ((l (gensym 'cons)))
70-
(cons (Plus l type-cons)
70+
(cons (Mem l type-cons)
7171
(seq (Label l)
7272
(Dq l2)
7373
(Dq l1)
@@ -81,7 +81,7 @@
8181
[_
8282
(let ((l (gensym 'vector))
8383
(cds (map compile-quoted ds)))
84-
(cons (Plus l type-vect)
84+
(cons (Mem l type-vect)
8585
(seq (Label l)
8686
(Dq (length ds))
8787
(map (λ (cd) (Dq (car cd))) cds)

mountebank/compile-define.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
[(cons (Defn f xs e) ds)
4747
(let ((fvs (fv (Lam f xs e))))
4848
(seq (Lea rax (symbol->label f))
49-
(Mov (Offset rbx off) rax)
49+
(Mov (Mem rbx off) rax)
5050
(Mov rax rbx)
5151
(Add rax off)
5252
(Or rax type-proc)

0 commit comments

Comments
 (0)