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 native compilation of HOL Light, add unit tests #114

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

aqjune-aws
Copy link
Contributor

This patch adds support for native compilation of HOL Light. If HOLLIGHT_USE_MODULE is set to 1, make inlines loads in hol_lib.ml and compiles into hol_lib.cmx and hol_lib.cmxa.

The stack overflow error is a hurdle when compiling the code using ocamlopt. To avoid this error, make uses ocamlopt.byte which is a bytecode version of ocamlopt and distributed by the current OPAM switch. Combined with OCAMLRUNPARAM=l=<some large number> which sets the maximum stack size for OCaml bytecode runners, this successfully compiles hol_lib. However, it could not still compile a significantly large project such as Multivariate. One possible approach is to chop the inlined .ml file into multiple smaller .ml files and compile each of them, but this makes the inliner script complicated which could be a concern...

This patch also adds unit_tests.ml, and when HOLLIGHT_USE_MODULE is set, compiles it into a bytecode and native executable.
It currently contains simple checks of the verbose quantifiers and constants, but it can contain more interesting sanity checks in the future.

The CI check is also updated to make with HOLLIGHT_USE_MODULE set to 1 and run the unit tests.
OCaml 4.05 CI check had been broken, and this is fixed too.

@aqjune aqjune force-pushed the nativecomp branch 4 times, most recently from bea0979 to a19eac8 Compare October 9, 2024 05:29
@aqjune-aws aqjune-aws marked this pull request as ready for review October 9, 2024 13:42
This patch adds support for native compilation of HOL Light.
If `HOLLIGHT_USE_MODULE` is set to 1, `make` inlines loads in hol_lib.ml
and compiles into hol_lib.cmx and hol_lib.cmxa.

The stack overflow error is a hurdle when compiling the code using `ocamlopt`.
To avoid this error, `make` uses `ocamlopt.byte` which is a bytecode version of
`ocamlopt` and distributed by the current OPAM switch.
Combined with `OCAMLRUNPARAM=l=<some large number>` which sets the maximum stack
size for OCaml bytecode runners, this successfully compiles hol_lib.
However, it could not still compile a significantly large project such as
Multivariate. One possible approach is to chop the inlined .ml file into multiple
smaller .ml files and compile each of them, but this makes the inliner script
complicated which could be a concern...

This patch also adds unit_tests.ml, and when `HOLLIGHT_USE_MODULE` is set, compiles
it into a bytecode and native executable.
It currently contains simple checks of the verbose quantifiers and constants,
but it can contain more interesting sanity checks in the future.

The CI check is also updated to make with `HOLLIGHT_USE_MODULE` set to 1
and run the unit tests.
OCaml 4.05 CI check had been broken, and this is fixed too.
Copy link
Owner

@jrh13 jrh13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good now, thank you!

@jrh13 jrh13 merged commit a58b904 into jrh13:master Oct 10, 2024
2 checks passed
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.

2 participants