[PATCH] D121349: [WebAssembly] Second phase of implementing extended const proposal.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 11:34:28 PST 2022


sbc100 added a comment.

In D121349#3373299 <https://reviews.llvm.org/D121349#3373299>, @dschuff wrote:

> I assume these `llvm_unreachables` your're adding in this CL are the places that will be filled in in subsequent CLs?

Yup.. they represent places where we don't currently handle extended const.. but we will do soon.



================
Comment at: llvm/lib/Object/WasmObjectFile.cpp:200
+  if (!Expr.Extended) {
+    uint8_t EndOpcode = readOpcode(Ctx);
+    if (EndOpcode != wasm::WASM_OPCODE_END)
----------------
dschuff wrote:
> this is a bit confusing. If there's just a const/global.get/ref.null followed by an end, it's MVP, otherwise it's extended. But can there be 2 consts in a row? Seems like that would also be accepted here? and then line 208 would read a 3rd opcode?
Line 206 resets the the read pointer back to the start of the init expr.

Its kind of sad we have to actually parse of the initexpr here.  Turns out that because the initexpr doesn't encode its own length (unlike a function) it cannot be skipped over which means that is not possible to write a file decoder that doesn't also have an instruction decodeer :(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121349/new/

https://reviews.llvm.org/D121349



More information about the llvm-commits mailing list