⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 293314 in webkit


Ignore:
Timestamp:
Apr 24, 2022, 11:36:11 PM (4 years ago)
Author:
dbezhetskov
Message:

[Wasm] Remove confusing isFuncref and isExternref
https://bugs.webkit.org/show_bug.cgi?id=239699

Reviewed by Yusuke Suzuki.

There are two functions with the same name Wasm::Type::isFuncref and
Wasm::isFuncref but with different behaviour, and so,
this brings confusion into the codebase.
The first function checks that .kind == funcref and the second one checks
for the same but with respect to typed function references proposal.
The second one should be used when we want to check that type is funcref,
so the first one is not needed and actually not used, so this patch removes it.

The same situation is for isExternref.

  • wasm/generateWasmOpsHeader.py:

(typeMacroizer):
(typeMacroizerFiltered):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r293313 r293314  
     12022-04-24  Dmitry Bezhetskov  <dbezhetskov@igalia.com>
     2
     3        [Wasm] Remove confusing isFuncref and isExternref
     4        https://bugs.webkit.org/show_bug.cgi?id=239699
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        There are two functions with the same name Wasm::Type::isFuncref and
     9        Wasm::isFuncref but with different behaviour, and so,
     10        this brings confusion into the codebase.
     11        The first function checks that .kind == funcref and the second one checks
     12        for the same but with respect to typed function references proposal.
     13        The second one should be used when we want to check that type is funcref,
     14        so the first one is not needed and actually not used, so this patch removes it.
     15
     16        The same situation is for isExternref.
     17
     18        * wasm/generateWasmOpsHeader.py:
     19        (typeMacroizer):
     20        (typeMacroizerFiltered):
     21
    1222022-04-24  Zan Dobersek  <zdobersek@igalia.com>
    223
  • trunk/Source/JavaScriptCore/wasm/generateWasmOpsHeader.py

    r292773 r293314  
    5757        inc += 1
    5858
     59
     60def typeMacroizerFiltered(filter):
     61    for t in typeMacroizer():
     62        if not filter(t):
     63            yield t
     64
    5965type_definitions = ["#define FOR_EACH_WASM_TYPE(macro)"]
    6066type_definitions.extend([t for t in typeMacroizer()])
    6167type_definitions = "".join(type_definitions)
     68
     69type_definitions_except_funcref_externref = ["#define FOR_EACH_WASM_TYPE_EXCEPT_FUNCREF_AND_EXTERNREF(macro)"]
     70type_definitions_except_funcref_externref.extend([t for t in typeMacroizerFiltered(lambda x: x == "funcref" or x == "externref")])
     71type_definitions_except_funcref_externref = "".join(type_definitions_except_funcref_externref)
    6272
    6373
     
    207217static constexpr unsigned numTypes = """ + str(len(types)) + """;
    208218
    209 """ + type_definitions + """
     219""" + type_definitions + "\n" + """
     220""" + type_definitions_except_funcref_externref + """
    210221#define CREATE_ENUM_VALUE(name, id, ...) name = id,
    211222enum class TypeKind : int8_t {
     
    241252    }
    242253
     254    // Use Wasm::isFuncref and Wasm::isExternref instead because they check againts all kind of representations of function referenes and external references.
     255
    243256    #define CREATE_PREDICATE(name, ...) bool is ## name() const { return kind == TypeKind::name; }
    244     FOR_EACH_WASM_TYPE(CREATE_PREDICATE)
     257    FOR_EACH_WASM_TYPE_EXCEPT_FUNCREF_AND_EXTERNREF(CREATE_PREDICATE)
    245258    #undef CREATE_PREDICATE
    246259};
Note: See TracChangeset for help on using the changeset viewer.