diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-07-20 20:13:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-20 20:13:18 -0700 |
commit | da5035f893ce9e046f99cf3ede92b576024aa9da (patch) | |
tree | 9db48e77502a646d74ef1a9d11f9b8f0967ff856 /src/ir/module-splitting.cpp | |
parent | 1c53f7dd29e79bc1894959cad817b22f087689f7 (diff) | |
download | binaryen-da5035f893ce9e046f99cf3ede92b576024aa9da.tar.gz binaryen-da5035f893ce9e046f99cf3ede92b576024aa9da.tar.bz2 binaryen-da5035f893ce9e046f99cf3ede92b576024aa9da.zip |
Remove basic reference types (#4802)
Basic reference types like `Type::funcref`, `Type::anyref`, etc. made it easy to
accidentally forget to handle reference types with the same basic HeapTypes but
the opposite nullability. In principle there is nothing special about the types
with shorthands except in the binary and text formats. Removing these shorthands
from the internal type representation by removing all basic reference types
makes some code more complicated locally, but simplifies code globally and
encourages properly handling both nullable and non-nullable reference types.
Diffstat (limited to 'src/ir/module-splitting.cpp')
-rw-r--r-- | src/ir/module-splitting.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ir/module-splitting.cpp b/src/ir/module-splitting.cpp index dc04cdba2..e24dd6452 100644 --- a/src/ir/module-splitting.cpp +++ b/src/ir/module-splitting.cpp @@ -143,11 +143,11 @@ void TableSlotManager::addSlot(Name func, Slot slot) { TableSlotManager::TableSlotManager(Module& module) : module(module) { // TODO: Reject or handle passive element segments - auto it = std::find_if(module.tables.begin(), - module.tables.end(), - [&](std::unique_ptr<Table>& table) { - return table->type == Type::funcref; - }); + auto funcref = Type(HeapType::func, Nullable); + auto it = std::find_if( + module.tables.begin(), + module.tables.end(), + [&](std::unique_ptr<Table>& table) { return table->type == funcref; }); if (it == module.tables.end()) { return; } @@ -163,7 +163,7 @@ TableSlotManager::TableSlotManager(Module& module) : module(module) { // append new items at constant offsets after all existing items at constant // offsets. if (activeTableSegments.size() == 1 && - activeTableSegments[0]->type == Type::funcref && + activeTableSegments[0]->type == funcref && !activeTableSegments[0]->offset->is<Const>()) { assert(activeTableSegments[0]->offset->is<GlobalGet>() && "Unexpected initializer instruction"); |