[wasm] Rename 'anyfunc' to 'funcref'.

Change-Id: Ia506f4741e6ff9f024199d1b1fa7abb7dafe2b25
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1682835
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Ben Smith <binji@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62581}
This commit is contained in:
Bill Budge 2019-07-08 13:23:30 -07:00 committed by Commit Bot
parent 5f9dfee548
commit e6b853ef16
23 changed files with 157 additions and 158 deletions

View File

@ -2196,7 +2196,7 @@ Node* WasmGraphBuilder::Throw(uint32_t exception_index,
graph()->NewNode(m->I32x4ExtractLane(3), value));
break;
case wasm::kWasmAnyRef:
case wasm::kWasmAnyFunc:
case wasm::kWasmFuncRef:
case wasm::kWasmExceptRef:
STORE_FIXED_ARRAY_SLOT_ANY(values_array, index, value);
++index;
@ -2335,7 +2335,7 @@ Node** WasmGraphBuilder::GetExceptionValues(
BuildDecodeException32BitValue(values_array, &index));
break;
case wasm::kWasmAnyRef:
case wasm::kWasmAnyFunc:
case wasm::kWasmFuncRef:
case wasm::kWasmExceptRef:
value = LOAD_FIXED_ARRAY_SLOT_ANY(values_array, index);
++index;
@ -3493,7 +3493,7 @@ Node* WasmGraphBuilder::TableGet(uint32_t table_index, Node* index,
return LOAD_RAW_NODE_OFFSET(base, offset,
MachineType::TypeCompressedTagged());
}
// We access anyfunc tables through runtime calls.
// We access funcref tables through runtime calls.
WasmTableGetDescriptor interface_descriptor;
auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), // zone
@ -3522,7 +3522,7 @@ Node* WasmGraphBuilder::TableSet(uint32_t table_index, Node* index, Node* val,
return STORE_RAW_NODE_OFFSET(
base, offset, val, MachineRepresentation::kTagged, kFullWriteBarrier);
} else {
// We access anyfunc tables through runtime calls.
// We access funcref tables through runtime calls.
WasmTableSetDescriptor interface_descriptor;
auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), // zone
@ -5175,7 +5175,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
case wasm::kWasmF64:
return BuildChangeFloat64ToTagged(node);
case wasm::kWasmAnyRef:
case wasm::kWasmAnyFunc:
case wasm::kWasmFuncRef:
case wasm::kWasmExceptRef:
return node;
default:
@ -5235,10 +5235,10 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
return node;
}
if (type == wasm::kWasmAnyFunc) {
if (type == wasm::kWasmFuncRef) {
Node* check =
BuildChangeSmiToInt32(SetEffect(BuildCallToRuntimeWithContext(
Runtime::kWasmIsValidAnyFuncValue, js_context, &node, 1, effect_,
Runtime::kWasmIsValidFuncRefValue, js_context, &node, 1, effect_,
Control())));
Diamond type_check(graph(), mcgraph()->common(), check,

View File

@ -62,7 +62,7 @@ Object ThrowWasmError(Isolate* isolate, MessageTemplate message) {
}
} // namespace
RUNTIME_FUNCTION(Runtime_WasmIsValidAnyFuncValue) {
RUNTIME_FUNCTION(Runtime_WasmIsValidFuncRefValue) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, function, 0);
@ -224,7 +224,7 @@ RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) {
CASE_ARG_TYPE(kWasmF64, double)
#undef CASE_ARG_TYPE
case wasm::kWasmAnyRef:
case wasm::kWasmAnyFunc:
case wasm::kWasmFuncRef:
case wasm::kWasmExceptRef: {
DCHECK_EQ(wasm::ValueTypes::ElementSizeInBytes(sig->GetParam(i)),
kSystemPointerSize);
@ -275,7 +275,7 @@ RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) {
CASE_RET_TYPE(kWasmF64, double)
#undef CASE_RET_TYPE
case wasm::kWasmAnyRef:
case wasm::kWasmAnyFunc:
case wasm::kWasmFuncRef:
case wasm::kWasmExceptRef: {
DCHECK_EQ(wasm::ValueTypes::ElementSizeInBytes(sig->GetReturn(i)),
kSystemPointerSize);

View File

@ -548,7 +548,7 @@ namespace internal {
F(WasmTableCopy, 5, 1) \
F(WasmTableGrow, 3, 1) \
F(WasmTableFill, 4, 1) \
F(WasmIsValidAnyFuncValue, 1, 1) \
F(WasmIsValidFuncRefValue, 1, 1) \
F(WasmCompileLazy, 2, 1)
#define FOR_EACH_INTRINSIC_RETURN_PAIR_IMPL(F, I) \

View File

@ -218,7 +218,7 @@ class LiftoffCompiler {
case kWasmS128:
return kSimd;
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmNullRef:
return kAnyRef;
case kWasmExceptRef:

View File

@ -226,7 +226,7 @@ auto valtype(const byte_t*& pos) // NOLINT(runtime/references)
return ValType::make(F32);
case i::wasm::kLocalF64:
return ValType::make(F64);
case i::wasm::kLocalAnyFunc:
case i::wasm::kLocalFuncRef:
return ValType::make(FUNCREF);
case i::wasm::kLocalAnyRef:
return ValType::make(ANYREF);
@ -584,7 +584,7 @@ auto v8_valtype_to_wasm(i::wasm::ValueType v8_valtype) -> ::wasm::ValKind {
return ::wasm::F32;
case i::wasm::kWasmF64:
return ::wasm::F64;
case i::wasm::kWasmAnyFunc:
case i::wasm::kWasmFuncRef:
return ::wasm::FUNCREF;
case i::wasm::kWasmAnyRef:
return ::wasm::ANYREF;
@ -605,7 +605,7 @@ i::wasm::ValueType wasm_valtype_to_v8(::wasm::ValKind type) {
case ::wasm::F64:
return i::wasm::kWasmF64;
case ::wasm::FUNCREF:
return i::wasm::kWasmAnyFunc;
return i::wasm::kWasmFuncRef;
case ::wasm::ANYREF:
return i::wasm::kWasmAnyRef;
default:
@ -1719,7 +1719,7 @@ void PushArgs(i::wasm::FunctionSig* sig, const Val args[],
packer->Push(args[i].f64());
break;
case i::wasm::kWasmAnyRef:
case i::wasm::kWasmAnyFunc:
case i::wasm::kWasmFuncRef:
packer->Push(impl(args[i].ref())->v8_object()->ptr());
break;
case i::wasm::kWasmExceptRef:
@ -1751,7 +1751,7 @@ void PopArgs(i::wasm::FunctionSig* sig, Val results[],
results[i] = Val(packer->Pop<double>());
break;
case i::wasm::kWasmAnyRef:
case i::wasm::kWasmAnyFunc: {
case i::wasm::kWasmFuncRef: {
i::Address raw = packer->Pop<i::Address>();
if (raw == i::kNullAddress) {
results[i] = Val(nullptr);
@ -2042,7 +2042,7 @@ void Global::set(const Val& val) {
case ANYREF:
return v8_global->SetAnyRef(impl(val.ref())->v8_object());
case FUNCREF: {
bool result = v8_global->SetAnyFunc(impl(this)->store()->i_isolate(),
bool result = v8_global->SetFuncRef(impl(this)->store()->i_isolate(),
impl(val.ref())->v8_object());
DCHECK(result);
USE(result);
@ -2076,7 +2076,7 @@ auto Table::make(Store* store_abs, const TableType* type, const Ref* ref)
i::wasm::ValueType i_type;
switch (type->element()->kind()) {
case FUNCREF:
i_type = i::wasm::kWasmAnyFunc;
i_type = i::wasm::kWasmFuncRef;
break;
case ANYREF:
if (enabled_features.anyref) {

View File

@ -230,8 +230,8 @@ inline bool decode_local_type(uint8_t val, ValueType* result) {
case kLocalS128:
*result = kWasmS128;
return true;
case kLocalAnyFunc:
*result = kWasmAnyFunc;
case kLocalFuncRef:
*result = kWasmFuncRef;
return true;
case kLocalAnyRef:
*result = kWasmAnyRef;
@ -850,13 +850,13 @@ class WasmDecoder : public Decoder {
}
decoder->error(decoder->pc() - 1, "invalid local type");
return false;
case kLocalAnyFunc:
case kLocalFuncRef:
if (enabled.anyref) {
type = kWasmAnyFunc;
type = kWasmFuncRef;
break;
}
decoder->error(decoder->pc() - 1,
"local type 'anyfunc' is not enabled with "
"local type 'funcref' is not enabled with "
"--experimental-wasm-anyref");
return false;
case kLocalExceptRef:
@ -1016,8 +1016,8 @@ class WasmDecoder : public Decoder {
return false;
}
if (!VALIDATE(module_ != nullptr &&
module_->tables[imm.table_index].type == kWasmAnyFunc)) {
error("table of call_indirect must be of type anyfunc");
module_->tables[imm.table_index].type == kWasmFuncRef)) {
error("table of call_indirect must be of type funcref");
return false;
}
if (!Complete(pc, imm)) {
@ -2105,7 +2105,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
CHECK_PROTOTYPE_OPCODE(anyref);
FunctionIndexImmediate<validate> imm(this, this->pc_);
if (!this->Validate(this->pc_, imm)) break;
auto* value = Push(kWasmAnyFunc);
auto* value = Push(kWasmFuncRef);
CALL_INTERFACE_IF_REACHABLE(RefFunc, imm.index, value);
len = 1 + imm.length;
break;

View File

@ -691,7 +691,7 @@ class WasmGraphBuildingInterface {
case kWasmS128:
return builder_->S128Zero();
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef:
return builder_->RefNull();
default:

View File

@ -123,7 +123,7 @@ ValueType TypeOf(const WasmModule* module, const WasmInitExpr& expr) {
case WasmInitExpr::kRefNullConst:
return kWasmNullRef;
case WasmInitExpr::kRefFuncConst:
return kWasmAnyFunc;
return kWasmFuncRef;
default:
UNREACHABLE();
}
@ -550,7 +550,7 @@ class ModuleDecoderImpl : public Decoder {
table->imported = true;
ValueType type = consume_reference_type();
if (!enabled_features_.anyref) {
if (type != kWasmAnyFunc) {
if (type != kWasmFuncRef) {
error(pc_ - 1, "invalid table type");
break;
}
@ -808,16 +808,16 @@ class ModuleDecoderImpl : public Decoder {
errorf(pos, "out of bounds table index %u", table_index);
break;
}
if (!ValueTypes::IsSubType(kWasmAnyFunc,
if (!ValueTypes::IsSubType(kWasmFuncRef,
module_->tables[table_index].type)) {
errorf(pos,
"Invalid element segment. Table %u is not of type AnyFunc",
"Invalid element segment. Table %u is not of type FuncRef",
table_index);
break;
}
} else {
ValueType type = consume_reference_type();
if (!ValueTypes::IsSubType(kWasmAnyFunc, type)) {
if (!ValueTypes::IsSubType(kWasmFuncRef, type)) {
error(pc_ - 1, "invalid element segment type");
break;
}
@ -1595,8 +1595,8 @@ class ModuleDecoderImpl : public Decoder {
case kLocalS128:
if (enabled_features_.simd) return kWasmS128;
break;
case kLocalAnyFunc:
if (enabled_features_.anyref) return kWasmAnyFunc;
case kLocalFuncRef:
if (enabled_features_.anyref) return kWasmFuncRef;
break;
case kLocalAnyRef:
if (enabled_features_.anyref) return kWasmAnyRef;
@ -1618,8 +1618,8 @@ class ModuleDecoderImpl : public Decoder {
byte val = consume_u8("reference type");
ValueTypeCode t = static_cast<ValueTypeCode>(val);
switch (t) {
case kLocalAnyFunc:
return kWasmAnyFunc;
case kLocalFuncRef:
return kWasmFuncRef;
case kLocalAnyRef:
if (!enabled_features_.anyref) {
error(pc_ - 1,

View File

@ -176,7 +176,7 @@ class InstanceBuilder {
Handle<String> import_name,
Handle<Object> value);
// Initialize imported tables of type anyfunc.
// Initialize imported tables of type funcref.
bool InitializeImportedIndirectFunctionTable(
Handle<WasmInstanceObject> instance, int table_index, int import_index,
Handle<WasmTableObject> table_object);
@ -417,7 +417,7 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
// iteration below.
for (int i = 1; i < table_count; ++i) {
const WasmTable& table = module_->tables[i];
if (table.type == kWasmAnyFunc) {
if (table.type == kWasmFuncRef) {
Handle<WasmIndirectFunctionTable> table_obj =
WasmIndirectFunctionTable::New(isolate_, table.initial_size);
tables->set(i, *table_obj);
@ -750,7 +750,7 @@ void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global,
break;
}
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef: {
tagged_globals_->set(global.offset, *value->GetRef());
break;
@ -994,7 +994,7 @@ bool InstanceBuilder::ProcessImportedTable(Handle<WasmInstanceObject> instance,
return false;
}
if (table.type == kWasmAnyFunc &&
if (table.type == kWasmFuncRef &&
!InitializeImportedIndirectFunctionTable(instance, table_index,
import_index, table_object)) {
return false;
@ -1161,11 +1161,11 @@ bool InstanceBuilder::ProcessImportedGlobal(Handle<WasmInstanceObject> instance,
if (ValueTypes::IsReferenceType(global.type)) {
// There shouldn't be any null-ref globals.
DCHECK_NE(ValueType::kWasmNullRef, global.type);
if (global.type == ValueType::kWasmAnyFunc) {
if (global.type == ValueType::kWasmFuncRef) {
if (!value->IsNull(isolate_) &&
!WasmExportedFunction::IsWasmExportedFunction(*value)) {
ReportLinkError(
"imported anyfunc global must be null or an exported function",
"imported funcref global must be null or an exported function",
import_index, module_name, import_name);
return false;
}
@ -1430,7 +1430,7 @@ Handle<JSArrayBuffer> InstanceBuilder::AllocateMemory(uint32_t initial_pages,
bool InstanceBuilder::NeedsWrappers() const {
if (module_->num_exported_functions > 0) return true;
for (auto& table : module_->tables) {
if (table.type == kWasmAnyFunc) return true;
if (table.type == kWasmFuncRef) return true;
}
return false;
}
@ -1613,7 +1613,7 @@ void InstanceBuilder::InitializeIndirectFunctionTables(
for (int i = 0; i < static_cast<int>(module_->tables.size()); ++i) {
const WasmTable& table = module_->tables[i];
if (table.type == kWasmAnyFunc) {
if (table.type == kWasmFuncRef) {
WasmInstanceObject::EnsureIndirectFunctionTableWithMinimumSize(
instance, i, table.initial_size);
}
@ -1638,7 +1638,7 @@ bool LoadElemSegmentImpl(Isolate* isolate, Handle<WasmInstanceObject> instance,
int entry_index = static_cast<int>(dst + i);
if (func_index == WasmElemSegment::kNullIndex) {
if (table_object->type() == kWasmAnyFunc) {
if (table_object->type() == kWasmFuncRef) {
IndirectFunctionTableEntry(instance, elem_segment.table_index,
entry_index)
.clear();
@ -1651,7 +1651,7 @@ bool LoadElemSegmentImpl(Isolate* isolate, Handle<WasmInstanceObject> instance,
const WasmFunction* function = &module->functions[func_index];
// Update the local dispatch table first if necessary.
if (table_object->type() == kWasmAnyFunc) {
if (table_object->type() == kWasmFuncRef) {
uint32_t sig_id = module->signature_ids[function->sig_index];
IndirectFunctionTableEntry(instance, elem_segment.table_index,
entry_index)
@ -1720,7 +1720,7 @@ void InstanceBuilder::LoadTableSegments(Handle<WasmInstanceObject> instance) {
int table_count = static_cast<int>(module_->tables.size());
for (int index = 0; index < table_count; ++index) {
if (module_->tables[index].type == kWasmAnyFunc) {
if (module_->tables[index].type == kWasmFuncRef) {
auto table_object = handle(
WasmTableObject::cast(instance->tables().get(index)), isolate_);

View File

@ -21,7 +21,7 @@ namespace wasm {
//
// AnyRef
// / \
// AnyFunc ExceptRef
// FuncRef ExceptRef
// \ /
// I32 I64 F32 F64 NullRef
// \ \ \ \ /
@ -34,7 +34,7 @@ enum ValueType : uint8_t {
kWasmF64,
kWasmS128,
kWasmAnyRef,
kWasmAnyFunc,
kWasmFuncRef,
kWasmNullRef,
kWasmExceptRef,
kWasmBottom,
@ -191,9 +191,9 @@ class V8_EXPORT_PRIVATE ValueTypes {
static inline bool IsSubType(ValueType actual, ValueType expected) {
return (expected == actual) ||
(expected == kWasmAnyRef && actual == kWasmNullRef) ||
(expected == kWasmAnyRef && actual == kWasmAnyFunc) ||
(expected == kWasmAnyRef && actual == kWasmFuncRef) ||
(expected == kWasmAnyRef && actual == kWasmExceptRef) ||
(expected == kWasmAnyFunc && actual == kWasmNullRef) ||
(expected == kWasmFuncRef && actual == kWasmNullRef) ||
// TODO(mstarzinger): For now we treat "null_ref" as a sub-type of
// "except_ref", which is correct but might change. See here:
// https://github.com/WebAssembly/exception-handling/issues/55
@ -201,7 +201,7 @@ class V8_EXPORT_PRIVATE ValueTypes {
}
static inline bool IsReferenceType(ValueType type) {
return type == kWasmAnyRef || type == kWasmAnyFunc ||
return type == kWasmAnyRef || type == kWasmFuncRef ||
type == kWasmExceptRef;
}
@ -231,7 +231,7 @@ class V8_EXPORT_PRIVATE ValueTypes {
case kWasmS128:
return 16;
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef:
return kSystemPointerSize;
default:
@ -250,7 +250,7 @@ class V8_EXPORT_PRIVATE ValueTypes {
case kWasmS128:
return 4;
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef:
return kSystemPointerSizeLog2;
default:
@ -274,8 +274,8 @@ class V8_EXPORT_PRIVATE ValueTypes {
return kLocalS128;
case kWasmAnyRef:
return kLocalAnyRef;
case kWasmAnyFunc:
return kLocalAnyFunc;
case kWasmFuncRef:
return kLocalFuncRef;
case kWasmExceptRef:
return kLocalExceptRef;
case kWasmStmt:
@ -296,7 +296,7 @@ class V8_EXPORT_PRIVATE ValueTypes {
case kWasmF64:
return MachineType::Float64();
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef:
return MachineType::TaggedPointer();
case kWasmS128:
@ -319,7 +319,7 @@ class V8_EXPORT_PRIVATE ValueTypes {
case kWasmF64:
return MachineRepresentation::kFloat64;
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmNullRef:
case kWasmExceptRef:
return MachineRepresentation::kTaggedPointer;
@ -365,7 +365,7 @@ class V8_EXPORT_PRIVATE ValueTypes {
return 'd';
case kWasmAnyRef:
return 'r';
case kWasmAnyFunc:
case kWasmFuncRef:
return 'a';
case kWasmS128:
return 's';
@ -390,8 +390,8 @@ class V8_EXPORT_PRIVATE ValueTypes {
return "f64";
case kWasmAnyRef:
return "anyref";
case kWasmAnyFunc:
return "anyfunc";
case kWasmFuncRef:
return "funcref";
case kWasmNullRef:
return "nullref";
case kWasmExceptRef:

View File

@ -26,7 +26,7 @@ enum ValueTypeCode : uint8_t {
kLocalF32 = 0x7d,
kLocalF64 = 0x7c,
kLocalS128 = 0x7b,
kLocalAnyFunc = 0x70,
kLocalFuncRef = 0x70,
kLocalAnyRef = 0x6f,
kLocalExceptRef = 0x68,
};

View File

@ -1284,7 +1284,7 @@ class ThreadImpl {
WASM_CTYPES(CASE_TYPE)
#undef CASE_TYPE
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef: {
HandleScope handle_scope(isolate_); // Avoid leaking handles.
Handle<FixedArray> global_buffer; // The buffer of the global.
@ -1465,7 +1465,7 @@ class ThreadImpl {
WASM_CTYPES(CASE_TYPE)
#undef CASE_TYPE
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef: {
val = WasmValue(isolate_->factory()->null_value());
break;
@ -2607,7 +2607,7 @@ class ThreadImpl {
break;
}
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef: {
Handle<Object> anyref = value.to_anyref();
encoded_values->set(encoded_index++, *anyref);
@ -2707,7 +2707,7 @@ class ThreadImpl {
break;
}
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef: {
Handle<Object> anyref(encoded_values->get(encoded_index++), isolate_);
value = WasmValue(anyref);
@ -3165,7 +3165,7 @@ class ThreadImpl {
WASM_CTYPES(CASE_TYPE)
#undef CASE_TYPE
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef: {
HandleScope handle_scope(isolate_); // Avoid leaking handles.
Handle<FixedArray> global_buffer; // The buffer of the global.
@ -3626,7 +3626,7 @@ class ThreadImpl {
packer.Push(arg.to<double>());
break;
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef:
packer.Push(arg.to_anyref()->ptr());
break;
@ -3665,7 +3665,7 @@ class ThreadImpl {
Push(WasmValue(packer.Pop<double>()));
break;
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmFuncRef:
case kWasmExceptRef: {
Handle<Object> ref(Object(packer.Pop<Address>()), isolate);
Push(WasmValue(ref));

View File

@ -1094,7 +1094,7 @@ void WebAssemblyTable(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (!value->ToString(context).ToLocal(&string)) return;
auto enabled_features = i::wasm::WasmFeaturesFromFlags();
if (string->StringEquals(v8_str(isolate, "anyfunc"))) {
type = i::wasm::kWasmAnyFunc;
type = i::wasm::kWasmFuncRef;
} else if (enabled_features.anyref &&
string->StringEquals(v8_str(isolate, "anyref"))) {
type = i::wasm::kWasmAnyRef;
@ -1222,7 +1222,7 @@ bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe,
*type = i::wasm::kWasmAnyRef;
} else if (enabled_features.anyref &&
string->StringEquals(v8_str(isolate, "anyfunc"))) {
*type = i::wasm::kWasmAnyFunc;
*type = i::wasm::kWasmFuncRef;
} else {
// Unrecognized type.
*type = i::wasm::kWasmStmt;
@ -1347,15 +1347,15 @@ void WebAssemblyGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
global_obj->SetAnyRef(Utils::OpenHandle(*value));
break;
}
case i::wasm::kWasmAnyFunc: {
case i::wasm::kWasmFuncRef: {
if (args.Length() < 2) {
// When no inital value is provided, we have to use the WebAssembly
// default value 'null', and not the JS default value 'undefined'.
global_obj->SetAnyFunc(i_isolate, i_isolate->factory()->null_value());
global_obj->SetFuncRef(i_isolate, i_isolate->factory()->null_value());
break;
}
if (!global_obj->SetAnyFunc(i_isolate, Utils::OpenHandle(*value))) {
if (!global_obj->SetFuncRef(i_isolate, Utils::OpenHandle(*value))) {
thrower.TypeError(
"The value of anyfunc globals must be null or an "
"exported function");
@ -1685,7 +1685,7 @@ void WebAssemblyTableType(const v8::FunctionCallbackInfo<v8::Value>& args) {
Local<String> element;
auto enabled_features = i::wasm::WasmFeaturesFromFlags();
if (table->type() == i::wasm::ValueType::kWasmAnyFunc) {
if (table->type() == i::wasm::ValueType::kWasmFuncRef) {
element = v8_str(isolate, "anyfunc");
} else if (enabled_features.anyref &&
table->type() == i::wasm::ValueType::kWasmAnyRef) {
@ -1693,7 +1693,6 @@ void WebAssemblyTableType(const v8::FunctionCallbackInfo<v8::Value>& args) {
} else {
UNREACHABLE();
}
// TODO(aseemgarg): update anyfunc to funcref
if (!ret->CreateDataProperty(isolate->GetCurrentContext(),
v8_str(isolate, "element"), element)
.IsJust()) {
@ -1864,7 +1863,7 @@ void WebAssemblyGlobalGetValueCommon(
return_value.Set(receiver->GetF64());
break;
case i::wasm::kWasmAnyRef:
case i::wasm::kWasmAnyFunc:
case i::wasm::kWasmFuncRef:
case i::wasm::kWasmExceptRef:
return_value.Set(Utils::ToLocal(receiver->GetRef()));
break;
@ -1938,8 +1937,8 @@ void WebAssemblyGlobalSetValue(
receiver->SetAnyRef(Utils::OpenHandle(*args[0]));
break;
}
case i::wasm::kWasmAnyFunc: {
if (!receiver->SetAnyFunc(i_isolate, Utils::OpenHandle(*args[0]))) {
case i::wasm::kWasmFuncRef: {
if (!receiver->SetFuncRef(i_isolate, Utils::OpenHandle(*args[0]))) {
thrower.TypeError(
"value of an anyfunc reference must be either null or an "
"exported function");

View File

@ -404,7 +404,7 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer* buffer) const {
if (indirect_functions_.size() > 0) {
size_t start = EmitSection(kTableSectionCode, buffer);
buffer->write_u8(1); // table count
buffer->write_u8(kLocalAnyFunc);
buffer->write_u8(kLocalFuncRef);
buffer->write_u8(kHasMaximumFlag);
buffer->write_size(indirect_functions_.size());
buffer->write_size(indirect_functions_.size());

View File

@ -165,7 +165,7 @@ double WasmGlobalObject::GetF64() {
}
Handle<Object> WasmGlobalObject::GetRef() {
// We use this getter for anyref, anyfunc, and except_ref.
// We use this getter for anyref, funcref, and except_ref.
DCHECK(wasm::ValueTypes::IsReferenceType(type()));
return handle(tagged_buffer().get(offset()), GetIsolate());
}
@ -192,8 +192,8 @@ void WasmGlobalObject::SetAnyRef(Handle<Object> value) {
tagged_buffer().set(offset(), *value);
}
bool WasmGlobalObject::SetAnyFunc(Isolate* isolate, Handle<Object> value) {
DCHECK_EQ(type(), wasm::kWasmAnyFunc);
bool WasmGlobalObject::SetFuncRef(Isolate* isolate, Handle<Object> value) {
DCHECK_EQ(type(), wasm::kWasmFuncRef);
if (!value->IsNull(isolate) &&
!WasmExportedFunction::IsWasmExportedFunction(*value) &&
!WasmCapiFunction::IsWasmCapiFunction(*value)) {

View File

@ -898,7 +898,7 @@ bool WasmTableObject::IsValidElement(Isolate* isolate,
Handle<Object> entry) {
// Anyref tables take everything.
if (table->type() == wasm::kWasmAnyRef) return true;
// Anyfunc tables can store {null}, {WasmExportedFunction}, {WasmJSFunction},
// FuncRef tables can store {null}, {WasmExportedFunction}, {WasmJSFunction},
// or {WasmCapiFunction} objects.
if (entry->IsNull(isolate)) return true;
return WasmExportedFunction::IsWasmExportedFunction(*entry) ||
@ -962,7 +962,7 @@ Handle<Object> WasmTableObject::Get(Isolate* isolate,
// First we handle the easy anyref table case.
if (table->type() == wasm::kWasmAnyRef) return entry;
// Now we handle the anyfunc case.
// Now we handle the funcref case.
if (WasmExportedFunction::IsWasmExportedFunction(*entry) ||
WasmCapiFunction::IsWasmCapiFunction(*entry)) {
return entry;
@ -1135,7 +1135,7 @@ void WasmTableObject::GetFunctionTableEntry(
Isolate* isolate, Handle<WasmTableObject> table, int entry_index,
bool* is_valid, bool* is_null, MaybeHandle<WasmInstanceObject>* instance,
int* function_index, MaybeHandle<WasmJSFunction>* maybe_js_function) {
DCHECK_EQ(table->type(), wasm::kWasmAnyFunc);
DCHECK_EQ(table->type(), wasm::kWasmFuncRef);
DCHECK_LT(entry_index, table->entries().length());
// We initialize {is_valid} with {true}. We may change it later.
*is_valid = true;
@ -2197,7 +2197,7 @@ uint32_t WasmExceptionPackage::GetEncodedSize(
encoded_size += 8;
break;
case wasm::kWasmAnyRef:
case wasm::kWasmAnyFunc:
case wasm::kWasmFuncRef:
case wasm::kWasmExceptRef:
encoded_size += 1;
break;

View File

@ -416,7 +416,7 @@ class WasmGlobalObject : public JSObject {
inline void SetF32(float value);
inline void SetF64(double value);
inline void SetAnyRef(Handle<Object> value);
inline bool SetAnyFunc(Isolate* isolate, Handle<Object> value);
inline bool SetFuncRef(Isolate* isolate, Handle<Object> value);
private:
// This function returns the address of the global's data in the

View File

@ -436,7 +436,7 @@ bool IsJSCompatibleSignature(const FunctionSig* sig, bool hasBigIntFeature);
V(TableCopy, 0xfc0e, v_iii) \
V(TableGrow, 0xfc0f, i_ai) \
V(TableSize, 0xfc10, i_v) \
/*TableFill is polymorph in the second parameter. It's anyref or anyfunc.*/ \
/*TableFill is polymorph in the second parameter. It's anyref or funcref.*/ \
V(TableFill, 0xfc11, v_iii)
#define FOREACH_ATOMIC_OPCODE(V) \
@ -565,7 +565,7 @@ bool IsJSCompatibleSignature(const FunctionSig* sig, bool hasBigIntFeature);
V(i_iil, kWasmI32, kWasmI32, kWasmI32, kWasmI64) \
V(i_ill, kWasmI32, kWasmI32, kWasmI64, kWasmI64) \
V(i_r, kWasmI32, kWasmAnyRef) \
V(i_ai, kWasmI32, kWasmAnyFunc, kWasmI32)
V(i_ai, kWasmI32, kWasmFuncRef, kWasmI32)
#define FOREACH_SIMD_SIGNATURE(V) \
V(s_s, kWasmS128, kWasmS128) \

View File

@ -170,7 +170,7 @@ void TestingModuleBuilder::AddIndirectFunctionTable(
table.initial_size = table_size;
table.maximum_size = table_size;
table.has_maximum_size = true;
table.type = kWasmAnyFunc;
table.type = kWasmFuncRef;
WasmInstanceObject::EnsureIndirectFunctionTableWithMinimumSize(
instance_object(), 0, table_size);
Handle<WasmTableObject> table_obj =

View File

@ -27,7 +27,7 @@ class TestSignatures {
sig_i_dd(1, 2, kIntDoubleTypes4),
sig_i_r(1, 1, kIntAnyRefTypes4),
sig_i_rr(1, 2, kIntAnyRefTypes4),
sig_i_a(1, 1, kIntAnyFuncTypes4),
sig_i_a(1, 1, kIntFuncRefTypes4),
sig_l_v(1, 0, kLongTypes4),
sig_l_l(1, 1, kLongTypes4),
sig_l_ll(1, 2, kLongTypes4),
@ -55,18 +55,18 @@ class TestSignatures {
for (int i = 0; i < 4; i++) kFloatTypes4[i] = kWasmF32;
for (int i = 0; i < 4; i++) kDoubleTypes4[i] = kWasmF64;
for (int i = 0; i < 4; i++) kRefTypes4[i] = kWasmAnyRef;
for (int i = 0; i < 4; i++) kFuncTypes4[i] = kWasmAnyFunc;
for (int i = 0; i < 4; i++) kFuncTypes4[i] = kWasmFuncRef;
for (int i = 1; i < 4; i++) kIntLongTypes4[i] = kWasmI64;
for (int i = 1; i < 4; i++) kIntFloatTypes4[i] = kWasmF32;
for (int i = 1; i < 4; i++) kIntDoubleTypes4[i] = kWasmF64;
for (int i = 1; i < 4; i++) kIntAnyRefTypes4[i] = kWasmAnyRef;
for (int i = 1; i < 4; i++) kIntAnyFuncTypes4[i] = kWasmAnyFunc;
for (int i = 1; i < 4; i++) kIntFuncRefTypes4[i] = kWasmFuncRef;
for (int i = 0; i < 4; i++) kSimd128IntTypes4[i] = kWasmS128;
kIntLongTypes4[0] = kWasmI32;
kIntFloatTypes4[0] = kWasmI32;
kIntDoubleTypes4[0] = kWasmI32;
kIntAnyRefTypes4[0] = kWasmI32;
kIntAnyFuncTypes4[0] = kWasmI32;
kIntFuncRefTypes4[0] = kWasmI32;
kSimd128IntTypes4[1] = kWasmI32;
}
@ -129,7 +129,7 @@ class TestSignatures {
ValueType kIntFloatTypes4[4];
ValueType kIntDoubleTypes4[4];
ValueType kIntAnyRefTypes4[4];
ValueType kIntAnyFuncTypes4[4];
ValueType kIntFuncRefTypes4[4];
ValueType kSimd128IntTypes4[4];
FunctionSig sig_i_v;

View File

@ -151,7 +151,7 @@
#define WASM_SELECT_R(tval, fval, cond) \
tval, fval, cond, kExprSelectWithType, U32V_1(1), kLocalAnyRef
#define WASM_SELECT_A(tval, fval, cond) \
tval, fval, cond, kExprSelectWithType, U32V_1(1), kLocalAnyFunc
tval, fval, cond, kExprSelectWithType, U32V_1(1), kLocalFuncRef
#define WASM_RETURN0 kExprReturn
#define WASM_RETURN1(val) val, kExprReturn

View File

@ -254,7 +254,7 @@ class TestModuleBuilder {
byte AddTable(ValueType type, uint32_t initial_size, bool has_maximum_size,
uint32_t maximum_size) {
CHECK(type == kWasmAnyRef || type == kWasmAnyFunc);
CHECK(type == kWasmAnyRef || type == kWasmFuncRef);
mod.tables.emplace_back();
WasmTable& table = mod.tables.back();
table.type = type;
@ -1637,7 +1637,7 @@ TEST_F(FunctionBodyDecoderTest, SimpleIndirectReturnCalls) {
FunctionSig* sig = sigs.i_i();
TestModuleBuilder builder;
builder.AddTable(kWasmAnyFunc, 20, true, 30);
builder.AddTable(kWasmFuncRef, 20, true, 30);
module = builder.module();
byte f0 = builder.AddSignature(sigs.i_v());
@ -1656,7 +1656,7 @@ TEST_F(FunctionBodyDecoderTest, IndirectReturnCallsOutOfBounds) {
FunctionSig* sig = sigs.i_i();
TestModuleBuilder builder;
builder.AddTable(kWasmAnyFunc, 20, false, 20);
builder.AddTable(kWasmFuncRef, 20, false, 20);
module = builder.module();
ExpectFailure(sig, {WASM_RETURN_CALL_INDIRECT0(0, WASM_ZERO)});
@ -1779,7 +1779,7 @@ TEST_F(FunctionBodyDecoderTest, MultiReturnType) {
TEST_F(FunctionBodyDecoderTest, SimpleIndirectCalls) {
FunctionSig* sig = sigs.i_i();
TestModuleBuilder builder;
builder.AddTable(kWasmAnyFunc, 20, false, 20);
builder.AddTable(kWasmFuncRef, 20, false, 20);
module = builder.module();
byte f0 = builder.AddSignature(sigs.i_v());
@ -1795,7 +1795,7 @@ TEST_F(FunctionBodyDecoderTest, SimpleIndirectCalls) {
TEST_F(FunctionBodyDecoderTest, IndirectCallsOutOfBounds) {
FunctionSig* sig = sigs.i_i();
TestModuleBuilder builder;
builder.AddTable(kWasmAnyFunc, 20, false, 20);
builder.AddTable(kWasmFuncRef, 20, false, 20);
module = builder.module();
ExpectFailure(sig, {WASM_CALL_INDIRECT0(0, WASM_ZERO)});
@ -2036,10 +2036,10 @@ TEST_F(FunctionBodyDecoderTest, TableSet) {
TestModuleBuilder builder;
module = builder.module();
byte tab_ref1 = builder.AddTable(kWasmAnyRef, 10, true, 20);
byte tab_func1 = builder.AddTable(kWasmAnyFunc, 20, true, 30);
byte tab_func2 = builder.AddTable(kWasmAnyFunc, 10, false, 20);
byte tab_func1 = builder.AddTable(kWasmFuncRef, 20, true, 30);
byte tab_func2 = builder.AddTable(kWasmFuncRef, 10, false, 20);
byte tab_ref2 = builder.AddTable(kWasmAnyRef, 10, false, 20);
ValueType sig_types[]{kWasmAnyRef, kWasmAnyFunc, kWasmI32};
ValueType sig_types[]{kWasmAnyRef, kWasmFuncRef, kWasmI32};
FunctionSig sig(0, 3, sig_types);
byte local_ref = 0;
byte local_func = 1;
@ -2053,7 +2053,7 @@ TEST_F(FunctionBodyDecoderTest, TableSet) {
ExpectValidates(&sig, {WASM_TABLE_SET(tab_ref2, WASM_I32V(8),
WASM_GET_LOCAL(local_ref))});
// We can store anyfunc values as anyref, but not the other way around.
// We can store funcref values as anyref, but not the other way around.
ExpectValidates(&sig, {WASM_TABLE_SET(tab_ref1, WASM_I32V(4),
WASM_GET_LOCAL(local_func))});
ExpectFailure(&sig, {WASM_TABLE_SET(tab_func1, WASM_I32V(9),
@ -2079,10 +2079,10 @@ TEST_F(FunctionBodyDecoderTest, TableGet) {
TestModuleBuilder builder;
module = builder.module();
byte tab_ref1 = builder.AddTable(kWasmAnyRef, 10, true, 20);
byte tab_func1 = builder.AddTable(kWasmAnyFunc, 20, true, 30);
byte tab_func2 = builder.AddTable(kWasmAnyFunc, 10, false, 20);
byte tab_func1 = builder.AddTable(kWasmFuncRef, 20, true, 30);
byte tab_func2 = builder.AddTable(kWasmFuncRef, 10, false, 20);
byte tab_ref2 = builder.AddTable(kWasmAnyRef, 10, false, 20);
ValueType sig_types[]{kWasmAnyRef, kWasmAnyFunc, kWasmI32};
ValueType sig_types[]{kWasmAnyRef, kWasmFuncRef, kWasmI32};
FunctionSig sig(0, 3, sig_types);
byte local_ref = 0;
byte local_func = 1;
@ -2100,7 +2100,7 @@ TEST_F(FunctionBodyDecoderTest, TableGet) {
&sig,
{WASM_SET_LOCAL(local_func, WASM_TABLE_GET(tab_func2, WASM_I32V(7)))});
// We can store anyfunc values as anyref, but not the other way around.
// We can store funcref values as anyref, but not the other way around.
ExpectFailure(&sig, {WASM_SET_LOCAL(local_func,
WASM_TABLE_GET(tab_ref1, WASM_I32V(4)))});
ExpectValidates(
@ -2129,13 +2129,13 @@ TEST_F(FunctionBodyDecoderTest, MultiTableCallIndirect) {
TestModuleBuilder builder;
module = builder.module();
byte tab_ref = builder.AddTable(kWasmAnyRef, 10, true, 20);
byte tab_func = builder.AddTable(kWasmAnyFunc, 20, true, 30);
byte tab_func = builder.AddTable(kWasmFuncRef, 20, true, 30);
ValueType sig_types[]{kWasmAnyRef, kWasmAnyFunc, kWasmI32};
ValueType sig_types[]{kWasmAnyRef, kWasmFuncRef, kWasmI32};
FunctionSig sig(0, 3, sig_types);
byte sig_index = builder.AddSignature(sigs.i_v());
// We can store anyfunc values as anyref, but not the other way around.
// We can store funcref values as anyref, but not the other way around.
ExpectValidates(sigs.i_v(),
{kExprI32Const, 0, kExprCallIndirect, sig_index, tab_func});
@ -3220,7 +3220,7 @@ TEST_F(FunctionBodyDecoderTest, TableCopy) {
TEST_F(FunctionBodyDecoderTest, TableGrow) {
TestModuleBuilder builder;
byte tab_func = builder.AddTable(kWasmAnyFunc, 10, true, 20);
byte tab_func = builder.AddTable(kWasmFuncRef, 10, true, 20);
byte tab_ref = builder.AddTable(kWasmAnyRef, 10, true, 20);
module = builder.module();
@ -3232,10 +3232,10 @@ TEST_F(FunctionBodyDecoderTest, TableGrow) {
{WASM_TABLE_GROW(tab_func, WASM_REF_NULL, WASM_ONE)});
ExpectValidates(sigs.i_r(),
{WASM_TABLE_GROW(tab_ref, WASM_REF_NULL, WASM_ONE)});
// Anyfunc table cannot be initialized with an anyref value.
// FuncRef table cannot be initialized with an anyref value.
ExpectFailure(sigs.i_r(),
{WASM_TABLE_GROW(tab_func, WASM_GET_LOCAL(0), WASM_ONE)});
// Anyref table can be initialized with an anyfunc value.
// Anyref table can be initialized with an funcref value.
ExpectValidates(sigs.i_a(),
{WASM_TABLE_GROW(tab_ref, WASM_GET_LOCAL(0), WASM_ONE)});
// Check that the table index gets verified.
@ -3245,7 +3245,7 @@ TEST_F(FunctionBodyDecoderTest, TableGrow) {
TEST_F(FunctionBodyDecoderTest, TableSize) {
TestModuleBuilder builder;
int tab = builder.AddTable(kWasmAnyFunc, 10, true, 20);
int tab = builder.AddTable(kWasmFuncRef, 10, true, 20);
module = builder.module();
@ -3257,7 +3257,7 @@ TEST_F(FunctionBodyDecoderTest, TableSize) {
TEST_F(FunctionBodyDecoderTest, TableFill) {
TestModuleBuilder builder;
byte tab_func = builder.AddTable(kWasmAnyFunc, 10, true, 20);
byte tab_func = builder.AddTable(kWasmFuncRef, 10, true, 20);
byte tab_ref = builder.AddTable(kWasmAnyRef, 10, true, 20);
module = builder.module();
@ -3269,10 +3269,10 @@ TEST_F(FunctionBodyDecoderTest, TableFill) {
WASM_REF_NULL, WASM_ONE)});
ExpectValidates(sigs.v_r(), {WASM_TABLE_FILL(tab_ref, WASM_ONE, WASM_REF_NULL,
WASM_ONE)});
// Anyfunc table cannot be initialized with an anyref value.
// FuncRef table cannot be initialized with an anyref value.
ExpectFailure(sigs.v_r(), {WASM_TABLE_FILL(tab_func, WASM_ONE,
WASM_GET_LOCAL(0), WASM_ONE)});
// Anyref table can be initialized with an anyfunc value.
// Anyref table can be initialized with an funcref value.
ExpectValidates(sigs.v_a(), {WASM_TABLE_FILL(tab_ref, WASM_ONE,
WASM_GET_LOCAL(0), WASM_ONE)});
// Check that the table index gets verified.

View File

@ -167,7 +167,7 @@ struct ValueTypePair {
{kLocalI64, kWasmI64}, // --
{kLocalF32, kWasmF32}, // --
{kLocalF64, kWasmF64}, // --
{kLocalAnyFunc, kWasmAnyFunc}, // --
{kLocalFuncRef, kWasmFuncRef}, // --
{kLocalAnyRef, kWasmAnyRef} // --
};
@ -306,7 +306,7 @@ TEST_F(WasmModuleVerifyTest, AnyRefGlobal) {
}
}
TEST_F(WasmModuleVerifyTest, AnyFuncGlobal) {
TEST_F(WasmModuleVerifyTest, FuncRefGlobal) {
WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
// sig#0 ---------------------------------------------------------------
@ -315,10 +315,10 @@ TEST_F(WasmModuleVerifyTest, AnyFuncGlobal) {
TWO_EMPTY_FUNCTIONS(SIG_INDEX(0)),
SECTION(Global, // --
ENTRY_COUNT(2), // --
kLocalAnyFunc, // local type
kLocalFuncRef, // local type
0, // immutable
WASM_INIT_EXPR_REF_NULL, // init
kLocalAnyFunc, // local type
kLocalFuncRef, // local type
0, // immutable
WASM_INIT_EXPR_REF_FUNC(1)), // init
TWO_EMPTY_BODIES};
@ -331,12 +331,12 @@ TEST_F(WasmModuleVerifyTest, AnyFuncGlobal) {
EXPECT_EQ(0u, result.value()->data_segments.size());
const WasmGlobal* global = &result.value()->globals[0];
EXPECT_EQ(kWasmAnyFunc, global->type);
EXPECT_EQ(kWasmFuncRef, global->type);
EXPECT_FALSE(global->mutability);
EXPECT_EQ(WasmInitExpr::kRefNullConst, global->init.kind);
global = &result.value()->globals[1];
EXPECT_EQ(kWasmAnyFunc, global->type);
EXPECT_EQ(kWasmFuncRef, global->type);
EXPECT_FALSE(global->mutability);
EXPECT_EQ(WasmInitExpr::kRefFuncConst, global->init.kind);
EXPECT_EQ(uint32_t{1}, global->init.val.function_index);
@ -922,7 +922,7 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction) {
// funcs ---------------------------------------------------------------
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 1),
SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1),
// code ----------------------------------------------------------------
ONE_EMPTY_BODY};
@ -939,7 +939,7 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction) {
TEST_F(WasmModuleVerifyTest, ElementSectionWithInternalTable) {
static const byte data[] = {
// table ---------------------------------------------------------------
SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 1),
SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1),
// elements ------------------------------------------------------------
SECTION(Element, ENTRY_COUNT(0))};
@ -953,7 +953,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionWithImportedTable) {
ADD_COUNT('m'), // module name
ADD_COUNT('t'), // table name
kExternalTable, // import kind
kLocalAnyFunc, // elem_type
kLocalFuncRef, // elem_type
0, // no maximum field
1), // initial size
// elements ------------------------------------------------------------
@ -984,7 +984,7 @@ TEST_F(WasmModuleVerifyTest, Regression_735887) {
// funcs ---------------------------------------------------------------
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 1),
SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1),
// elements ------------------------------------------------------------
SECTION(Element,
ENTRY_COUNT(1), // entry count
@ -1003,7 +1003,7 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction_one_entry) {
// funcs ---------------------------------------------------------------
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 1),
SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1),
// elements ------------------------------------------------------------
SECTION(Element,
ENTRY_COUNT(1), // entry count
@ -1031,7 +1031,7 @@ TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) {
// funcs ------------------------------------------------------
FOUR_EMPTY_FUNCTIONS(SIG_INDEX(0)),
// table declaration -------------------------------------------
SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 8),
SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 8),
// table elements ----------------------------------------------
SECTION(Element,
ENTRY_COUNT(1), // entry count
@ -1061,8 +1061,8 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTables) {
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(2), // section header
kLocalAnyFunc, 0, 5, // table 0
kLocalAnyFunc, 0, 9), // table 1
kLocalFuncRef, 0, 5, // table 0
kLocalFuncRef, 0, 9), // table 1
// elements ------------------------------------------------------------
SECTION(Element,
ENTRY_COUNT(2), // entry count
@ -1094,21 +1094,21 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTables) {
ADD_COUNT('m'), // module name
ADD_COUNT('t'), // table name
kExternalTable, // import kind
kLocalAnyFunc, // elem_type
kLocalFuncRef, // elem_type
0, // no maximum field
5, // initial size
ADD_COUNT('m'), // module name
ADD_COUNT('s'), // table name
kExternalTable, // import kind
kLocalAnyFunc, // elem_type
kLocalFuncRef, // elem_type
0, // no maximum field
10), // initial size
// funcs ---------------------------------------------------------------
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(2), // section header
kLocalAnyFunc, 0, 15, // table 0
kLocalAnyFunc, 0, 19), // table 1
kLocalFuncRef, 0, 15, // table 0
kLocalFuncRef, 0, 19), // table 1
// elements ------------------------------------------------------------
SECTION(Element,
4, // entry count
@ -1148,8 +1148,8 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTablesArbitraryOrder) {
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(2), // section header
kLocalAnyFunc, 0, 5, // table 0
kLocalAnyFunc, 0, 9), // table 1
kLocalFuncRef, 0, 5, // table 0
kLocalFuncRef, 0, 9), // table 1
// elements ------------------------------------------------------------
SECTION(Element,
ENTRY_COUNT(3), // entry count
@ -1185,21 +1185,21 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTablesArbitraryOrder) {
ADD_COUNT('m'), // module name
ADD_COUNT('t'), // table name
kExternalTable, // import kind
kLocalAnyFunc, // elem_type
kLocalFuncRef, // elem_type
0, // no maximum field
5, // initial size
ADD_COUNT('m'), // module name
ADD_COUNT('s'), // table name
kExternalTable, // import kind
kLocalAnyFunc, // elem_type
kLocalFuncRef, // elem_type
0, // no maximum field
10), // initial size
// funcs ---------------------------------------------------------------
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(2), // section header
kLocalAnyFunc, 0, 15, // table 0
kLocalAnyFunc, 0, 19), // table 1
kLocalFuncRef, 0, 15, // table 0
kLocalFuncRef, 0, 19), // table 1
// elements ------------------------------------------------------------
SECTION(Element,
4, // entry count
@ -1227,7 +1227,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTablesArbitraryOrder) {
EXPECT_VERIFIES(data);
}
TEST_F(WasmModuleVerifyTest, ElementSectionInitAnyRefTableWithAnyFunc) {
TEST_F(WasmModuleVerifyTest, ElementSectionInitAnyRefTableWithFuncRef) {
WASM_FEATURE_SCOPE(anyref);
WASM_FEATURE_SCOPE(bulk_memory);
static const byte data[] = {
@ -1238,7 +1238,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionInitAnyRefTableWithAnyFunc) {
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(2), // section header
kLocalAnyRef, 0, 5, // table 0
kLocalAnyFunc, 0, 9), // table 1
kLocalFuncRef, 0, 9), // table 1
// elements ------------------------------------------------------------
SECTION(Element,
ENTRY_COUNT(2), // entry count
@ -1271,7 +1271,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionDontInitAnyRefImportedTable) {
ADD_COUNT('m'), // module name
ADD_COUNT('t'), // table name
kExternalTable, // import kind
kLocalAnyFunc, // elem_type
kLocalFuncRef, // elem_type
0, // no maximum field
5, // initial size
ADD_COUNT('m'), // module name
@ -1284,8 +1284,8 @@ TEST_F(WasmModuleVerifyTest, ElementSectionDontInitAnyRefImportedTable) {
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration ---------------------------------------------------
SECTION(Table, ENTRY_COUNT(2), // section header
kLocalAnyFunc, 0, 15, // table 0
kLocalAnyFunc, 0, 19), // table 1
kLocalFuncRef, 0, 15, // table 0
kLocalFuncRef, 0, 19), // table 1
// elements ------------------------------------------------------------
SECTION(Element,
ENTRY_COUNT(4), // entry count
@ -1329,10 +1329,10 @@ TEST_F(WasmModuleVerifyTest, MultipleTablesWithoutFlag) {
static const byte data[] = {
SECTION(Table, // table section
ENTRY_COUNT(2), // 2 tables
kLocalAnyFunc, // table 1: type
kLocalFuncRef, // table 1: type
0, // table 1: no maximum
10, // table 1: minimum size
kLocalAnyFunc, // table 2: type
kLocalFuncRef, // table 2: type
0, // table 2: no maximum
10), // table 2: minimum size
};
@ -1344,7 +1344,7 @@ TEST_F(WasmModuleVerifyTest, MultipleTablesWithFlag) {
static const byte data[] = {
SECTION(Table, // table section
ENTRY_COUNT(2), // 2 tables
kLocalAnyFunc, // table 1: type
kLocalFuncRef, // table 1: type
0, // table 1: no maximum
10, // table 1: minimum size
kLocalAnyRef, // table 2: type
@ -1358,7 +1358,7 @@ TEST_F(WasmModuleVerifyTest, MultipleTablesWithFlag) {
EXPECT_EQ(2u, result.value()->tables.size());
EXPECT_EQ(10u, result.value()->tables[0].initial_size);
EXPECT_EQ(kWasmAnyFunc, result.value()->tables[0].type);
EXPECT_EQ(kWasmFuncRef, result.value()->tables[0].type);
EXPECT_EQ(11u, result.value()->tables[1].initial_size);
EXPECT_EQ(kWasmAnyRef, result.value()->tables[1].type);
@ -1546,7 +1546,7 @@ TEST_F(WasmSignatureDecodeTest, Fail_off_end) {
TEST_F(WasmSignatureDecodeTest, Fail_anyref_without_flag) {
// Disable AnyRef support and check that decoding fails.
WASM_FEATURE_SCOPE_VAL(anyref, false);
byte ref_types[] = {kLocalAnyFunc, kLocalAnyRef};
byte ref_types[] = {kLocalFuncRef, kLocalAnyRef};
for (byte invalid_type : ref_types) {
for (size_t i = 0;; i++) {
byte data[] = {SIG_ENTRY_x_xx(kLocalI32, kLocalI32, kLocalI32)};
@ -2352,9 +2352,9 @@ TEST_F(WasmModuleVerifyTest, PassiveElementSegment) {
// funcs -----------------------------------------------------------------
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration -----------------------------------------------------
SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 1),
SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1),
// element segments -----------------------------------------------------
SECTION(Element, ENTRY_COUNT(1), PASSIVE, kLocalAnyFunc, U32V_1(3),
SECTION(Element, ENTRY_COUNT(1), PASSIVE, kLocalFuncRef, U32V_1(3),
REF_FUNC_ELEMENT(0), REF_FUNC_ELEMENT(0), REF_NULL_ELEMENT),
// code ------------------------------------------------------------------
ONE_EMPTY_BODY};
@ -2371,7 +2371,7 @@ TEST_F(WasmModuleVerifyTest, PassiveElementSegmentAnyRef) {
// funcs -----------------------------------------------------------------
ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
// table declaration -----------------------------------------------------
SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 1),
SECTION(Table, ENTRY_COUNT(1), kLocalFuncRef, 0, 1),
// element segments -----------------------------------------------------
SECTION(Element, ENTRY_COUNT(1), PASSIVE, kLocalAnyRef, U32V_1(0)),
// code ------------------------------------------------------------------