Remove ocamlvalue_macro
commit53af5b93b799e8acb1817a0f3c734a47ef73be79
authorJake Bailey (Hacklang) <jakebailey@fb.com>
Sun, 27 Oct 2019 00:20:58 +0000 (26 17:20 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sun, 27 Oct 2019 00:23:06 +0000 (26 17:23 -0700)
treeaca0fe11f6c7578d22bb1eaf0dbe3fe4a5c024aa
parent957e2d36622397bc7542e6c96bfd9428a98069fb
Remove ocamlvalue_macro

Summary:
We currently have four methods of converting between Rust and OCaml values (that I know of):

- the `ocaml` crate, which provides a few limited wrappers around OCaml runtime allocation functions. Since it calls into the OCaml runtime, the garbage collector may run, and we must be careful to keep values rooted while using it.
- `ToOcaml`, which was implemented for passing the CST from the Rust parser to OCaml. It passes around a SerializationContext containing a pointer to the OCaml source text, since we chose not to write those pointers into positioned tokens and trivia on the Rust side, but those fields still exist on the OCaml side. It is backed by `ocamlpool`, a library which allows us to allocate values on the OCaml heap without running the garbage collector (so that we need not root our values).
- `OcamlRep`, which was originally conceived as a means of allocating OCaml values into Rust-managed memory (coupled with generation of implementations using a procedural macro). It is now (after {D17864960}) a generic interface for allocating OCaml values and deserializing OCaml values into Rust values.
- `Ocamlvalue`, which used a similar approach to OcamlRep (i.e., a trait and a procedural macro) to allocate values using `ocamlpool`.

Now that `ocamlrep` can allocate values using `ocamlpool` (after {D17864957}), I think it would be nice to bring this number from four down to three. Replacing the Ocamlvalue trait with OcamlRep will also allow us to use types which implement OcamlRep in Rust binaries. This was difficult before because implementations of Ocamlvalue linked against the OCaml runtime (via `ocamlpool`).

This stack has removed all uses of the procedural macro for deriving implementations of the `Ocamlvalue` trait, so this diff removes the macro.

Reviewed By: losvald

Differential Revision: D18076616

fbshipit-source-id: fb9cb8803ab28e0b945631deeeee36dcedd9525c
hphp/hack/Cargo.lock
hphp/hack/src/generate_full_fidelity.ml
hphp/hack/src/parser/Cargo.toml
hphp/hack/src/parser/cargo/lowerer/Cargo.toml
hphp/hack/src/parser/operator.rs
hphp/hack/src/parser/operator_generated.rs
hphp/hack/src/utils/ocamlpool_rust/macro.rs [deleted file]
hphp/hack/src/utils/ocamlpool_rust/macro/Cargo.toml [deleted file]
hphp/hack/src/utils/ocamlpool_rust/test/runner.ml [deleted file]
hphp/hack/src/utils/ocamlpool_rust/test/tests.rs [deleted file]
hphp/hack/src/utils/ocamlpool_rust/test/utils.rs [deleted file]