Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
84841da
start special casing code gen for more things
mattwparas Jan 9, 2026
8826cca
Merge remote-tracking branch 'origin' into mwp-starting-more-speciali…
mattwparas Jan 9, 2026
e845032
clean up
mattwparas Jan 9, 2026
b18dc8b
remove debug prints
mattwparas Jan 9, 2026
e3519c6
add http client and server
mattwparas Jan 10, 2026
8703c16
checkpoint
mattwparas Jan 15, 2026
369d565
try this
mattwparas Jan 15, 2026
7052410
something is up with unboxed bools
mattwparas Jan 15, 2026
967885b
more C stuff
mattwparas Jan 16, 2026
ac75cc2
checkpoint
mattwparas Jan 17, 2026
52022b2
merge from master
mattwparas Feb 15, 2026
0329f0c
merge from master
mattwparas Mar 7, 2026
3bbc70d
empty? working
mattwparas Mar 7, 2026
4f65bfc
remove the debug count
mattwparas Mar 7, 2026
17c574b
fix some more stuff
mattwparas Mar 7, 2026
f5bcd4d
try fixing build
mattwparas Mar 8, 2026
ba9e75d
remove client and server
mattwparas Mar 8, 2026
58b8219
specialize code gen
mattwparas Mar 8, 2026
371d875
checkpoint
mattwparas Mar 8, 2026
a0dd545
Merge remote-tracking branch 'origin' into mwp-starting-more-speciali…
mattwparas Mar 18, 2026
33e578a
checkpoint
mattwparas Mar 18, 2026
0c2f8ce
checkpoint
mattwparas Mar 18, 2026
a99feb3
Merge branch 'master' into mwp-starting-more-specialization-of-primit…
mattwparas Mar 19, 2026
9235c28
checkpoint
mattwparas Mar 20, 2026
1556899
Merge branch 'master' into mwp-starting-more-specialization-of-primit…
mattwparas Mar 21, 2026
e3477b1
Merge branch 'master' into mwp-starting-more-specialization-of-primit…
mattwparas Mar 22, 2026
b877100
checkpoint
mattwparas Mar 23, 2026
4e515ca
Merge branch 'master' into mwp-starting-more-specialization-of-primit…
mattwparas Mar 23, 2026
1e01013
checkpoint
mattwparas Mar 23, 2026
eb4abfc
checkpoint
mattwparas Mar 23, 2026
2b2738f
checkpoint, adding repr c vec
mattwparas Mar 24, 2026
4f57c3b
more vector stuff, trying to keep feature parity with the normal vec
mattwparas Mar 24, 2026
a7d3aec
start using special vec
mattwparas Mar 24, 2026
57fb40e
add drain
mattwparas Mar 24, 2026
65151e0
checkpoint, inlining push / pop to the local values
mattwparas Mar 24, 2026
55a57e4
try this
mattwparas Mar 25, 2026
4d60758
checkpoint on this
mattwparas Mar 27, 2026
9b3368c
clean up, make stack frame repr c as well
mattwparas Mar 28, 2026
6b82943
clean up
mattwparas Mar 28, 2026
46cf383
checkpoint, inlined trampoline calls through the VM
mattwparas Mar 28, 2026
cfe4dd2
checkpoint, things are certainly busted somehow
mattwparas Mar 29, 2026
c75ce13
clean up
mattwparas Mar 30, 2026
9df74fc
clean up
mattwparas Mar 30, 2026
1d6ea5e
clean up
mattwparas Mar 30, 2026
97326b9
use bit mask instead of if checks, much faster
mattwparas Mar 30, 2026
7f5a8d5
checkpoint again
mattwparas Mar 30, 2026
8fe1da1
add inline pop handling as well
mattwparas Mar 30, 2026
ccc47ee
checkpoint
mattwparas Mar 30, 2026
424a1b1
fix bug with stack
mattwparas Mar 30, 2026
84cd94c
fix off by one in bail out case
mattwparas Mar 31, 2026
457c066
clean up
mattwparas Mar 31, 2026
ac5c6a0
clean up
mattwparas Mar 31, 2026
71ba50c
clean up
mattwparas Mar 31, 2026
8290167
checkpoint
mattwparas Mar 31, 2026
24e5141
clean up
mattwparas Apr 1, 2026
d7588be
handle more stuff
mattwparas Apr 1, 2026
9fc9f82
include map for testing
mattwparas Apr 1, 2026
e2fb7ff
checkpoint
mattwparas Apr 2, 2026
1e41e49
fix move read local analysis
mattwparas Apr 2, 2026
41becfe
checkpoint, need to add back in opts for type flow analysis for prope…
mattwparas Apr 2, 2026
64b6135
fix branching
mattwparas Apr 3, 2026
439f41c
fix bounds checking stuff
mattwparas Apr 3, 2026
2fec208
try this
mattwparas Apr 4, 2026
54acd45
checkpoint
mattwparas Apr 4, 2026
9e9aa85
clean up
mattwparas Apr 4, 2026
af4f52f
gonna make this a lot better
mattwparas Apr 4, 2026
78d56af
switch heap refs to use repr c version
mattwparas Apr 5, 2026
6d15f1c
use spin locks, add repr c reference counting impl
mattwparas Apr 5, 2026
4b0b9ad
better alloc
mattwparas Apr 6, 2026
01214d3
start using the repr c reference counting impl
mattwparas Apr 6, 2026
ade2f26
checkpoint
mattwparas Apr 6, 2026
0af771a
checkpoint
mattwparas Apr 7, 2026
a347655
checkpoint
mattwparas Apr 7, 2026
3495284
inline calls for struct functions
mattwparas Apr 7, 2026
84e8d72
checkpoint with code for inlining struct refs
mattwparas Apr 7, 2026
524df1c
checkpoint
mattwparas Apr 7, 2026
3b5835a
checkpoint
mattwparas Apr 7, 2026
d67ae82
checkpoint
mattwparas Apr 7, 2026
105b24b
checkpoint
mattwparas Apr 8, 2026
6785053
checkpoint
mattwparas Apr 8, 2026
f8d5b30
checkpoint, figure out why tail call always deopts
mattwparas Apr 8, 2026
cce80d3
not even sure whats going on now
mattwparas Apr 8, 2026
68f14c8
clean up
mattwparas Apr 8, 2026
d08bd0f
add back missing drop
mattwparas Apr 8, 2026
b15c1ec
use trampoline once, continue using that from now on
mattwparas Apr 8, 2026
fb2112d
make the jit fn pointers non null
mattwparas Apr 8, 2026
d593f82
inline fast paths for structs, skip the type check on struct access
mattwparas Apr 8, 2026
5571f1d
some small clean up with debug printing functions
mattwparas Apr 9, 2026
4238366
checkpoint
mattwparas Apr 10, 2026
a9b3ba9
perhaps try this
mattwparas Apr 10, 2026
db6254a
lift all the various feature flags up
mattwparas Apr 10, 2026
9282e34
checkpoint
mattwparas Apr 11, 2026
1b988c4
enable all the jit features
mattwparas Apr 11, 2026
f22a538
fix optimization
mattwparas Apr 11, 2026
5f950c7
clean up, add some more float handling
mattwparas Apr 11, 2026
ed85922
checkpoint
mattwparas Apr 12, 2026
f7b1d36
checkpoint before handling constants separately
mattwparas Apr 14, 2026
d448cae
checkpoint
mattwparas Apr 14, 2026
668e386
checkpoint
mattwparas Apr 15, 2026
385bfd5
checkpoint
mattwparas Apr 15, 2026
d56c7d4
bunch of fixes
mattwparas Apr 16, 2026
30f7c2e
fix
mattwparas Apr 16, 2026
bfe8a05
checkpoint
mattwparas Apr 17, 2026
7154eb8
clean up
mattwparas Apr 17, 2026
3ebdfef
checkpoint
mattwparas Apr 17, 2026
332e2f8
checkpoint
mattwparas Apr 18, 2026
20cf9b1
checkpoint
mattwparas Apr 19, 2026
f14ba59
fix an opt pass, add some other stuff
mattwparas Apr 19, 2026
670af5b
checkpoint
mattwparas Apr 20, 2026
2fc7c12
checkpoint
mattwparas Apr 20, 2026
c93ec91
checkpoint
mattwparas Apr 21, 2026
a747aa6
a little performance improvement on the baseline jit
mattwparas Apr 22, 2026
62a4073
checkpoint
mattwparas Apr 22, 2026
58a32b1
checkpoint
mattwparas Apr 22, 2026
1dfefb5
checkpoint
mattwparas Apr 23, 2026
94c6c24
checkpoint... sort of
mattwparas Apr 23, 2026
585e431
avoid extraneous bounds check on stack spilling
mattwparas Apr 23, 2026
393cac5
clean up with bounds checks
mattwparas Apr 23, 2026
8a18917
checkpoint
mattwparas Apr 23, 2026
afa2f83
checkpoint
mattwparas Apr 24, 2026
400ace4
checkpoint
mattwparas Apr 24, 2026
d470086
checkpoint
mattwparas Apr 24, 2026
be615af
checkpoint
mattwparas Apr 24, 2026
71e93db
checkpoint
mattwparas Apr 24, 2026
3200e8c
checkpoint, we have to do more though
mattwparas Apr 25, 2026
2964e64
checkpoint
mattwparas Apr 25, 2026
6c78ecc
inline heap refs
mattwparas Apr 25, 2026
468ae9b
add better logging
mattwparas Apr 26, 2026
7034f93
checkpoint with return values
mattwparas Apr 26, 2026
7ad0bf1
inlining more comparisons
mattwparas Apr 26, 2026
4c929fa
checkpoint, more targeted drops, more to do
mattwparas Apr 26, 2026
1898149
checkpoint
mattwparas Apr 28, 2026
d407605
clean up
mattwparas Apr 28, 2026
1a08798
clean up
mattwparas Apr 29, 2026
b17f943
improvements
mattwparas May 1, 2026
2313492
clean up with explicit merges
mattwparas May 1, 2026
38b4e73
another pass with closure lifting
mattwparas May 1, 2026
3826e2e
checkpoint
mattwparas May 2, 2026
42b8602
checkpoint
mattwparas May 2, 2026
ad3533b
checkpoint
mattwparas May 3, 2026
54920ef
checkpoint
mattwparas May 3, 2026
eb021d5
checkpoint
mattwparas May 3, 2026
02d437d
checkpoint
mattwparas May 4, 2026
8beb36c
clean up
mattwparas May 4, 2026
ca6d7df
start figuring out higher tier jit
mattwparas May 5, 2026
4861601
checkpoint
mattwparas May 7, 2026
d10f961
clean up
mattwparas May 10, 2026
8e952fc
checkpoint
mattwparas May 10, 2026
0629143
checkpoint
mattwparas May 10, 2026
85bc990
small clean up here
mattwparas May 11, 2026
f4dc7c6
checkpoint
mattwparas May 12, 2026
31b1d71
checkpoint
mattwparas May 13, 2026
454c79a
clean up
mattwparas May 14, 2026
c315497
fix some bugs
mattwparas May 17, 2026
6dab48d
clean up
mattwparas May 24, 2026
ea4b4b0
checkpoint, get some more tests fixed
mattwparas May 29, 2026
673f1c0
fix some test cases
mattwparas May 30, 2026
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
202 changes: 145 additions & 57 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ clap = { version = "4.5.39", features = ["derive"] }
clap_complete = "4.5.52"
steel-doc = { path = "./crates/steel-doc", version = "0.8.2" }
mimalloc = { version = "0.1.47", optional = true }
snmalloc-rs = { version = "0.3.8", optional = true, default-features = false, features = [
snmalloc-rs = { version = "0.7.4", optional = true, default-features = false, features = [
"build_cc",
"usewait-on-address",
"native-cpu",
"lto"
] }

Expand Down
6 changes: 3 additions & 3 deletions benchmarks/ack/ack.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ def ack1(M, N):


start = time.time()
for i in range(50):
for i in range(10000):
ack1(3, 3)
end = time.time()

print(int(round((end - start) * 1000)))
# print(int(round((end - start) * 1000)))

# print(end - start)
print(end - start)
4 changes: 2 additions & 2 deletions benchmarks/ack/ack.scm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
; (set! ackermann ackermann)

(define (loop x)
(if (equal? x 100)
(if (equal? x 10000)
#true
(begin
(ackermann 3 3)
Expand All @@ -22,7 +22,7 @@

; (ackermann 1 1)

(loop 50)
; (loop 50)

; 0 DynSuperInstruction : 0 ;; m
; 1 LOADINT0 : 563 ;; 0
Expand Down
63 changes: 3 additions & 60 deletions benchmarks/bin-trees/bin-trees.scm
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,13 @@
(leaf item)
(let ([item2 (* item 2)]
[d2 (- d 1)])
; (stdout-simple-displayln item)
(node (make (- item2 1) d2) item (make item2 d2)))))

(define (check t)
(if (leaf? t)
1
(+ 1 (+ (check (node-left t)) (check (node-right t))))))

; (set! check check)
; (set! make make)
; (set! leaf leaf)
; (set! leaf? leaf?)

; (inspect check)
; (#%jit-compile-2 make)
; (#%jit-compile-2 check)
; (#%jit-compile-2 leaf)
; (#%jit-compile-2 leaf?)

; (set! make make)
; (set! check check)
(if (leaf? t) 1 (+ 1 (+ (check (node-left t)) (check (node-right t))))))

(define (iterate n m d sum)
; (stdout-simple-displayln n " " m " " d " " sum)
(if (equal? n m)
sum
(iterate (+ n 1) m d (+ sum (check (make n d))))))

; (inspect iterate)
(if (equal? n m) sum (iterate (+ n 1) m d (+ sum (check (make n d))))))

(define (max x y)
(if (> x y) x y))
Expand All @@ -74,42 +52,7 @@
(let ([stretch-depth (+ max-depth 1)])
(displayln "stretch tree of depth " stretch-depth " check: " (check (make 0 stretch-depth))))
(let ([long-lived-tree (make 0 max-depth)])
; (begin
; (define end )

(loop 4 (add1 max-depth) max-depth min-depth)

; )

(displayln "long lived tree of depth " max-depth " check: " (check long-lived-tree)))))

; (inspect iterate)

; (set! iterate iterate)

; (#%jit-compile-2 iterate)
; (#%jit-compile-2 max)
; (#%jit-compile-2 loop)
; (#%jit-compile-2 main)

; (inspect make)
; (define foo (make 0 2))
; (displayln foo)
; (displayln node)
; (displayln (check foo))


; (stdout-simple-displayln (make 0 4))

(main 20)
; (inspect make)

; (displayln (make 0 2))

; (main 3)

; (main 21)
; (main 21)

; (command-line #:args (n)
; (main (string->number n)))
(main 12)
147 changes: 71 additions & 76 deletions benchmarks/fib/fib.scm
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
(provide fib
; jitfib
jit-fib
add-two
loop
jit-loop
assoc2
fake-car
test-alloc-stuff
map1
big-list)
; jit-fib
; add-two
; loop
; jit-loop
; assoc2
; fake-car
; test-alloc-stuff
; map1
; big-list
)

;; This should return an int, and should always
;; return an int - we should be able to do
Expand All @@ -18,11 +19,11 @@
1
(+ (fib (- n 1)) (fib (- n 2)))))

(define (jit-fib n)
;; Loop unrolling would do so much, assuming we can do that easily
(if (<= n 2)
1
(+ (jit-fib (- n 1)) (jit-fib (- n 2)))))
(fib 38)

; (define (jit-fib n)
; ;; Loop unrolling would do so much, assuming we can do that easily
; (if (<= n 2) 1 (+ (jit-fib (- n 1)) (jit-fib (- n 2)))))

; (define jitfib (#%jit-compile jit-fib))
; (define jitfib jit-fib)
Expand All @@ -34,11 +35,11 @@
;; Replace it on the stack
; (#%jit-compile-2 jit-fib)

(define (add-two x y)
(split-many (string-append x y) " "))
; (define (add-two x y)
; (split-many (string-append x y) " "))

(define (fake-car x)
(car x))
; (define (fake-car x)
; (car x))

; (#%jit-compile-2 fake-car)

Expand All @@ -48,65 +49,59 @@
; (define (add-two x y)
; (string-append x y))

(define (loop x y)
(if (= x y)
x
(loop (+ x 1) y)))

(define (jit-loop x y)
(if (= x y)
(to-string x)
(jit-loop (+ x 1) y)))

(define (assoc2 obj lst)
(cond
[(null? lst) #f]
[(equal? (car (car lst)) obj) (car lst)]
[else (assoc2 obj (cdr lst))]))

(define (test-alloc-stuff obj)
(stdout-simple-displayln obj)
(unbox (box obj)))

(define big-list (map (lambda (x) (cons x x)) (range 0 10)))

(define (map1 func accum lst)
; (stdout-simple-displayln accum)
(if (null? lst)
(reverse accum)
(map1 func (cons (func (car lst)) accum) (cdr lst))))

; (set! map1 map1)

; (#%jit-compile-2 test-alloc-stuff)

;; TODO: Fix the inlining issue with free identifiers
; (define (loop x y)
; (if (= x y)
; x
; (loop (+ x 1))))

(define (loop1 count)
(if (= count 100)
(assoc 99999 big-list)
(begin
(assoc 99999 big-list)
(loop1 (+ 1 count)))))

(define (loop2 count)
(if (= count 100)
(assoc 99999 big-list)
(begin
(assoc2 99999 big-list)
(loop2 (+ 1 count)))))

(provide test-assoc)
(define (test-assoc)
(loop1 0))

(provide test-assoc2)
(define (test-assoc2)
(loop2 0))
; (if (= x y) x (loop (+ x 1) y)))

; (define (jit-loop x y)
; (if (= x y) (to-string x) (jit-loop (+ x 1) y)))

; (define (assoc2 obj lst)
; (cond
; [(null? lst) #f]
; [(equal? (car (car lst)) obj) (car lst)]
; [else (assoc2 obj (cdr lst))]))

; (define (test-alloc-stuff obj)
; (stdout-simple-displayln obj)
; (unbox (box obj)))

; (define big-list (map (lambda (x) (cons x x)) (range 0 10)))

; (define (map1 func accum lst)
; ; (stdout-simple-displayln accum)
; (if (null? lst) (reverse accum) (map1 func (cons (func (car lst)) accum) (cdr lst))))

; ; (set! map1 map1)

; ; (#%jit-compile-2 test-alloc-stuff)

; ;; TODO: Fix the inlining issue with free identifiers
; ; (define (loop x y)
; ; (if (= x y)
; ; x
; ; (loop (+ x 1))))

; (define (loop1 count)
; (if (= count 100)
; (assoc 99999 big-list)
; (begin
; (assoc 99999 big-list)
; (loop1 (+ 1 count)))))

; (define (loop2 count)
; (if (= count 100)
; (assoc 99999 big-list)
; (begin
; (assoc2 99999 big-list)
; (loop2 (+ 1 count)))))

; (provide test-assoc)
; (define (test-assoc)
; (loop1 0))

; (provide test-assoc2)
; (define (test-assoc2)
; (loop2 0))

; (displayln (fib 10))

Expand Down
12 changes: 10 additions & 2 deletions benchmarks/map/map.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
lst = [x + 1 for x in range(0, 10000)]
import time

print(len(lst))
base_range = list(range(0, 100000))

results = []

start = time.time()
for i in range(1000):
results.append([x + 1 for x in base_range])
end = time.time()
print((end - start) * 1000)
19 changes: 17 additions & 2 deletions benchmarks/map/map.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
(define lst (map (lambda (x) (+ x 1)) (range 0 10000)))
(define r (range 0 100000))

(displayln (length lst))
(define results (mutable-vector))

(define (loop x)
(if (= x 100)
void
(begin
(vector-push! results (map (lambda (x) (+ x 1)) r))
(loop (+ x 1)))))

(provide run)
(define (run)
(loop 0))

; (define lst (map (lambda (x) (+ x 1)) r))

; (displayln (length lst))
23 changes: 17 additions & 6 deletions crates/steel-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ futures-task = "0.3.28"
serde_json = "1.0.108"
serde = { version = "1.0.193", features = ["derive", "rc"] }
bincode = "1.3.3"
im-lists = "0.12.1"
# im-lists = "0.12.1"

im-lists = { path = "../../../im-lists" }

strsim = "0.11.0"
steel-quickscope = { path = "../quickscope", version = "0.3.2" }
Expand All @@ -41,6 +43,9 @@ rustc-hash = "2.1.1"
steel-gen = { path = "../steel-gen", version = "0.8.2" }
steel-parser = { path = "../steel-parser", version = "0.8.2" }
steel-derive = { path = "../steel-derive", version = "0.8.2" }

steel-vec = { path = "../steel-vec", version = "0.8.2" }

cargo-steel-lib = { path = "../cargo-steel-lib", version = "0.8.2", optional = true }
chrono = { version = "0.4.23", default-features = false, features = ["std", "clock"], optional = true }
env_home = "0.1.0"
Expand All @@ -66,10 +71,13 @@ steel-rc = { path = "../steel-rc", version = "0.8.2", optional = true }
abi_stable = { version = "0.11.2", optional = true }
async-ffi = { version = "0.5.0", features = ["abi_stable"], optional = true }
# Cranelift JIT
cranelift = { version = "0.119", optional = true }
cranelift-module = { version = "0.119", optional = true }
cranelift-jit = { version = "0.119", optional = true }
cranelift-native = { version = "0.119", optional = true }
cranelift = { version = "0.130", optional = true }
cranelift-module = { version = "0.130", optional = true }
cranelift-jit = { version = "0.130", optional = true }
cranelift-native = { version = "0.130", optional = true }
object = { version = "*" }
target-lexicon = "*"
rustix = { version = "1", features = ["thread"] }

anyhow = { version = "1", optional = true }

Expand Down Expand Up @@ -110,6 +118,9 @@ icu_casemap = "2.0.0"

thin-vec = { version = "0.2.14", features = ["serde"] }

[target.'cfg(target_os = "linux")'.dependencies]
wasmtime-jit-debug = { version = "34", optional = true, features = ["perf_jitdump"] }

[target.'cfg(target_family = "wasm")'.dependencies]
getrandom = { version = "0.3.1", features = ["wasm_js"] }
js-sys = "0.3.69"
Expand Down Expand Up @@ -161,7 +172,7 @@ biased = ["dep:steel-rc"]


ffi-format = []
jit2 = ["dep:cranelift", "dep:cranelift-module", "dep:cranelift-jit", "dep:cranelift-native"]
jit2 = ["dep:cranelift", "dep:cranelift-module", "dep:cranelift-jit", "dep:cranelift-native", "dep:wasmtime-jit-debug"]

[[bench]]
name = "my_benchmark"
Expand Down
Loading