Lines Matching refs:imm

638                       const BranchTableImmediate<validate>& imm)
640 start_(imm.start),
641 pc_(imm.table),
642 table_count_(imm.table_count) {}
912 F(S128Const, Simd128Immediate<validate>& imm, Value* result) \
917 F(GlobalGet, Value* result, const GlobalIndexImmediate<validate>& imm) \
918 F(StructNewWithRtt, const StructIndexImmediate<validate>& imm, \
920 F(StructNewDefault, const StructIndexImmediate<validate>& imm, \
922 F(ArrayInit, const ArrayIndexImmediate<validate>& imm, \
942 F(LocalGet, Value* result, const IndexImmediate<validate>& imm) \
943 F(LocalSet, const Value& value, const IndexImmediate<validate>& imm) \
945 const IndexImmediate<validate>& imm) \
948 F(GlobalSet, const Value& value, const GlobalIndexImmediate<validate>& imm) \
950 const IndexImmediate<validate>& imm) \
952 const IndexImmediate<validate>& imm) \
959 F(BrTable, const BranchTableImmediate<validate>& imm, const Value& key) \
961 F(LoadMem, LoadType type, const MemoryAccessImmediate<validate>& imm, \
964 const MemoryAccessImmediate<validate>& imm, const Value& index, \
967 const MemoryAccessImmediate<validate>& imm, const uint8_t laneidx, \
969 F(StoreMem, StoreType type, const MemoryAccessImmediate<validate>& imm, \
971 F(StoreLane, StoreType type, const MemoryAccessImmediate<validate>& imm, \
975 F(CallDirect, const CallFunctionImmediate<validate>& imm, \
978 const CallIndirectImmediate<validate>& imm, const Value args[], \
984 F(ReturnCall, const CallFunctionImmediate<validate>& imm, \
987 const CallIndirectImmediate<validate>& imm, const Value args[]) \
992 F(SimdLaneOp, WasmOpcode opcode, const SimdLaneImmediate<validate>& imm, \
994 F(S128Const, const Simd128Immediate<validate>& imm, Value* result) \
995 F(Simd8x16ShuffleOp, const Simd128Immediate<validate>& imm, \
997 F(Throw, const TagIndexImmediate<validate>& imm, \
1000 F(CatchException, const TagIndexImmediate<validate>& imm, Control* block, \
1005 const MemoryAccessImmediate<validate>& imm, Value* result) \
1007 F(MemoryInit, const MemoryInitImmediate<validate>& imm, const Value& dst, \
1009 F(DataDrop, const IndexImmediate<validate>& imm) \
1010 F(MemoryCopy, const MemoryCopyImmediate<validate>& imm, const Value& dst, \
1012 F(MemoryFill, const MemoryIndexImmediate<validate>& imm, const Value& dst, \
1014 F(TableInit, const TableInitImmediate<validate>& imm, \
1016 F(ElemDrop, const IndexImmediate<validate>& imm) \
1017 F(TableCopy, const TableCopyImmediate<validate>& imm, \
1019 F(TableGrow, const IndexImmediate<validate>& imm, const Value& value, \
1021 F(TableSize, const IndexImmediate<validate>& imm, Value* result) \
1022 F(TableFill, const IndexImmediate<validate>& imm, const Value& start, \
1028 F(ArrayNewWithRtt, const ArrayIndexImmediate<validate>& imm, \
1031 F(ArrayNewDefault, const ArrayIndexImmediate<validate>& imm, \
1034 const ArrayIndexImmediate<validate>& imm, const Value& index, \
1037 const ArrayIndexImmediate<validate>& imm, const Value& index, \
1209 BlockTypeImmediate<validate> imm(WasmFeatures::All(), decoder, pc + 1,
1213 pc + 1 + imm.length, &locals_length, base::Optional<uint32_t>());
1219 IndexImmediate<validate> imm(decoder, pc + 1, "local index");
1221 if (imm.index >= local_offsets[depth] &&
1222 imm.index - local_offsets[depth] < locals_count) {
1223 assigned->Add(imm.index - local_offsets[depth]);
1246 bool Validate(const byte* pc, TagIndexImmediate<validate>& imm) {
1247 if (!VALIDATE(imm.index < module_->tags.size())) {
1248 DecodeError(pc, "Invalid tag index: %u", imm.index);
1251 imm.tag = &module_->tags[imm.index];
1255 bool Validate(const byte* pc, GlobalIndexImmediate<validate>& imm) {
1258 if (!VALIDATE(imm.index < module_->globals.size())) {
1259 DecodeError(pc, "Invalid global index: %u", imm.index);
1262 imm.global = &module_->globals[imm.index];
1265 if (!VALIDATE(!imm.global->mutability)) {
1271 if (!VALIDATE(imm.global->imported || this->enabled_.has_gc())) {
1282 bool Validate(const byte* pc, StructIndexImmediate<validate>& imm) {
1283 if (!VALIDATE(module_->has_struct(imm.index))) {
1284 DecodeError(pc, "invalid struct index: %u", imm.index);
1287 imm.struct_type = module_->struct_type(imm.index);
1291 bool Validate(const byte* pc, FieldImmediate<validate>& imm) {
1292 if (!Validate(pc, imm.struct_imm)) return false;
1293 if (!VALIDATE(imm.field_imm.index <
1294 imm.struct_imm.struct_type->field_count())) {
1295 DecodeError(pc + imm.struct_imm.length, "invalid field index: %u",
1296 imm.field_imm.index);
1302 bool Validate(const byte* pc, ArrayIndexImmediate<validate>& imm) {
1303 if (!VALIDATE(module_->has_array(imm.index))) {
1304 DecodeError(pc, "invalid array index: %u", imm.index);
1307 imm.array_type = module_->array_type(imm.index);
1320 bool Validate(const byte* pc, CallFunctionImmediate<validate>& imm) {
1321 if (!VALIDATE(imm.index < module_->functions.size())) {
1322 DecodeError(pc, "function index #%u is out of bounds", imm.index);
1325 imm.sig = module_->functions[imm.index].sig;
1329 bool Validate(const byte* pc, CallIndirectImmediate<validate>& imm) {
1330 if (!ValidateSignature(pc, imm.sig_imm)) return false;
1331 if (!ValidateTable(pc + imm.sig_imm.length, imm.table_imm)) {
1334 ValueType table_type = module_->tables[imm.table_imm.index].type;
1338 imm.table_imm.index);
1344 ValueType immediate_type = ValueType::Ref(imm.sig_imm.index, kNonNullable);
1349 imm.sig_imm.index, imm.table_imm.index);
1353 imm.sig = module_->signature(imm.sig_imm.index);
1357 bool Validate(const byte* pc, BranchDepthImmediate<validate>& imm,
1359 if (!VALIDATE(imm.depth < control_depth)) {
1360 DecodeError(pc, "invalid branch depth: %u", imm.depth);
1366 bool Validate(const byte* pc, BranchTableImmediate<validate>& imm,
1368 if (!VALIDATE(imm.table_count <= kV8MaxWasmFunctionBrTableSize)) {
1370 imm.table_count);
1373 return checkAvailable(imm.table_count);
1377 SimdLaneImmediate<validate>& imm) {
1414 if (!VALIDATE(imm.lane >= 0 && imm.lane < num_lanes)) {
1422 bool Validate(const byte* pc, Simd128Immediate<validate>& imm) {
1425 max_lane = std::max(max_lane, imm.value[i]);
1435 bool Validate(const byte* pc, BlockTypeImmediate<validate>& imm) {
1436 if (imm.type != kWasmBottom) return true;
1437 if (!VALIDATE(module_->has_signature(imm.sig_index))) {
1439 imm.sig_index);
1442 imm.sig = module_->signature(imm.sig_index);
1446 bool Validate(const byte* pc, MemoryIndexImmediate<validate>& imm) {
1451 if (!VALIDATE(imm.index == uint8_t{0})) {
1452 DecodeError(pc, "expected memory index 0, found %u", imm.index);
1458 bool Validate(const byte* pc, MemoryAccessImmediate<validate>& imm) {
1466 bool Validate(const byte* pc, MemoryInitImmediate<validate>& imm) {
1467 return ValidateDataSegment(pc, imm.data_segment) &&
1468 Validate(pc + imm.data_segment.length, imm.memory);
1471 bool Validate(const byte* pc, MemoryCopyImmediate<validate>& imm) {
1472 return Validate(pc, imm.memory_src) &&
1473 Validate(pc + imm.memory_src.length, imm.memory_dst);
1476 bool Validate(const byte* pc, TableInitImmediate<validate>& imm) {
1477 if (!ValidateElementSegment(pc, imm.element_segment)) return false;
1478 if (!ValidateTable(pc + imm.element_segment.length, imm.table)) {
1482 module_->elem_segments[imm.element_segment.index].type;
1483 if (!VALIDATE(IsSubtypeOf(elem_type, module_->tables[imm.table.index].type,
1485 DecodeError(pc, "table %u is not a super-type of %s", imm.table.index,
1492 bool Validate(const byte* pc, TableCopyImmediate<validate>& imm) {
1493 if (!ValidateTable(pc, imm.table_src)) return false;
1494 if (!ValidateTable(pc + imm.table_src.length, imm.table_dst)) return false;
1495 ValueType src_type = module_->tables[imm.table_src.index].type;
1497 src_type, module_->tables[imm.table_dst.index].type, module_))) {
1498 DecodeError(pc, "table %u is not a super-type of %s", imm.table_dst.index,
1507 bool ValidateTable(const byte* pc, IndexImmediate<validate>& imm) {
1508 if (imm.index > 0 || imm.length > 1) {
1511 if (!VALIDATE(imm.index < module_->tables.size())) {
1512 DecodeError(pc, "invalid table index: %u", imm.index);
1518 bool ValidateElementSegment(const byte* pc, IndexImmediate<validate>& imm) {
1519 if (!VALIDATE(imm.index < module_->elem_segments.size())) {
1520 DecodeError(pc, "invalid element segment index: %u", imm.index);
1526 bool ValidateLocal(const byte* pc, IndexImmediate<validate>& imm) {
1527 if (!VALIDATE(imm.index < num_locals())) {
1528 DecodeError(pc, "invalid local index: %u", imm.index);
1534 bool ValidateType(const byte* pc, IndexImmediate<validate>& imm) {
1535 if (!VALIDATE(module_->has_type(imm.index))) {
1536 DecodeError(pc, "invalid type index: %u", imm.index);
1542 bool ValidateSignature(const byte* pc, IndexImmediate<validate>& imm) {
1543 if (!VALIDATE(module_->has_signature(imm.index))) {
1544 DecodeError(pc, "invalid signature index: %u", imm.index);
1550 bool ValidateFunction(const byte* pc, IndexImmediate<validate>& imm) {
1551 if (!VALIDATE(imm.index < module_->functions.size())) {
1552 DecodeError(pc, "function index #%u is out of bounds", imm.index);
1556 !VALIDATE(module_->functions[imm.index].declared)) {
1557 DecodeError(pc, "undeclared reference to function #%u", imm.index);
1563 bool ValidateDataSegment(const byte* pc, IndexImmediate<validate>& imm) {
1564 if (!VALIDATE(imm.index < module_->num_declared_data_segments)) {
1565 DecodeError(pc, "invalid data segment index: %u", imm.index);
1592 BlockTypeImmediate<validate> imm(WasmFeatures::All(), decoder, pc + 1,
1594 return 1 + imm.length;
1602 BranchDepthImmediate<validate> imm(decoder, pc + 1);
1603 return 1 + imm.length;
1606 BranchTableImmediate<validate> imm(decoder, pc + 1);
1607 BranchTableIterator<validate> iterator(decoder, imm);
1612 TagIndexImmediate<validate> imm(decoder, pc + 1);
1613 return 1 + imm.length;
1616 BlockTypeImmediate<validate> imm(WasmFeatures::All(), decoder, pc + 1,
1620 pc + 1 + imm.length, &locals_length, base::Optional<uint32_t>());
1621 return 1 + imm.length + ((new_locals_count >= 0) ? locals_length : 0);
1627 CallFunctionImmediate<validate> imm(decoder, pc + 1);
1628 return 1 + imm.length;
1632 CallIndirectImmediate<validate> imm(decoder, pc + 1);
1633 return 1 + imm.length;
1642 SelectTypeImmediate<validate> imm(WasmFeatures::All(), decoder, pc + 1,
1644 return 1 + imm.length;
1650 IndexImmediate<validate> imm(decoder, pc + 1, "local index");
1651 return 1 + imm.length;
1655 GlobalIndexImmediate<validate> imm(decoder, pc + 1);
1656 return 1 + imm.length;
1660 IndexImmediate<validate> imm(decoder, pc + 1, "table index");
1661 return 1 + imm.length;
1664 ImmI32Immediate<validate> imm(decoder, pc + 1);
1665 return 1 + imm.length;
1668 ImmI64Immediate<validate> imm(decoder, pc + 1);
1669 return 1 + imm.length;
1676 HeapTypeImmediate<validate> imm(WasmFeatures::All(), decoder, pc + 1,
1678 return 1 + imm.length;
1684 IndexImmediate<validate> imm(decoder, pc + 1, "function index");
1685 return 1 + imm.length;
1698 MemoryAccessImmediate<validate> imm(decoder, pc + 1, UINT32_MAX,
1700 return 1 + imm.length;
1705 MemoryIndexImmediate<validate> imm(decoder, pc + 1);
1706 return 1 + imm.length;
1724 MemoryInitImmediate<validate> imm(decoder, pc + length);
1725 return length + imm.length;
1728 IndexImmediate<validate> imm(decoder, pc + length,
1730 return length + imm.length;
1733 MemoryCopyImmediate<validate> imm(decoder, pc + length);
1734 return length + imm.length;
1737 MemoryIndexImmediate<validate> imm(decoder, pc + length);
1738 return length + imm.length;
1741 TableInitImmediate<validate> imm(decoder, pc + length);
1742 return length + imm.length;
1745 IndexImmediate<validate> imm(decoder, pc + length,
1747 return length + imm.length;
1750 TableCopyImmediate<validate> imm(decoder, pc + length);
1751 return length + imm.length;
1756 IndexImmediate<validate> imm(decoder, pc + length, "table index");
1757 return length + imm.length;
1776 MemoryAccessImmediate<validate> imm(decoder, pc + length,
1779 return length + imm.length;
1782 MemoryAccessImmediate<validate> imm(
1786 return length + imm.length + 1;
1806 MemoryAccessImmediate<validate> imm(decoder, pc + length,
1809 return length + imm.length;
1830 StructIndexImmediate<validate> imm(decoder, pc + length);
1831 return length + imm.length;
1837 FieldImmediate<validate> imm(decoder, pc + length);
1838 return length + imm.length;
1849 ArrayIndexImmediate<validate> imm(decoder, pc + length);
1850 return length + imm.length;
1877 BranchDepthImmediate<validate> imm(decoder, pc + length);
1878 return length + imm.length;
1885 IndexImmediate<validate> imm(decoder, pc + length, "type index");
1886 return length + imm.length;
1976 CallFunctionImmediate<validate> imm(this, pc + 1);
1977 CHECK(Validate(pc + 1, imm));
1978 return {imm.sig->parameter_count(), imm.sig->return_count()};
1981 CallIndirectImmediate<validate> imm(this, pc + 1);
1982 CHECK(Validate(pc + 1, imm));
1984 return {imm.sig->parameter_count() + 1,
1985 imm.sig->return_count()};
1988 TagIndexImmediate<validate> imm(this, pc + 1);
1989 CHECK(Validate(pc + 1, imm));
1990 DCHECK_EQ(0, imm.tag->sig->return_count());
1991 return {imm.tag->sig->parameter_count(), 0};
2082 StructIndexImmediate<validate> imm(this, pc + 2);
2083 CHECK(Validate(pc + 2, imm));
2084 return {imm.struct_type->field_count() + 1, 1};
2087 StructIndexImmediate<validate> imm(this, pc + 2);
2088 CHECK(Validate(pc + 2, imm));
2089 return {imm.struct_type->field_count(), 1};
2580 BlockTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
2582 if (!this->Validate(this->pc_ + 1, imm)) return 0;
2583 ArgVector args = PeekArgs(imm.sig);
2585 SetBlockType(block, imm, args.begin());
2587 DropArgs(imm.sig);
2589 return 1 + imm.length;
2594 BranchDepthImmediate<validate> imm(this, this->pc_ + 1);
2595 if (!this->Validate(this->pc_ + 1, imm, control_.size())) return 0;
2596 Control* c = control_at(imm.depth);
2603 return 1 + imm.length;
2608 TagIndexImmediate<validate> imm(this, this->pc_ + 1);
2609 if (!this->Validate(this->pc_ + 1, imm)) return 0;
2610 ArgVector args = PeekArgs(imm.tag->ToFunctionSig());
2611 CALL_INTERFACE_IF_OK_AND_REACHABLE(Throw, imm, base::VectorOf(args));
2612 DropArgs(imm.tag->ToFunctionSig());
2614 return 1 + imm.length;
2619 BlockTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
2621 if (!this->Validate(this->pc_ + 1, imm)) return 0;
2622 ArgVector args = PeekArgs(imm.sig);
2624 SetBlockType(try_block, imm, args.begin());
2628 DropArgs(imm.sig);
2630 return 1 + imm.length;
2635 TagIndexImmediate<validate> imm(this, this->pc_ + 1);
2636 if (!this->Validate(this->pc_ + 1, imm)) return 0;
2654 const WasmTagSig* sig = imm.tag->sig;
2659 CALL_INTERFACE_IF_OK_AND_PARENT_REACHABLE(CatchException, imm, c, values);
2661 return 1 + imm.length;
2666 BranchDepthImmediate<validate> imm(this, this->pc_ + 1);
2668 if (!this->Validate(this->pc_ + 1, imm, control_depth() - 1)) return 0;
2675 uint32_t target_depth = imm.depth + 1;
2687 return 1 + imm.length;
2714 BranchDepthImmediate<validate> imm(this, this->pc_ + 1);
2715 if (!this->Validate(this->pc_ + 1, imm, control_.size())) return 0;
2717 Control* c = control_at(imm.depth);
2734 CALL_INTERFACE(BrOnNull, ref_object, imm.depth, false, &result);
2747 return 1 + imm.length;
2752 BranchDepthImmediate<validate> imm(this, this->pc_ + 1);
2753 if (!this->Validate(this->pc_ + 1, imm, control_.size())) return 0;
2760 Control* c = control_at(imm.depth);
2771 CALL_INTERFACE(BrOrRet, imm.depth, 0);
2781 CALL_INTERFACE(BrOnNonNull, ref_object, imm.depth);
2792 return 1 + imm.length;
2797 BlockTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
2799 if (!this->Validate(this->pc_ + 1, imm)) return 0;
2804 this->DecodeLocals(this->pc() + 1 + imm.length, &locals_length, 0);
2810 ArgVector args = PeekArgs(imm.sig, new_locals_count);
2813 SetBlockType(let_block, imm, args.begin());
2818 DropArgs(imm.sig); // Drop {args}.
2820 return 1 + imm.length + locals_length;
2824 BlockTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
2826 if (!this->Validate(this->pc_ + 1, imm)) return 0;
2827 ArgVector args = PeekArgs(imm.sig);
2829 SetBlockType(&control_.back(), imm, args.begin());
2831 DropArgs(imm.sig);
2833 return 1 + imm.length;
2837 BlockTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
2839 if (!this->Validate(this->pc_ + 1, imm)) return 0;
2841 ArgVector args = PeekArgs(imm.sig, 1);
2844 SetBlockType(if_block, imm, args.begin());
2847 DropArgs(imm.sig); // Drop {args}.
2849 return 1 + imm.length;
2948 SelectTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
2952 Value fval = Peek(1, 1, imm.type);
2953 Value tval = Peek(2, 0, imm.type);
2954 Value result = CreateValue(imm.type);
2958 return 1 + imm.length;
2962 BranchDepthImmediate<validate> imm(this, this->pc_ + 1);
2963 if (!this->Validate(this->pc_ + 1, imm, control_.size())) return 0;
2964 Control* c = control_at(imm.depth);
2967 CALL_INTERFACE(BrOrRet, imm.depth, 0);
2971 return 1 + imm.length;
2975 BranchDepthImmediate<validate> imm(this, this->pc_ + 1);
2976 if (!this->Validate(this->pc_ + 1, imm, control_.size())) return 0;
2978 Control* c = control_at(imm.depth);
2981 CALL_INTERFACE(BrIf, cond, imm.depth);
2985 return 1 + imm.length;
2989 BranchTableImmediate<validate> imm(this, this->pc_ + 1);
2990 BranchTableIterator<validate> iterator(this, imm);
2993 if (!this->Validate(this->pc_ + 1, imm, control_.size())) return 0;
3027 CALL_INTERFACE(BrTable, imm, key);
3049 ImmI32Immediate<validate> imm(this, this->pc_ + 1);
3051 CALL_INTERFACE_IF_OK_AND_REACHABLE(I32Const, &value, imm.value);
3053 return 1 + imm.length;
3057 ImmI64Immediate<validate> imm(this, this->pc_ + 1);
3059 CALL_INTERFACE_IF_OK_AND_REACHABLE(I64Const, &value, imm.value);
3061 return 1 + imm.length;
3065 ImmF32Immediate<validate> imm(this, this->pc_ + 1);
3067 CALL_INTERFACE_IF_OK_AND_REACHABLE(F32Const, &value, imm.value);
3069 return 1 + imm.length;
3073 ImmF64Immediate<validate> imm(this, this->pc_ + 1);
3075 CALL_INTERFACE_IF_OK_AND_REACHABLE(F64Const, &value, imm.value);
3077 return 1 + imm.length;
3082 HeapTypeImmediate<validate> imm(this->enabled_, this, this->pc_ + 1,
3085 ValueType type = ValueType::Ref(imm.type, kNullable);
3089 return 1 + imm.length;
3123 IndexImmediate<validate> imm(this, this->pc_ + 1, "function index");
3124 if (!this->ValidateFunction(this->pc_ + 1, imm)) return 0;
3126 ? this->module_->functions[imm.index].sig_index
3129 CALL_INTERFACE_IF_OK_AND_REACHABLE(RefFunc, imm.index, &value);
3131 return 1 + imm.length;
3160 IndexImmediate<validate> imm(this, this->pc_ + 1, "local index");
3161 if (!this->ValidateLocal(this->pc_ + 1, imm)) return 0;
3163 this->is_local_initialized(imm.index))) {
3165 imm.index);
3168 Value value = CreateValue(this->local_type(imm.index));
3169 CALL_INTERFACE_IF_OK_AND_REACHABLE(LocalGet, &value, imm);
3171 return 1 + imm.length;
3175 IndexImmediate<validate> imm(this, this->pc_ + 1, "local index");
3176 if (!this->ValidateLocal(this->pc_ + 1, imm)) return 0;
3177 Value value = Peek(0, 0, this->local_type(imm.index));
3178 CALL_INTERFACE_IF_OK_AND_REACHABLE(LocalSet, value, imm);
3180 this->set_local_initialized(imm.index);
3181 return 1 + imm.length;
3185 IndexImmediate<validate> imm(this, this->pc_ + 1, "local index");
3186 if (!this->ValidateLocal(this->pc_ + 1, imm)) return 0;
3187 ValueType local_type = this->local_type(imm.index);
3190 CALL_INTERFACE_IF_OK_AND_REACHABLE(LocalTee, value, &result, imm);
3193 this->set_local_initialized(imm.index);
3194 return 1 + imm.length;
3205 GlobalIndexImmediate<validate> imm(this, this->pc_ + 1);
3206 if (!this->Validate(this->pc_ + 1, imm)) return 0;
3207 Value result = CreateValue(imm.global->type);
3208 CALL_INTERFACE_IF_OK_AND_REACHABLE(GlobalGet, &result, imm);
3210 return 1 + imm.length;
3214 GlobalIndexImmediate<validate> imm(this, this->pc_ + 1);
3215 if (!this->Validate(this->pc_ + 1, imm)) return 0;
3216 if (!VALIDATE(imm.global->mutability)) {
3217 this->DecodeError("immutable global #%u cannot be assigned", imm.index);
3220 Value value = Peek(0, 0, imm.global->type);
3221 CALL_INTERFACE_IF_OK_AND_REACHABLE(GlobalSet, value, imm);
3223 return 1 + imm.length;
3228 IndexImmediate<validate> imm(this, this->pc_ + 1, "table index");
3229 if (!this->ValidateTable(this->pc_ + 1, imm)) return 0;
3231 Value result = CreateValue(this->module_->tables[imm.index].type);
3232 CALL_INTERFACE_IF_OK_AND_REACHABLE(TableGet, index, &result, imm);
3235 return 1 + imm.length;
3240 IndexImmediate<validate> imm(this, this->pc_ + 1, "table index");
3241 if (!this->ValidateTable(this->pc_ + 1, imm)) return 0;
3242 Value value = Peek(0, 1, this->module_->tables[imm.index].type);
3244 CALL_INTERFACE_IF_OK_AND_REACHABLE(TableSet, index, value, imm);
3246 return 1 + imm.length;
3284 MemoryIndexImmediate<validate> imm(this, this->pc_ + 1);
3285 if (!this->Validate(this->pc_ + 1, imm)) return 0;
3294 return 1 + imm.length;
3298 MemoryIndexImmediate<validate> imm(this, this->pc_ + 1);
3299 if (!this->Validate(this->pc_ + 1, imm)) return 0;
3304 return 1 + imm.length;
3308 CallFunctionImmediate<validate> imm(this, this->pc_ + 1);
3309 if (!this->Validate(this->pc_ + 1, imm)) return 0;
3310 ArgVector args = PeekArgs(imm.sig);
3311 ReturnVector returns = CreateReturnValues(imm.sig);
3312 CALL_INTERFACE_IF_OK_AND_REACHABLE(CallDirect, imm, args.begin(),
3314 DropArgs(imm.sig);
3316 return 1 + imm.length;
3320 CallIndirectImmediate<validate> imm(this, this->pc_ + 1);
3321 if (!this->Validate(this->pc_ + 1, imm)) return 0;
3323 Peek(0, static_cast<int>(imm.sig->parameter_count()), kWasmI32);
3324 ArgVector args = PeekArgs(imm.sig, 1);
3325 ReturnVector returns = CreateReturnValues(imm.sig);
3326 CALL_INTERFACE_IF_OK_AND_REACHABLE(CallIndirect, index, imm, args.begin(),
3329 DropArgs(imm.sig);
3331 return 1 + imm.length;
3336 CallFunctionImmediate<validate> imm(this, this->pc_ + 1);
3337 if (!this->Validate(this->pc_ + 1, imm)) return 0;
3338 if (!VALIDATE(this->CanReturnCall(imm.sig))) {
3343 ArgVector args = PeekArgs(imm.sig);
3344 CALL_INTERFACE_IF_OK_AND_REACHABLE(ReturnCall, imm, args.begin());
3345 DropArgs(imm.sig);
3347 return 1 + imm.length;
3352 CallIndirectImmediate<validate> imm(this, this->pc_ + 1);
3353 if (!this->Validate(this->pc_ + 1, imm)) return 0;
3354 if (!VALIDATE(this->CanReturnCall(imm.sig))) {
3361 ArgVector args = PeekArgs(imm.sig, 1);
3362 CALL_INTERFACE_IF_OK_AND_REACHABLE(ReturnCallIndirect, index, imm,
3365 DropArgs(imm.sig);
3367 return 1 + imm.length;
3617 void SetBlockType(Control* c, BlockTypeImmediate<validate>& imm,
3620 InitMerge(&c->end_merge, imm.out_arity(), [pc, &imm](uint32_t i) {
3621 return Value{pc, imm.out_type(i)};
3623 InitMerge(&c->start_merge, imm.in_arity(), [&imm, args](uint32_t i) {
3629 value.type = imm.in_type(i);
3762 MemoryAccessImmediate<validate> imm =
3764 if (!this->Validate(this->pc_ + prefix_len, imm)) return 0;
3768 CALL_INTERFACE_IF_OK_AND_REACHABLE(LoadMem, type, imm, index, &result);
3771 return prefix_len + imm.length;
3779 MemoryAccessImmediate<validate> imm =
3781 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
3785 CALL_INTERFACE_IF_OK_AND_REACHABLE(LoadTransform, type, transform, imm,
3789 return opcode_length + imm.length;
3828 MemoryAccessImmediate<validate> imm =
3830 if (!this->Validate(this->pc_ + prefix_len, imm)) return 0;
3834 CALL_INTERFACE_IF_OK_AND_REACHABLE(StoreMem, store, imm, index, value);
3836 return prefix_len + imm.length;
3840 Simd128Immediate<validate> imm(this, this->pc_ + opcode_length);
3842 CALL_INTERFACE_IF_OK_AND_REACHABLE(S128Const, imm, &result);
3849 SimdLaneImmediate<validate> imm(this, this->pc_ + opcode_length);
3850 if (this->Validate(this->pc_ + opcode_length, opcode, imm)) {
3853 CALL_INTERFACE_IF_OK_AND_REACHABLE(SimdLaneOp, opcode, imm,
3858 return opcode_length + imm.length;
3863 SimdLaneImmediate<validate> imm(this, this->pc_ + opcode_length);
3864 if (this->Validate(this->pc_ + opcode_length, opcode, imm)) {
3867 CALL_INTERFACE_IF_OK_AND_REACHABLE(SimdLaneOp, opcode, imm,
3872 return opcode_length + imm.length;
3876 Simd128Immediate<validate> imm(this, this->pc_ + opcode_length);
3877 if (this->Validate(this->pc_ + opcode_length, imm)) {
3881 CALL_INTERFACE_IF_OK_AND_REACHABLE(Simd8x16ShuffleOp, imm, input0, input1,
4056 StructIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
4057 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
4058 ValueType rtt_type = ValueType::Rtt(imm.index);
4061 : Peek(0, imm.struct_type->field_count(), rtt_type);
4063 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &rtt);
4066 ArgVector args = PeekArgs(imm.struct_type, 1);
4067 Value value = CreateValue(ValueType::Ref(imm.index, kNonNullable));
4068 CALL_INTERFACE_IF_OK_AND_REACHABLE(StructNewWithRtt, imm, rtt,
4071 DropArgs(imm.struct_type);
4073 return opcode_length + imm.length;
4077 StructIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
4078 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
4080 for (uint32_t i = 0; i < imm.struct_type->field_count(); i++) {
4081 ValueType ftype = imm.struct_type->field(i);
4085 WasmOpcodes::OpcodeName(opcode), imm.index, i,
4091 ValueType rtt_type = ValueType::Rtt(imm.index);
4095 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &rtt);
4098 Value value = CreateValue(ValueType::Ref(imm.index, kNonNullable));
4099 CALL_INTERFACE_IF_OK_AND_REACHABLE(StructNewDefault, imm, rtt, &value);
4102 return opcode_length + imm.length;
4173 ArrayIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
4174 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
4175 ValueType rtt_type = ValueType::Rtt(imm.index);
4179 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &rtt);
4184 Peek(2, 0, imm.array_type->element_type().Unpacked());
4185 Value value = CreateValue(ValueType::Ref(imm.index, kNonNullable));
4186 CALL_INTERFACE_IF_OK_AND_REACHABLE(ArrayNewWithRtt, imm, length,
4190 return opcode_length + imm.length;
4195 ArrayIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
4196 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
4197 if (!VALIDATE(imm.array_type->element_type().is_defaultable())) {
4200 WasmOpcodes::OpcodeName(opcode), imm.index,
4201 imm.array_type->element_type().name().c_str());
4204 ValueType rtt_type = ValueType::Rtt(imm.index);
4208 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &rtt);
4212 Value value = CreateValue(ValueType::Ref(imm.index, kNonNullable));
4213 CALL_INTERFACE_IF_OK_AND_REACHABLE(ArrayNewDefault, imm, length, rtt,
4217 return opcode_length + imm.length;
4270 ArrayIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
4271 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
4272 if (!VALIDATE(imm.array_type->element_type().is_packed())) {
4276 WasmOpcodes::OpcodeName(opcode), imm.index,
4277 imm.array_type->element_type().name().c_str());
4281 Value array_obj = Peek(1, 0, ValueType::Ref(imm.index, kNullable));
4282 Value value = CreateValue(imm.array_type->element_type().Unpacked());
4283 CALL_INTERFACE_IF_OK_AND_REACHABLE(ArrayGet, array_obj, imm, index,
4287 return opcode_length + imm.length;
4291 ArrayIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
4292 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
4293 if (!VALIDATE(!imm.array_type->element_type().is_packed())) {
4297 imm.index, imm.array_type->element_type().name().c_str());
4301 Value array_obj = Peek(1, 0, ValueType::Ref(imm.index, kNullable));
4302 Value value = CreateValue(imm.array_type->element_type());
4303 CALL_INTERFACE_IF_OK_AND_REACHABLE(ArrayGet, array_obj, imm, index,
4307 return opcode_length + imm.length;
4311 ArrayIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
4312 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
4313 if (!VALIDATE(imm.array_type->mutability())) {
4315 imm.index);
4318 Value value = Peek(0, 2, imm.array_type->element_type().Unpacked());
4320 Value array_obj = Peek(2, 0, ValueType::Ref(imm.index, kNullable));
4321 CALL_INTERFACE_IF_OK_AND_REACHABLE(ArraySet, array_obj, imm, index,
4324 return opcode_length + imm.length;
4330 ArrayIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
4337 return opcode_length + imm.length;
4437 IndexImmediate<validate> imm(this, this->pc_ + opcode_length,
4439 if (!this->ValidateType(this->pc_ + opcode_length, imm)) return 0;
4440 Value value = CreateValue(ValueType::Rtt(imm.index));
4441 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &value);
4443 return opcode_length + imm.length;
4451 IndexImmediate<validate> imm(this, this->pc_ + opcode_length,
4453 if (!this->ValidateType(this->pc_ + opcode_length, imm)) return 0;
4454 opcode_length += imm.length;
4455 rtt = CreateValue(ValueType::Rtt(imm.index));
4456 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &rtt);
4507 IndexImmediate<validate> imm(this, this->pc_ + opcode_length,
4509 if (!this->ValidateType(this->pc_ + opcode_length, imm)) return 0;
4510 opcode_length += imm.length;
4511 rtt = CreateValue(ValueType::Rtt(imm.index));
4512 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &rtt);
4579 IndexImmediate<validate> imm(this, this->pc_ + pc_offset,
4581 if (!this->ValidateType(this->pc_ + opcode_length, imm)) return 0;
4582 pc_offset += imm.length;
4583 rtt = CreateValue(ValueType::Rtt(imm.index));
4584 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &rtt);
4664 IndexImmediate<validate> imm(this, this->pc_ + pc_offset,
4666 if (!this->ValidateType(this->pc_ + opcode_length, imm)) return 0;
4667 pc_offset += imm.length;
4668 rtt = CreateValue(ValueType::Rtt(imm.index));
4669 CALL_INTERFACE_IF_OK_AND_REACHABLE(RttCanon, imm.index, &rtt);
4969 MemoryAccessImmediate<validate> imm = MakeMemoryAccessImmediate(
4971 if (!this->Validate(this->pc_ + opcode_length, imm)) return false;
4979 imm, nullptr);
4984 imm, &result);
4988 return opcode_length + imm.length;
5006 MemoryInitImmediate<validate> imm(this, this->pc_ + opcode_length);
5007 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
5012 CALL_INTERFACE_IF_OK_AND_REACHABLE(MemoryInit, imm, dst, offset, size);
5014 return opcode_length + imm.length;
5017 IndexImmediate<validate> imm(this, this->pc_ + opcode_length,
5019 if (!this->ValidateDataSegment(this->pc_ + opcode_length, imm)) {
5022 CALL_INTERFACE_IF_OK_AND_REACHABLE(DataDrop, imm);
5023 return opcode_length + imm.length;
5026 MemoryCopyImmediate<validate> imm(this, this->pc_ + opcode_length);
5027 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
5032 CALL_INTERFACE_IF_OK_AND_REACHABLE(MemoryCopy, imm, dst, src, size);
5034 return opcode_length + imm.length;
5037 MemoryIndexImmediate<validate> imm(this, this->pc_ + opcode_length);
5038 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
5043 CALL_INTERFACE_IF_OK_AND_REACHABLE(MemoryFill, imm, dst, value, size);
5045 return opcode_length + imm.length;
5048 TableInitImmediate<validate> imm(this, this->pc_ + opcode_length);
5049 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
5051 CALL_INTERFACE_IF_OK_AND_REACHABLE(TableInit, imm,
5054 return opcode_length + imm.length;
5057 IndexImmediate<validate> imm(this, this->pc_ + opcode_length,
5059 if (!this->ValidateElementSegment(this->pc_ + opcode_length, imm)) {
5062 CALL_INTERFACE_IF_OK_AND_REACHABLE(ElemDrop, imm);
5063 return opcode_length + imm.length;
5066 TableCopyImmediate<validate> imm(this, this->pc_ + opcode_length);
5067 if (!this->Validate(this->pc_ + opcode_length, imm)) return 0;
5069 CALL_INTERFACE_IF_OK_AND_REACHABLE(TableCopy, imm,
5072 return opcode_length + imm.length;
5075 IndexImmediate<validate> imm(this, this->pc_ + opcode_length,
5077 if (!this->ValidateTable(this->pc_ + opcode_length, imm)) return 0;
5079 Value value = Peek(1, 0, this->module_->tables[imm.index].type);
5081 CALL_INTERFACE_IF_OK_AND_REACHABLE(TableGrow, imm, value, delta,
5085 return opcode_length + imm.length;
5088 IndexImmediate<validate> imm(this, this->pc_ + opcode_length,
5090 if (!this->ValidateTable(this->pc_ + opcode_length, imm)) return 0;
5092 CALL_INTERFACE_IF_OK_AND_REACHABLE(TableSize, imm, &result);
5094 return opcode_length + imm.length;
5097 IndexImmediate<validate> imm(this, this->pc_ + opcode_length,
5099 if (!this->ValidateTable(this->pc_ + opcode_length, imm)) return 0;
5101 Value value = Peek(1, 1, this->module_->tables[imm.index].type);
5103 CALL_INTERFACE_IF_OK_AND_REACHABLE(TableFill, imm, start, value, count);
5105 return opcode_length + imm.length;