Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a86/native/prebuilt/** binary
a86/native/prebuilt/** -merge
65 changes: 65 additions & 0 deletions .github/workflows/build-prebuilt-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Prebuilt Linux Binary
on: [push, workflow_dispatch]

permissions:
contents: write
pull-requests: write

jobs:
build-prebuilt-linux:
runs-on: ubuntu-22.04
name: Build Linux prebuilt / Racket 8.18

steps:
- name: Checkout
uses: actions/checkout@main

- name: Install Racket
uses: Bogdanp/setup-racket@v1.15
with:
architecture: x64
distribution: full
variant: CS
version: "8.18"

- name: Install LLVM
uses: ZhongRuoyu/setup-llvm@v0
with:
llvm-version: 22

- name: Install native build dependencies
run: |
sudo apt update
sudo apt install -y libxml2-dev zlib1g-dev libzstd-dev

- name: Build native JIT library
run: |
make -C a86/native clean all LLVM_CONFIG=llvm-config

- name: Stage packaged prebuilt library
run: |
racket a86/native/stage-prebuilt.rkt

- name: Check packaged shared object linkage
run: |
ldd a86/native/prebuilt/unix/x86_64/liba86_jit.so

- name: Upload packaged shared object
uses: actions/upload-artifact@v4
with:
name: a86-prebuilt-linux-x86_64
path: a86/native/prebuilt/unix/x86_64/liba86_jit.so
if-no-files-found: error

- name: Create pull request for updated shared object
uses: peter-evans/create-pull-request@v8
with:
branch: update-prebuilt-linux-x86_64
delete-branch: true
commit-message: Update Linux x86_64 prebuilt JIT library
title: Update Linux x86_64 prebuilt JIT library
body: |
Rebuilds `a86/native/prebuilt/unix/x86_64/liba86_jit.so`
using the `Build Prebuilt Linux Binary` workflow on GitHub Actions.
add-paths: |
a86/native/prebuilt/unix/x86_64/liba86_jit.so
61 changes: 61 additions & 0 deletions .github/workflows/build-prebuilt-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build Prebuilt macOS Binary
on: [push, workflow_dispatch]

permissions:
contents: write
pull-requests: write

jobs:
build-prebuilt-macos:
runs-on: macos-26-intel
name: Build macOS prebuilt / Racket 8.18

steps:
- name: Checkout
uses: actions/checkout@main

- name: Install Racket
uses: Bogdanp/setup-racket@v1.15
with:
architecture: 'x64'
distribution: 'full'
variant: 'CS'
version: '8.18'

- name: Install native build dependencies
run: |
brew install llvm@22 zstd z3

- name: Build native JIT library
run: |
export PATH="/usr/local/opt/llvm@22/bin:$PATH"
make -C a86/native clean all LLVM_CONFIG=llvm-config

- name: Stage packaged prebuilt library
run: |
export PATH="/usr/local/opt/llvm@22/bin:$PATH"
racket a86/native/stage-prebuilt.rkt

- name: Check packaged dylib linkage
run: |
otool -L a86/native/prebuilt/macosx/x86_64/liba86_jit.dylib

- name: Upload packaged dylib
uses: actions/upload-artifact@v4
with:
name: a86-prebuilt-macos-x86_64
path: a86/native/prebuilt/macosx/x86_64/liba86_jit.dylib
if-no-files-found: error

- name: Create pull request for updated dylib
uses: peter-evans/create-pull-request@v8
with:
branch: update-prebuilt-macos-x86_64
delete-branch: true
commit-message: Update macOS x86_64 prebuilt JIT library
title: Update macOS x86_64 prebuilt JIT library
body: |
Rebuilds `a86/native/prebuilt/macosx/x86_64/liba86_jit.dylib`
using the `Build Prebuilt macOS Binary` workflow on GitHub Actions.
add-paths: |
a86/native/prebuilt/macosx/x86_64/liba86_jit.dylib
9 changes: 5 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ jobs:
uses: actions/checkout@main

- name: Install Racket
uses: Bogdanp/setup-racket@v1.14
uses: Bogdanp/setup-racket@v1.15
with:
architecture: 'x64'
distribution: 'full'
variant: ${{ matrix.racket-variant }}
version: ${{ matrix.racket-version }}

- name: Install clang
run: |
sudo apt install -y clang libssl-dev
- name: Install LLVM
uses: ZhongRuoyu/setup-llvm@v0
with:
llvm-version: 22

- name: Install pandoc
run: |
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/prebuilt-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test Prebuilt macOS Binary
on: [push, workflow_dispatch]

jobs:
test-prebuilt-macos:
runs-on: macos-26-intel
name: macOS prebuilt / Racket 8.18

steps:
- name: Checkout
uses: actions/checkout@main

- name: Install Racket
uses: Bogdanp/setup-racket@v1.15
with:
architecture: 'x64'
distribution: 'full'
variant: 'CS'
version: '8.18'

- name: Install a86 package
run: |
raco pkg install --no-docs ../a86/

- name: Verify prebuilt library was installed
run: |
test -f a86/native/prebuilt/macosx/x86_64/liba86_jit.dylib
test -f a86/native/lib/liba86_jit.dylib

- name: Run tests
run: |
raco test -p a86
34 changes: 14 additions & 20 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on: [push, workflow_dispatch]
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
racket-variant: ['CS']
racket-version: ['8.6', '8.10', '8.14', '8.18', 'stable', 'current']
racket-version: ['8.6', '8.10', '8.14', '8.18', '9.1', 'stable', 'current']
runs-on: ${{ matrix.os }}
name: OS ${{ matrix.os }} / Racket ${{ matrix.racket-version }}

Expand All @@ -17,42 +18,35 @@ jobs:
uses: actions/checkout@main

- name: Install Racket
uses: Bogdanp/setup-racket@v1.14
uses: Bogdanp/setup-racket@v1.15
with:
architecture: 'x64'
distribution: 'full'
variant: ${{ matrix.racket-variant }}
version: ${{ matrix.racket-version }}

- name: Install clang
run: |
sudo apt install -y clang libssl-dev

- name: Version info
run: |
clang --version
gcc --version

- name: Cache Racket packages
uses: actions/cache@v4
with:
path: |
~/.racket
~/.cache/racket
~/.local/share/racket
~/Library/Caches/Racket
key: racket-${{ matrix.racket-variant }}-${{ matrix.racket-version }}-${{ matrix.os }}

- name: Install a86 package
run: |
raco pkg install --no-docs ../a86/

- name: Install langs package
run: |
# This *should* use the locally installed a86
raco pkg install --auto 'https://github.com/cmsc430/langs.git?#main'
git clone --branch "${{ github.ref_name }}" --single-branch https://github.com/cmsc430/langs.git ../langs
raco pkg install --auto --no-docs ../langs/

- name: Install libssl
run: |
sudo apt install -y libssl-dev

- name: Run a86 tests
run: |
raco test -p a86

- name: Run tests
- name: Run langs tests
run: |
xvfb-run raco test -p a86
xvfb-run raco test -p langs
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ Mkfile.old
dkms.conf

# debug information files
*.dwo
*.dwo
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# a86

`a86` is a Racket package for composing, printing, interpreting, and running x86-64 assembly programs from Racket.

## Installation

Install from GitHub with:

```bash
raco pkg install https://github.com/cmsc430/a86.git
```

## Notes

This package includes prebuilt native JIT libraries for Linux and macOS on `x86_64`, so most installs do not need a local native build toolchain.

Documentation is published at:

https://cmsc430.github.io/a86/
32 changes: 32 additions & 0 deletions a86/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Developer Notes

This directory contains the `a86` collection, including the native JIT support under `native/`.

## Building Native Libraries Locally

Local native builds are only needed when you want to rebuild or restage the JIT libraries instead of using the packaged prebuilt artifacts.

You will need:

- `x86_64` Racket
- `make` or `gmake`
- a C++17 compiler (`clang++` by default in `native/Makefile`)
- LLVM with `llvm-config` available on `PATH`

The GitHub workflows currently build against LLVM 22.

From [`a86/native`](/Users/dvanhorn/git/a86/a86/native), run:

```bash
make
```

This produces the shared library in `a86/native/lib/`.

If you want to refresh the packaged prebuilt layout after building, run:

```bash
racket a86/native/stage-prebuilt.rkt
```

At package install time, `a86/pre-install.rkt` first tries to copy a matching prebuilt library and only falls back to `make` when no packaged binary is available for the target OS and architecture.
9 changes: 0 additions & 9 deletions a86/check-x86.rkt

This file was deleted.

6 changes: 4 additions & 2 deletions a86/info.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
(define deps (list "base" "rackunit" "redex-lib" "redex-gui-lib"))
(define scribblings '(("scribblings/a86.scrbl")))
(define test-omit-paths '("scribblings/"
"test/expressions.rkt"))
(define pre-install-collection "check-x86.rkt")
"test/expressions.rkt"
"test/sections.rkt"
"stepper.rkt"))
(define pre-install-collection "pre-install.rkt")
Loading