-
Notifications
You must be signed in to change notification settings - Fork 435
ParparVM: make the translator self-hosting, and fix what that exposed #5766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
da3e292
87be20f
9ebb174
842bc63
6263a35
fff6f53
0077691
82a710a
3f20c45
3f1bee7
d12892d
6069535
f44235f
118044d
01643b7
a57b3ec
b236ee3
28e62d6
f0718e6
68503d5
2ad038a
a5ec187
7d1b503
718aa7b
036daff
25205a8
2700998
84065db
7d8754b
c81f41d
f00db7e
8275e5b
ea47102
4333174
1b2cbfb
670fb6c
73a49fc
a995987
3c32a10
7a4b086
8483268
a86b7cd
7eaab0b
ef5b6f9
2f6748b
628c0da
c66da37
ed057be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| name: ParparVM Self-Hosting | ||
|
|
||
| # Translates the ByteCodeTranslator with itself and compares the result against | ||
| # the same translation run on a JVM. | ||
| # | ||
| # What this buys that the existing suites do not: ByteCodeTranslator is a 37.6k | ||
| # line real program that hammers collections, strings, exceptions, file I/O and | ||
| # the GC at a scale no unit test reaches, and the emitted C is a byte-exact | ||
| # expected value that costs nothing to maintain -- it is whatever the JVM | ||
| # produced from the same inputs. A VM defect that changes behaviour rather than | ||
| # crashing (a wrong hash order, a dropped write barrier, a mis-mangled symbol) | ||
| # shows up as a diff instead of passing silently. | ||
| # | ||
| # Gates, cheapest first: | ||
| # D native vs native, two fresh processes, same input. If the native side is | ||
| # not self-consistent nothing else means anything, so it runs first. | ||
| # A JVM vs native over the same corpus. The headline. | ||
| # Negative control: after a green comparison one emitted byte is flipped and | ||
| # the comparator MUST report exactly that file. A comparator nobody has | ||
| # watched fail is not a comparator. | ||
| # | ||
| # Not on the PR leg by default: a full run builds the translator twice and | ||
| # translates a large corpus several times. It runs nightly, on demand, and on a | ||
| # PR that opts in with the `selfhost` label. | ||
|
|
||
| on: | ||
| schedule: | ||
| # 04:20 UTC daily, off the hour to avoid the runner rush. | ||
| - cron: '20 4 * * *' | ||
| workflow_dispatch: | ||
| pull_request: | ||
| types: [ opened, synchronize, reopened, labeled ] | ||
| paths: | ||
| - 'vm/**' | ||
| - '.github/workflows/parparvm-selfhost.yml' | ||
| - '!vm/**/README.md' | ||
| - '!vm/**/docs/**' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| CN1_NATIVE_VERIFY: strict | ||
|
|
||
| jobs: | ||
| selfhost: | ||
| # On a pull_request only when the author asked for it; the schedule and | ||
| # workflow_dispatch legs always run. | ||
| if: >- | ||
| github.event_name != 'pull_request' || | ||
| contains(github.event.pull_request.labels.*.name, 'selfhost') | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 120 | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Install native build tools | ||
| run: | | ||
| bash scripts/ci/apt-get-update.sh | ||
| sudo apt-get install -y clang | ||
|
|
||
| - name: Set up JDK 8 | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '8' | ||
| cache: 'maven' | ||
| - name: Save JDK 8 path | ||
| run: echo "JDK_8_HOME=$JAVA_HOME" >> $GITHUB_ENV | ||
|
|
||
| # The translator has to exist as classes before it can translate itself. | ||
| - name: Build the translator | ||
| run: scripts/ci/retry.sh mvn -q -B -pl ByteCodeTranslator -am package -DskipTests | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the new self-host workflow runs, this step executes with Useful? React with 👍 / 👎. |
||
| working-directory: vm | ||
|
|
||
| - name: Resolve the ASM classpath | ||
| run: >- | ||
| scripts/ci/retry.sh mvn -q -B -pl ByteCodeTranslator | ||
| dependency:build-classpath | ||
| -Dmdep.outputFile=target/selfhost-asm-classpath.txt | ||
| working-directory: vm | ||
|
|
||
| # -O1: the diff gates care about the EMITTED C, not about how well clang | ||
| # optimised the binary that emitted it, and -O1 links several times faster. | ||
| # Mark threads are set explicitly rather than left to the source default, | ||
| # which resolves to a single marker and makes a large corpus take hours. | ||
| - name: Build the self-hosted translator | ||
| run: vm/selfhost/build-selfhost.sh | ||
| env: | ||
| CN1_SELFHOST_CFLAGS: -DCN1_GC_MARK_THREADS=4 | ||
|
|
||
| # The corpus is the translator's OWN classes plus ASM. verify-selfhost.sh | ||
| # prepends vm/selfhost/target/javaapi-classes itself, so it is not repeated | ||
| # here. Absolute paths: the script runs both sides under `env -i` into one | ||
| # fixed output directory, so a relative path would not survive. | ||
| - name: Gate D and Gate A, with the negative control | ||
| run: | | ||
| vm/selfhost/verify-selfhost.sh \ | ||
| "$PWD/vm/selfhost/target/asm-classes;$PWD/vm/selfhost/target/classes" \ | ||
| com_codename1_tools_translator_ByteCodeTranslator \ | ||
| com.codename1.tools.translator | ||
|
|
||
| # Both trees, so a divergence can be inspected rather than guessed at from | ||
| # a one-line summary. | ||
| - name: Upload the compared trees on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: selfhost-trees | ||
| path: | | ||
| vm/selfhost/target/verify/jvm-tree | ||
| vm/selfhost/target/verify/parpar1-tree | ||
| vm/selfhost/target/verify/parpar2-tree | ||
| vm/selfhost/target/verify/*.txt | ||
| vm/selfhost/target/verify/*.log | ||
| retention-days: 7 | ||
| if-no-files-found: ignore | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fresh evidence in the final diff is that the new musl leg writes each raw core directly under
raw-musl, and the laterUpload musl screenshotsstep uploads that entire directory without compression or removal. When this suite produces a multi-gigabyte core, the upload can exhaust runner disk or artifact time and prevent the screenshots and generated backtrace from being retained; write cores outside the screenshot tree and package them separately with compression.Useful? React with 👍 / 👎.