Skip to content

Commit 436f728

Browse files
authored
Merge pull request #4916 from unisonweb/fix/jit-EROR
Fix representation mismatches with jit `bug` messages
2 parents 9739cfe + 9cda0d3 commit 436f728

File tree

5 files changed

+44
-9
lines changed

5 files changed

+44
-9
lines changed

.github/workflows/ci-build-jit-binary.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ jobs:
5454
with:
5555
name: jit-source
5656
path: ${{ env.jit_src }}
57-
57+
5858
- name: cache/restore jit binaries
5959
id: cache-jit-binaries
6060
uses: actions/cache/restore@v4
6161
with:
6262
path: ${{ env.jit_dist }}
63-
key: jit-dist_${{matrix.os}}.racket_${{env.racket_version}}.jit-src_${{hashFiles(format('{0}/**.rkt',env.jit_src),format('{0}/**.ss',env.jit_src))}}.yaml_${{hashFiles('**/ci-build-jit-binary.yaml')}}
63+
key: jit-dist_${{matrix.os}}.racket_${{env.racket_version}}.jit-src_${{hashFiles(format('{0}/**/*.rkt',env.jit_src),format('{0}/**/*.ss',env.jit_src))}}.yaml_${{hashFiles('**/ci-build-jit-binary.yaml')}}
6464

6565
- name: cache racket dependencies
6666
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
@@ -81,8 +81,18 @@ jobs:
8181
if: runner.os == 'macOS' && steps.cache-jit-binaries.outputs.cache-hit != 'true'
8282
run: |
8383
brew install libb2
84-
racket_lib_dir="$(dirname "$(readlink -f "$(which raco)")")/../lib"
85-
ln -s "$(brew --prefix)"/lib/libb2.*.dylib "$racket_lib_dir/"
84+
brew_lib_dir=$(brew --prefix)/lib
85+
racket_lib_dir=$(dirname $(dirname $(readlink -f $(which raco))))/lib
86+
87+
# link libb2 if not already present/cached
88+
for dll in $brew_lib_dir/libb2.*.dylib; do
89+
file=$(basename "$dll")
90+
if [ ! -e "$racket_lib_dir/$file" ]; then
91+
ln -s "$brew_lib_dir/$file" "$racket_lib_dir/$file"
92+
else
93+
echo "$racket_lib_dir/$file" already exists.
94+
fi
95+
done
8696
8797
- name: build jit binary
8898
if: steps.cache-jit-binaries.outputs.cache-hit != 'true'
@@ -104,7 +114,7 @@ jobs:
104114
uses: actions/cache/save@v4
105115
with:
106116
path: ${{ env.jit_dist }}
107-
key: jit-dist_${{matrix.os}}.racket_${{env.racket_version}}.jit-src_${{hashFiles(format('{0}/**.rkt',env.jit_src),format('{0}/**.ss',env.jit_src))}}.yaml_${{hashFiles('**/ci-build-jit-binary.yaml')}}
117+
key: jit-dist_${{matrix.os}}.racket_${{env.racket_version}}.jit-src_${{hashFiles(format('{0}/**/*.rkt',env.jit_src),format('{0}/**/*.ss',env.jit_src))}}.yaml_${{hashFiles('**/ci-build-jit-binary.yaml')}}
108118

109119
- name: save jit binary
110120
uses: actions/upload-artifact@v4

scheme-libs/racket/unison/boot.ss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,5 +607,5 @@
607607
(define (exn:bug->exception b)
608608
(raise-unison-exception
609609
ref-runtimefailure:typelink
610-
(exn:bug-msg b)
610+
(string->chunked-string (exn:bug-msg b))
611611
(exn:bug-val b)))

scheme-libs/racket/unison/primops.ss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,11 +902,13 @@
902902
(define (unison-POp-LEQT s t) (bool (chunked-string<? s t)))
903903
(define (unison-POp-EQLU x y) (bool (universal=? x y)))
904904
(define (unison-POp-EROR fnm x)
905-
(let-values ([(p g) (open-string-output-port)])
906-
(put-string p (chunked-string->string fnm))
905+
(let-values
906+
([(p g) (open-string-output-port)]
907+
[(snm) (chunked-string->string fnm)])
908+
(put-string p snm)
907909
(put-string p ": ")
908910
(display (describe-value x) p)
909-
(raise (make-exn:bug fnm x))))
911+
(raise (make-exn:bug snm x))))
910912
(define (unison-POp-FTOT f)
911913
(define base (number->string f))
912914
(define dotted

unison-src/builtin-tests/jit-tests.output.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,18 @@ foo = do
4949
()
5050
5151
```
52+
This can also only be tested by separately running this test, because
53+
it is exercising the protocol that ucm uses to talk to the jit during
54+
an exception.
55+
56+
```ucm
57+
runtime-tests/selected> run.native testBug
58+
59+
💔💥
60+
61+
I've encountered a call to builtin.bug with the following
62+
value:
63+
64+
"testing"
65+
66+
```

unison-src/builtin-tests/jit-tests.tpl.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ foo = do
3434
.> run.native foo
3535
.> run.native foo
3636
```
37+
38+
This can also only be tested by separately running this test, because
39+
it is exercising the protocol that ucm uses to talk to the jit during
40+
an exception.
41+
42+
```ucm:error
43+
runtime-tests/selected> run.native testBug
44+
```

0 commit comments

Comments
 (0)