Simplify emitter::Label - Only bytecode_emitter cares about DV labels
commit7d731ee86104a8a3175384a8073038cc4929a274
authorEdwin Smith <smith@fb.com>
Sat, 19 Feb 2022 12:34:03 +0000 (19 04:34 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Sat, 19 Feb 2022 13:23:01 +0000 (19 05:23 -0800)
tree9d7f65db434098d86adfe6cd4c6ef0f61e0061a8
parent508210c3eea00028636e9f0b942580d6a72f9a24
Simplify emitter::Label - Only bytecode_emitter cares about DV labels

Summary:
Currently the enum Label has variants for regular labels and default-arg labels,
and bytecode_printer formats them with "L" or "DV" prefixes respectively,
although the numbering space of LabelIds doesn't care -- the LabelId values
are unique regardless of the kind.

The HHAS assembler doesn't care either; it just builds a map from string labels
to bytecode offsets.

This diff pushes the L vs DV details down into bytecode_printer and simplifies
the Label enum down to just what was previously the LabelId. It also refactors
some label handling code to be more obvious what it's doing, as a side effect
of my attempts to understand it.

As a followup diff that *does* change HHAS (with no effect on bytecode), we could
just rip out the DV stuff and format all labels the same way.

Reviewed By: aorenste

Differential Revision: D34282597

fbshipit-source-id: 90088aa9c81aec481fe3b273313434c6f6ff5192
hphp/hack/Cargo.lock
hphp/hack/src/hackc/bytecode_printer/Cargo.toml
hphp/hack/src/hackc/bytecode_printer/print.rs
hphp/hack/src/hackc/emitter/emit_body.rs
hphp/hack/src/hackc/emitter/emit_param.rs
hphp/hack/src/hackc/emitter/label.rs
hphp/hack/src/hackc/emitter/label_rewriter.rs