Use Zero-Sized Type for Dummy type
commit4b2e77105daa9b4c0996efcaaa14fd80ae260c31
authorKaty Voor <voork@fb.com>
Sun, 22 May 2022 08:07:56 +0000 (22 01:07 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Sun, 22 May 2022 08:07:56 +0000 (22 01:07 -0700)
treea1ccfff4e5aab24c7b595bd1d95f1dfe119c8201
parent25385a8d45b77e0f257804814c0afb366702f9b7
Use Zero-Sized Type for Dummy type

Summary:
Currently, for MemoGetEager, we pass both Labels to the first `BA` in the form of a Label Slice. The second `BA` that is specified in `opcodes.h` is just a dummy immediate. We previously set this to be `u8`, but this was being implicitly converted to a `u32` since Label is `repr(transparent)` , and Label is a struct with one `u32` field.
> repr(transparent): The effect is that the layout and ABI of the whole struct is guaranteed to be the same as that one field.

If we make `Dummy` an empty struct, it cannot be implicitly converted to `uin32_t`, and takes up no space in rust, (though it does take up 1 byte in C++).

Reviewed By: aorenste

Differential Revision: D36561303

fbshipit-source-id: 61c2cb67828f8763586d28b68843e62294f14dd8
hphp/hack/src/hackc/bytecode_printer/print_opcode.rs
hphp/hack/src/hackc/emitter/instruction_sequence.rs
hphp/hack/src/hackc/hhbc/emit_opcodes.rs
hphp/hack/src/hackc/hhbc/hhbc_ast.rs
hphp/hack/src/hackc/hhbc/lib.rs
hphp/hack/src/hackc/hhbc/opcodes.rs