[webkit-reviews] review denied: [Bug 229710] [WASM-Function-References] Add call_ref spec tests : [Attachment 439723] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 5 04:51:53 PDT 2021


Yusuke Suzuki <ysuzuki at apple.com> has denied Dmitry <dbezhetskov at igalia.com>'s
request for review:
Bug 229710: [WASM-Function-References] Add call_ref spec tests
https://bugs.webkit.org/show_bug.cgi?id=229710

Attachment 439723: Patch

https://bugs.webkit.org/attachment.cgi?id=439723&action=review




--- Comment #13 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 439723
  --> https://bugs.webkit.org/attachment.cgi?id=439723
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=439723&action=review

Looks much better! But r- since I found several bugs.

> Source/JavaScriptCore/wasm/WasmFormat.h:101
> +inline Type FuncrefType()

Function should not be title-case.
Rename it to funcrefType()

> Source/JavaScriptCore/wasm/WasmFormat.h:104
> +	   return Wasm::Type {Wasm::TypeKind::RefNull, Wasm::Nullable::Yes,
static_cast<Wasm::SignatureIndex>(Wasm::TypeKind::Funcref)};

Add space around {.

> Source/JavaScriptCore/wasm/WasmFormat.h:108
> +inline Type ExternrefType()

Function should not be title-case.
Rename it to externrefType()

> Source/JavaScriptCore/wasm/WasmFormat.h:111
> +	   return Wasm::Type {Wasm::TypeKind::RefNull, Wasm::Nullable::Yes,
static_cast<Wasm::SignatureIndex>(Wasm::TypeKind::Externref)};

Add space around {.

> Source/JavaScriptCore/wasm/WasmGlobal.cpp:97
> +	   } else if (m_type.kind == TypeKind::Ref || m_type.kind ==
TypeKind::RefNull || m_type.kind == TypeKind::Funcref) {

Why isn't it `isFuncref(m_type)`?

> Source/JavaScriptCore/wasm/WasmOperations.cpp:568
> +		   if (!isExternref(returnType) && !value.isCallable(vm)) {

Use `isFuncref(returnType)` instead of `!isExternref(returnType)`

> Source/JavaScriptCore/wasm/WasmParser.h:311
> +	   sigIndex = static_cast<SignatureIndex>(typeKind);
> +	   typeKind = TypeKind::RefNull;

We are using `TypeKind::Funcref` / `TypeKind::Externref`.
Why is it OK? Doesn't normal signature conflict with these numbers?

> Source/JavaScriptCore/wasm/WasmParser.h:329
>	       sigIndex =
SignatureInformation::get(info.usedSignatures[heapType].get());

Isn't it possible that sigIndex becomes the same to TypeKind::Funcref /
TypeKind::Externref?

> Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp:82
> +	   const auto& argumentType = signature.argument(argIndex);

I think keeping switch statement and putting Wasm::isExternref checks in
default clause is cleaner.

> Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp:286
> +	   case Wasm::TypeKind::Ref:
> +	   case Wasm::TypeKind::RefNull:

I think Externref is represented as a part of RefNull. Why is RefNull separated
from `case Wasm::TypeKind::Externref`? This is handling RefNull-based Externref
as Funcref, correct?

> Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp:-249
> -		       switch
(moduleInformation.globals[import.kindIndex].type.kind) {

Keep using switch since it is cleaner.
Add Wasm::isExternref etc. handling in default clause instead.

> Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp:-304
> -		       switch (globalType.kind) {

Ditto. Keep using switch.


More information about the webkit-reviews mailing list