[Custom Descriptors] Exact function imports#8033
Conversation
Since finalization already looks up the function on the module to determine whether it is imported, go further and just take the type directly from the function.
Binary and text parsing a printing as well as validation of exact function imports. Importing a function exactly allows it to be referenced exactly, just like a defined function can be. Follow-up PRs will use exact function imports in various passes and tools.
|
|
||
| // The kind of an import or export. | ||
| enum class ExternalKind { | ||
| enum class ExternalKind : uint32_t { |
There was a problem hiding this comment.
Actually this might not be necessary at all since it wasn't enough to prevent the casts on switch cases from being necessary in wasm-binary.cpp.
| break; | ||
| } | ||
| case ExternalKind::Tag: { | ||
| case (uint32_t)ExternalKind::Tag: { |
There was a problem hiding this comment.
(though, is the typedef type worth it, if it forces these annotations?)
There was a problem hiding this comment.
Because we use an enum class, the enum values are not implicitly convertible to uint32_t, which is really annoying when we need to handle the extra bit or'd in.
| @@ -0,0 +1,97 @@ | |||
| ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | |||
|
|
|||
| ;; RUN: wasm-opt %s -all -o %t.text.wast -g -S | |||
There was a problem hiding this comment.
It's used with prefix CHECK_TEXT below.
|
Let me know what you think of the scheme in the latest commit. It's an ugly declaration, but it does what we want at the use sites. |
|
Seems ok to me. Maybe update But weird C++ forces this... I'd expect the enum class with type int to convert automatically to int? |
You would hope, but apparently not :( |
|
I've fixed the ubsan error and updated |
|
Fair enough, I'm ok without it. |
Binary and text parsing a printing as well as validation of exact
function imports. Importing a function exactly allows it to be
referenced exactly, just like a defined function can be.
Follow-up PRs will use exact function imports in various passes and
tools.