Title: [293314] trunk/Source/_javascript_Core
- Revision
- 293314
- Author
- [email protected]
- Date
- 2022-04-24 23:36:11 -0700 (Sun, 24 Apr 2022)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (293313 => 293314)
--- trunk/Source/_javascript_Core/ChangeLog 2022-04-25 06:29:19 UTC (rev 293313)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-04-25 06:36:11 UTC (rev 293314)
@@ -1,3 +1,24 @@
+2022-04-24 Dmitry Bezhetskov <[email protected]>
+
+ [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):
+
2022-04-24 Zan Dobersek <[email protected]>
[RISCV64] Implement MacroAssemblerRISCV64 fencing methods
Modified: trunk/Source/_javascript_Core/wasm/generateWasmOpsHeader.py (293313 => 293314)
--- trunk/Source/_javascript_Core/wasm/generateWasmOpsHeader.py 2022-04-25 06:29:19 UTC (rev 293313)
+++ trunk/Source/_javascript_Core/wasm/generateWasmOpsHeader.py 2022-04-25 06:36:11 UTC (rev 293314)
@@ -56,11 +56,21 @@
yield cppMacro(ty, wasm.types[ty]["value"], wasm.types[ty]["b3type"], inc, ty)
inc += 1
+
+def typeMacroizerFiltered(filter):
+ for t in typeMacroizer():
+ if not filter(t):
+ yield t
+
type_definitions = ["#define FOR_EACH_WASM_TYPE(macro)"]
type_definitions.extend([t for t in typeMacroizer()])
type_definitions = "".join(type_definitions)
+type_definitions_except_funcref_externref = ["#define FOR_EACH_WASM_TYPE_EXCEPT_FUNCREF_AND_EXTERNREF(macro)"]
+type_definitions_except_funcref_externref.extend([t for t in typeMacroizerFiltered(lambda x: x == "funcref" or x == "externref")])
+type_definitions_except_funcref_externref = "".join(type_definitions_except_funcref_externref)
+
def opcodeMacroizer(filter, opcodeField="value", modifier=None):
inc = 0
for op in wasm.opcodeIterator(filter):
@@ -206,7 +216,8 @@
static constexpr unsigned numTypes = """ + str(len(types)) + """;
-""" + type_definitions + """
+""" + type_definitions + "\n" + """
+""" + type_definitions_except_funcref_externref + """
#define CREATE_ENUM_VALUE(name, id, ...) name = id,
enum class TypeKind : int8_t {
FOR_EACH_WASM_TYPE(CREATE_ENUM_VALUE)
@@ -240,8 +251,10 @@
return static_cast<bool>(nullable);
}
+ // Use Wasm::isFuncref and Wasm::isExternref instead because they check againts all kind of representations of function referenes and external references.
+
#define CREATE_PREDICATE(name, ...) bool is ## name() const { return kind == TypeKind::name; }
- FOR_EACH_WASM_TYPE(CREATE_PREDICATE)
+ FOR_EACH_WASM_TYPE_EXCEPT_FUNCREF_AND_EXTERNREF(CREATE_PREDICATE)
#undef CREATE_PREDICATE
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes