Skip to content
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

Support compilation to Javascript #90

Merged
merged 13 commits into from
Jul 1, 2024
Merged

Support compilation to Javascript #90

merged 13 commits into from
Jul 1, 2024

Conversation

katrinafyi
Copy link
Member

@katrinafyi katrinafyi commented Jun 19, 2024

This is an effort to enable compilation to Javascript via js-of-ocaml, to enable the partial evaluator to be run in the browser. It is anticipated that providing ASLp in the browser will enable greater ease of collaboration and help our work reach new audiences.

Work items required:

BREAKING: this moves the aarch64_evaluation_environment into the separate Arm_env module, instead of being in the Eval module.

Documentation:

@katrinafyi katrinafyi force-pushed the js-of-ocaml branch 3 times, most recently from d3d378b to de0cfaf Compare June 25, 2024 08:51
Z3 links to a native shared library, and so is unsuitable for use via js-of-ocaml. This separates the one use of Z3 in the code (the type-checker's constraint solver) into a separate library which may be stubbed for non-native platforms.

This separates libASL into two parts: libASL_ast which is the minimum needed to define the ASL syntax tree, and libASL which contains the rest of the library. libASL should still be used as the public interface of the library. Since libASL re-exports all of libASL_ast, this should not affect the API visible by downstream users.

This is required since we need to insert a platform-specific library, libASL_support, which introduces z3 only on native builds. The dependency tree now looks like: libASL_ast <- libASL_support (virtual) <- libASL.
PCRE relies on a shared library, precluding its use in Javascript.
instead, we use the standard ocaml "str" library. note, however,
that this supports a smaller subscript of regex (notably no negative
lookahead), and has a different syntax.

see: https://ocaml.org/manual/5.2/api/Str.html
* extract arm environment into separate file.

* allow loading files from either disk or memory

* use ppx_blob to embed ASL files instead of dune-site

This is instead of installing the ASL files to disk.
This should make the installation less liable to random
breakages when installed or linked in an unexpected way.

The binary size increases by 6MB.

Updates tests/coverage/run.sh to substitute away the
new file paths of the embedded files, so no coverage
re-generation needed.

* replace --aarch64-dir with --export-aarch64

this is more useful once the MRA files are bundled.
necessary for correct unmarshalling, as this
must contain global variables
@katrinafyi katrinafyi marked this pull request as ready for review July 1, 2024 01:08
@katrinafyi katrinafyi changed the title [WIP] support compilation to Javascript Support compilation to Javascript Jul 1, 2024
@katrinafyi katrinafyi merged commit 4d0bac9 into partial_eval Jul 1, 2024
2 checks passed
katrinafyi added a commit to UQ-PAC/gtirb-semantics that referenced this pull request Jul 1, 2024
katrinafyi added a commit to UQ-PAC/gtirb-semantics that referenced this pull request Jul 1, 2024
@katrinafyi katrinafyi deleted the js-of-ocaml branch July 9, 2024 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant