Skip to content

Instantly share code, notes, and snippets.

@JustinMeimar
Last active July 10, 2026 21:59
Show Gist options
  • Select an option

  • Save JustinMeimar/25253310ab5ed788be16e4d164639ea7 to your computer and use it in GitHub Desktop.

Select an option

Save JustinMeimar/25253310ab5ed788be16e4d164639ea7 to your computer and use it in GitHub Desktop.
AOT building and usage

Boostrapping Shell with AOT:

  1. An empty AOTBaselineStub.S scaffold is checked in, but not attached as build input. AOT dumps direct into AOTBaseline.S, which is a build input. First step is: cp js/src/jit/AOTBaselineStub.S js/src/jit/AOTBaseline.S

  2. I have some mozconfigs here, but the only option necessary is: ac_add_options --enable-aot. Then ./mach configure && ./mach build

  3. Dumping AOT:

    IONFLAGS=bl-aot ./js --aot-dump-baseline --aot-dump-ics --aot-dump-self-hosted -e 'quit(0);'
    

    Should see 0 ics for now, one interp and all the self-hosted functions.

  4. Bootstrap: Run ./mach build, you should see: js/src/jit/AOTBaseline.o compiled

  5. Running shell tests: python3 ./jit-test/jit_test.py --args="--aot" ../../js Two expected failures: blinterp-trial-inlining.js and ion/recover-objects.js. Former due to baked in blinterp options from the dump, the later due to a broken assertion.

  6. Collecting AOT ics: I have some corpi here but ICs can also be collected from the shell:

    AOT_ICS_DUMP_MISSING_DIR=js/src/ics AOT_ICS_KEEP_GOING=1 \
     ./js --aot --aot-ics-enforce -f {{FILE}}
    

    Then mv IC-* js/src/ics and rebuilding will produced the generated AOT CacheIR files (Chris Fallins infra)

Bootstrapping Browser:

  1. First bootstrap AOTBaseline.s against the shell same as before
  2. Building the browser will automatically pickup the AOT object
  3. Instruct usage of AOT with:
    JIT_OPTION_useAOTInterp=true JIT_OPTION_useAOTSelfHosted=true JIT_OPTION_useAOTICs=true \
     ./build-browser-release-aot/dist/bin/firefox --no-remote
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment