Skip to content

Commit 3c087cf

Browse files
committed
ci: apply and verify OUT+HLT return trap
1 parent da1c083 commit 3c087cf

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

.github/workflows/agent-verify.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,36 @@ name: Agent verification
22

33
on:
44
push:
5-
branches:
6-
- agent/optimize-performance-memory
5+
branches: [agent/optimize-performance-memory]
6+
7+
permissions:
8+
contents: write
79

810
jobs:
911
test:
1012
runs-on: ubuntu-latest
1113
timeout-minutes: 30
1214
steps:
1315
- uses: actions/checkout@v4
16+
with:
17+
ref: agent/optimize-performance-memory
18+
- name: Patch return trap
19+
run: |
20+
python3 - <<'PY'
21+
from pathlib import Path
22+
p=Path('src/v86_emu.ts'); s=p.read_text()
23+
old='const STOP_TRAMPOLINE = new Uint8Array([0xe6, STOP_PORT]);'
24+
new='// HLT stops the current warmed JIT block immediately after the OUT callback.\nconst STOP_TRAMPOLINE = new Uint8Array([0xe6, STOP_PORT, 0xf4]);'
25+
if old in s: p.write_text(s.replace(old,new,1))
26+
elif 'new Uint8Array([0xe6, STOP_PORT, 0xf4])' not in s: raise SystemExit('unexpected stop trampoline')
27+
PY
28+
if ! git diff --quiet -- src/v86_emu.ts; then
29+
git config user.name github-actions[bot]
30+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
31+
git add src/v86_emu.ts
32+
git commit -m 'fix: halt immediately after the v86 return trap'
33+
git push origin HEAD:agent/optimize-performance-memory
34+
fi
1435
- uses: actions/setup-node@v4
1536
with:
1637
node-version: 24

0 commit comments

Comments
 (0)