Movatterモバイル変換


[0]ホーム

URL:


wasm

package
v1.10.1Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2025 License:Apache-2.0Imports:28Imported by:0

Details

Repository

github.com/tetratelabs/wazero

Links

Documentation

Index

Constants

View Source
const (OpcodeUnreachableName       = "unreachable"OpcodeNopName               = "nop"OpcodeBlockName             = "block"OpcodeLoopName              = "loop"OpcodeIfName                = "if"OpcodeElseName              = "else"OpcodeEndName               = "end"OpcodeBrName                = "br"OpcodeBrIfName              = "br_if"OpcodeBrTableName           = "br_table"OpcodeReturnName            = "return"OpcodeCallName              = "call"OpcodeCallIndirectName      = "call_indirect"OpcodeDropName              = "drop"OpcodeSelectName            = "select"OpcodeTypedSelectName       = "typed_select"OpcodeLocalGetName          = "local.get"OpcodeLocalSetName          = "local.set"OpcodeLocalTeeName          = "local.tee"OpcodeGlobalGetName         = "global.get"OpcodeGlobalSetName         = "global.set"OpcodeI32LoadName           = "i32.load"OpcodeI64LoadName           = "i64.load"OpcodeF32LoadName           = "f32.load"OpcodeF64LoadName           = "f64.load"OpcodeI32Load8SName         = "i32.load8_s"OpcodeI32Load8UName         = "i32.load8_u"OpcodeI32Load16SName        = "i32.load16_s"OpcodeI32Load16UName        = "i32.load16_u"OpcodeI64Load8SName         = "i64.load8_s"OpcodeI64Load8UName         = "i64.load8_u"OpcodeI64Load16SName        = "i64.load16_s"OpcodeI64Load16UName        = "i64.load16_u"OpcodeI64Load32SName        = "i64.load32_s"OpcodeI64Load32UName        = "i64.load32_u"OpcodeI32StoreName          = "i32.store"OpcodeI64StoreName          = "i64.store"OpcodeF32StoreName          = "f32.store"OpcodeF64StoreName          = "f64.store"OpcodeI32Store8Name         = "i32.store8"OpcodeI32Store16Name        = "i32.store16"OpcodeI64Store8Name         = "i64.store8"OpcodeI64Store16Name        = "i64.store16"OpcodeI64Store32Name        = "i64.store32"OpcodeMemorySizeName        = "memory.size"OpcodeMemoryGrowName        = "memory.grow"OpcodeI32ConstName          = "i32.const"OpcodeI64ConstName          = "i64.const"OpcodeF32ConstName          = "f32.const"OpcodeF64ConstName          = "f64.const"OpcodeI32EqzName            = "i32.eqz"OpcodeI32EqName             = "i32.eq"OpcodeI32NeName             = "i32.ne"OpcodeI32LtSName            = "i32.lt_s"OpcodeI32LtUName            = "i32.lt_u"OpcodeI32GtSName            = "i32.gt_s"OpcodeI32GtUName            = "i32.gt_u"OpcodeI32LeSName            = "i32.le_s"OpcodeI32LeUName            = "i32.le_u"OpcodeI32GeSName            = "i32.ge_s"OpcodeI32GeUName            = "i32.ge_u"OpcodeI64EqzName            = "i64.eqz"OpcodeI64EqName             = "i64.eq"OpcodeI64NeName             = "i64.ne"OpcodeI64LtSName            = "i64.lt_s"OpcodeI64LtUName            = "i64.lt_u"OpcodeI64GtSName            = "i64.gt_s"OpcodeI64GtUName            = "i64.gt_u"OpcodeI64LeSName            = "i64.le_s"OpcodeI64LeUName            = "i64.le_u"OpcodeI64GeSName            = "i64.ge_s"OpcodeI64GeUName            = "i64.ge_u"OpcodeF32EqName             = "f32.eq"OpcodeF32NeName             = "f32.ne"OpcodeF32LtName             = "f32.lt"OpcodeF32GtName             = "f32.gt"OpcodeF32LeName             = "f32.le"OpcodeF32GeName             = "f32.ge"OpcodeF64EqName             = "f64.eq"OpcodeF64NeName             = "f64.ne"OpcodeF64LtName             = "f64.lt"OpcodeF64GtName             = "f64.gt"OpcodeF64LeName             = "f64.le"OpcodeF64GeName             = "f64.ge"OpcodeI32ClzName            = "i32.clz"OpcodeI32CtzName            = "i32.ctz"OpcodeI32PopcntName         = "i32.popcnt"OpcodeI32AddName            = "i32.add"OpcodeI32SubName            = "i32.sub"OpcodeI32MulName            = "i32.mul"OpcodeI32DivSName           = "i32.div_s"OpcodeI32DivUName           = "i32.div_u"OpcodeI32RemSName           = "i32.rem_s"OpcodeI32RemUName           = "i32.rem_u"OpcodeI32AndName            = "i32.and"OpcodeI32OrName             = "i32.or"OpcodeI32XorName            = "i32.xor"OpcodeI32ShlName            = "i32.shl"OpcodeI32ShrSName           = "i32.shr_s"OpcodeI32ShrUName           = "i32.shr_u"OpcodeI32RotlName           = "i32.rotl"OpcodeI32RotrName           = "i32.rotr"OpcodeI64ClzName            = "i64.clz"OpcodeI64CtzName            = "i64.ctz"OpcodeI64PopcntName         = "i64.popcnt"OpcodeI64AddName            = "i64.add"OpcodeI64SubName            = "i64.sub"OpcodeI64MulName            = "i64.mul"OpcodeI64DivSName           = "i64.div_s"OpcodeI64DivUName           = "i64.div_u"OpcodeI64RemSName           = "i64.rem_s"OpcodeI64RemUName           = "i64.rem_u"OpcodeI64AndName            = "i64.and"OpcodeI64OrName             = "i64.or"OpcodeI64XorName            = "i64.xor"OpcodeI64ShlName            = "i64.shl"OpcodeI64ShrSName           = "i64.shr_s"OpcodeI64ShrUName           = "i64.shr_u"OpcodeI64RotlName           = "i64.rotl"OpcodeI64RotrName           = "i64.rotr"OpcodeF32AbsName            = "f32.abs"OpcodeF32NegName            = "f32.neg"OpcodeF32CeilName           = "f32.ceil"OpcodeF32FloorName          = "f32.floor"OpcodeF32TruncName          = "f32.trunc"OpcodeF32NearestName        = "f32.nearest"OpcodeF32SqrtName           = "f32.sqrt"OpcodeF32AddName            = "f32.add"OpcodeF32SubName            = "f32.sub"OpcodeF32MulName            = "f32.mul"OpcodeF32DivName            = "f32.div"OpcodeF32MinName            = "f32.min"OpcodeF32MaxName            = "f32.max"OpcodeF32CopysignName       = "f32.copysign"OpcodeF64AbsName            = "f64.abs"OpcodeF64NegName            = "f64.neg"OpcodeF64CeilName           = "f64.ceil"OpcodeF64FloorName          = "f64.floor"OpcodeF64TruncName          = "f64.trunc"OpcodeF64NearestName        = "f64.nearest"OpcodeF64SqrtName           = "f64.sqrt"OpcodeF64AddName            = "f64.add"OpcodeF64SubName            = "f64.sub"OpcodeF64MulName            = "f64.mul"OpcodeF64DivName            = "f64.div"OpcodeF64MinName            = "f64.min"OpcodeF64MaxName            = "f64.max"OpcodeF64CopysignName       = "f64.copysign"OpcodeI32WrapI64Name        = "i32.wrap_i64"OpcodeI32TruncF32SName      = "i32.trunc_f32_s"OpcodeI32TruncF32UName      = "i32.trunc_f32_u"OpcodeI32TruncF64SName      = "i32.trunc_f64_s"OpcodeI32TruncF64UName      = "i32.trunc_f64_u"OpcodeI64ExtendI32SName     = "i64.extend_i32_s"OpcodeI64ExtendI32UName     = "i64.extend_i32_u"OpcodeI64TruncF32SName      = "i64.trunc_f32_s"OpcodeI64TruncF32UName      = "i64.trunc_f32_u"OpcodeI64TruncF64SName      = "i64.trunc_f64_s"OpcodeI64TruncF64UName      = "i64.trunc_f64_u"OpcodeF32ConvertI32SName    = "f32.convert_i32_s"OpcodeF32ConvertI32UName    = "f32.convert_i32_u"OpcodeF32ConvertI64SName    = "f32.convert_i64_s"OpcodeF32ConvertI64UName    = "f32.convert_i64u"OpcodeF32DemoteF64Name      = "f32.demote_f64"OpcodeF64ConvertI32SName    = "f64.convert_i32_s"OpcodeF64ConvertI32UName    = "f64.convert_i32_u"OpcodeF64ConvertI64SName    = "f64.convert_i64_s"OpcodeF64ConvertI64UName    = "f64.convert_i64_u"OpcodeF64PromoteF32Name     = "f64.promote_f32"OpcodeI32ReinterpretF32Name = "i32.reinterpret_f32"OpcodeI64ReinterpretF64Name = "i64.reinterpret_f64"OpcodeF32ReinterpretI32Name = "f32.reinterpret_i32"OpcodeF64ReinterpretI64Name = "f64.reinterpret_i64"OpcodeRefNullName   = "ref.null"OpcodeRefIsNullName = "ref.is_null"OpcodeRefFuncName   = "ref.func"OpcodeTableGetName = "table.get"OpcodeTableSetName = "table.set"OpcodeI32Extend8SName  = "i32.extend8_s"OpcodeI32Extend16SName = "i32.extend16_s"OpcodeI64Extend8SName  = "i64.extend8_s"OpcodeI64Extend16SName = "i64.extend16_s"OpcodeI64Extend32SName = "i64.extend32_s"OpcodeMiscPrefixName   = "misc_prefix"OpcodeVecPrefixName    = "vector_prefix"OpcodeAtomicPrefixName = "atomic_prefix")
View Source
const (OpcodeI32TruncSatF32SName = "i32.trunc_sat_f32_s"OpcodeI32TruncSatF32UName = "i32.trunc_sat_f32_u"OpcodeI32TruncSatF64SName = "i32.trunc_sat_f64_s"OpcodeI32TruncSatF64UName = "i32.trunc_sat_f64_u"OpcodeI64TruncSatF32SName = "i64.trunc_sat_f32_s"OpcodeI64TruncSatF32UName = "i64.trunc_sat_f32_u"OpcodeI64TruncSatF64SName = "i64.trunc_sat_f64_s"OpcodeI64TruncSatF64UName = "i64.trunc_sat_f64_u"OpcodeMemoryInitName = "memory.init"OpcodeDataDropName   = "data.drop"OpcodeMemoryCopyName = "memory.copy"OpcodeMemoryFillName = "memory.fill"OpcodeTableInitName  = "table.init"OpcodeElemDropName   = "elem.drop"OpcodeTableCopyName  = "table.copy"OpcodeTableGrowName  = "table.grow"OpcodeTableSizeName  = "table.size"OpcodeTableFillName  = "table.fill")
View Source
const (OpcodeVecV128LoadName                  = "v128.load"OpcodeVecV128Load8x8SName              = "v128.load8x8_s"OpcodeVecV128Load8x8UName              = "v128.load8x8_u"OpcodeVecV128Load16x4SName             = "v128.load16x4_s"OpcodeVecV128Load16x4UName             = "v128.load16x4_u"OpcodeVecV128Load32x2SName             = "v128.load32x2_s"OpcodeVecV128Load32x2UName             = "v128.load32x2_u"OpcodeVecV128Load8SplatName            = "v128.load8_splat"OpcodeVecV128Load16SplatName           = "v128.load16_splat"OpcodeVecV128Load32SplatName           = "v128.load32_splat"OpcodeVecV128Load64SplatName           = "v128.load64_splat"OpcodeVecV128Load32zeroName            = "v128.load32_zero"OpcodeVecV128Load64zeroName            = "v128.load64_zero"OpcodeVecV128StoreName                 = "v128.store"OpcodeVecV128Load8LaneName             = "v128.load8_lane"OpcodeVecV128Load16LaneName            = "v128.load16_lane"OpcodeVecV128Load32LaneName            = "v128.load32_lane"OpcodeVecV128Load64LaneName            = "v128.load64_lane"OpcodeVecV128Store8LaneName            = "v128.store8_lane"OpcodeVecV128Store16LaneName           = "v128.store16_lane"OpcodeVecV128Store32LaneName           = "v128.store32_lane"OpcodeVecV128Store64LaneName           = "v128.store64_lane"OpcodeVecV128ConstName                 = "v128.const"OpcodeVecV128i8x16ShuffleName          = "v128.shuffle"OpcodeVecI8x16ExtractLaneSName         = "i8x16.extract_lane_s"OpcodeVecI8x16ExtractLaneUName         = "i8x16.extract_lane_u"OpcodeVecI8x16ReplaceLaneName          = "i8x16.replace_lane"OpcodeVecI16x8ExtractLaneSName         = "i16x8.extract_lane_s"OpcodeVecI16x8ExtractLaneUName         = "i16x8.extract_lane_u"OpcodeVecI16x8ReplaceLaneName          = "i16x8.replace_lane"OpcodeVecI32x4ExtractLaneName          = "i32x4.extract_lane"OpcodeVecI32x4ReplaceLaneName          = "i32x4.replace_lane"OpcodeVecI64x2ExtractLaneName          = "i64x2.extract_lane"OpcodeVecI64x2ReplaceLaneName          = "i64x2.replace_lane"OpcodeVecF32x4ExtractLaneName          = "f32x4.extract_lane"OpcodeVecF32x4ReplaceLaneName          = "f32x4.replace_lane"OpcodeVecF64x2ExtractLaneName          = "f64x2.extract_lane"OpcodeVecF64x2ReplaceLaneName          = "f64x2.replace_lane"OpcodeVecI8x16SwizzleName              = "i8x16.swizzle"OpcodeVecI8x16SplatName                = "i8x16.splat"OpcodeVecI16x8SplatName                = "i16x8.splat"OpcodeVecI32x4SplatName                = "i32x4.splat"OpcodeVecI64x2SplatName                = "i64x2.splat"OpcodeVecF32x4SplatName                = "f32x4.splat"OpcodeVecF64x2SplatName                = "f64x2.splat"OpcodeVecI8x16EqName                   = "i8x16.eq"OpcodeVecI8x16NeName                   = "i8x16.ne"OpcodeVecI8x16LtSName                  = "i8x16.lt_s"OpcodeVecI8x16LtUName                  = "i8x16.lt_u"OpcodeVecI8x16GtSName                  = "i8x16.gt_s"OpcodeVecI8x16GtUName                  = "i8x16.gt_u"OpcodeVecI8x16LeSName                  = "i8x16.le_s"OpcodeVecI8x16LeUName                  = "i8x16.le_u"OpcodeVecI8x16GeSName                  = "i8x16.ge_s"OpcodeVecI8x16GeUName                  = "i8x16.ge_u"OpcodeVecI16x8EqName                   = "i16x8.eq"OpcodeVecI16x8NeName                   = "i16x8.ne"OpcodeVecI16x8LtSName                  = "i16x8.lt_s"OpcodeVecI16x8LtUName                  = "i16x8.lt_u"OpcodeVecI16x8GtSName                  = "i16x8.gt_s"OpcodeVecI16x8GtUName                  = "i16x8.gt_u"OpcodeVecI16x8LeSName                  = "i16x8.le_s"OpcodeVecI16x8LeUName                  = "i16x8.le_u"OpcodeVecI16x8GeSName                  = "i16x8.ge_s"OpcodeVecI16x8GeUName                  = "i16x8.ge_u"OpcodeVecI32x4EqName                   = "i32x4.eq"OpcodeVecI32x4NeName                   = "i32x4.ne"OpcodeVecI32x4LtSName                  = "i32x4.lt_s"OpcodeVecI32x4LtUName                  = "i32x4.lt_u"OpcodeVecI32x4GtSName                  = "i32x4.gt_s"OpcodeVecI32x4GtUName                  = "i32x4.gt_u"OpcodeVecI32x4LeSName                  = "i32x4.le_s"OpcodeVecI32x4LeUName                  = "i32x4.le_u"OpcodeVecI32x4GeSName                  = "i32x4.ge_s"OpcodeVecI32x4GeUName                  = "i32x4.ge_u"OpcodeVecI64x2EqName                   = "i64x2.eq"OpcodeVecI64x2NeName                   = "i64x2.ne"OpcodeVecI64x2LtSName                  = "i64x2.lt"OpcodeVecI64x2GtSName                  = "i64x2.gt"OpcodeVecI64x2LeSName                  = "i64x2.le"OpcodeVecI64x2GeSName                  = "i64x2.ge"OpcodeVecF32x4EqName                   = "f32x4.eq"OpcodeVecF32x4NeName                   = "f32x4.ne"OpcodeVecF32x4LtName                   = "f32x4.lt"OpcodeVecF32x4GtName                   = "f32x4.gt"OpcodeVecF32x4LeName                   = "f32x4.le"OpcodeVecF32x4GeName                   = "f32x4.ge"OpcodeVecF64x2EqName                   = "f64x2.eq"OpcodeVecF64x2NeName                   = "f64x2.ne"OpcodeVecF64x2LtName                   = "f64x2.lt"OpcodeVecF64x2GtName                   = "f64x2.gt"OpcodeVecF64x2LeName                   = "f64x2.le"OpcodeVecF64x2GeName                   = "f64x2.ge"OpcodeVecV128NotName                   = "v128.not"OpcodeVecV128AndName                   = "v128.and"OpcodeVecV128AndNotName                = "v128.andnot"OpcodeVecV128OrName                    = "v128.or"OpcodeVecV128XorName                   = "v128.xor"OpcodeVecV128BitselectName             = "v128.bitselect"OpcodeVecV128AnyTrueName               = "v128.any_true"OpcodeVecI8x16AbsName                  = "i8x16.abs"OpcodeVecI8x16NegName                  = "i8x16.neg"OpcodeVecI8x16PopcntName               = "i8x16.popcnt"OpcodeVecI8x16AllTrueName              = "i8x16.all_true"OpcodeVecI8x16BitMaskName              = "i8x16.bitmask"OpcodeVecI8x16NarrowI16x8SName         = "i8x16.narrow_i16x8_s"OpcodeVecI8x16NarrowI16x8UName         = "i8x16.narrow_i16x8_u"OpcodeVecI8x16ShlName                  = "i8x16.shl"OpcodeVecI8x16ShrSName                 = "i8x16.shr_s"OpcodeVecI8x16ShrUName                 = "i8x16.shr_u"OpcodeVecI8x16AddName                  = "i8x16.add"OpcodeVecI8x16AddSatSName              = "i8x16.add_sat_s"OpcodeVecI8x16AddSatUName              = "i8x16.add_sat_u"OpcodeVecI8x16SubName                  = "i8x16.sub"OpcodeVecI8x16SubSatSName              = "i8x16.sub_s"OpcodeVecI8x16SubSatUName              = "i8x16.sub_u"OpcodeVecI8x16MinSName                 = "i8x16.min_s"OpcodeVecI8x16MinUName                 = "i8x16.min_u"OpcodeVecI8x16MaxSName                 = "i8x16.max_s"OpcodeVecI8x16MaxUName                 = "i8x16.max_u"OpcodeVecI8x16AvgrUName                = "i8x16.avgr_u"OpcodeVecI16x8ExtaddPairwiseI8x16SName = "i16x8.extadd_pairwise_i8x16_s"OpcodeVecI16x8ExtaddPairwiseI8x16UName = "i16x8.extadd_pairwise_i8x16_u"OpcodeVecI16x8AbsName                  = "i16x8.abs"OpcodeVecI16x8NegName                  = "i16x8.neg"OpcodeVecI16x8Q15mulrSatSName          = "i16x8.q15mulr_sat_s"OpcodeVecI16x8AllTrueName              = "i16x8.all_true"OpcodeVecI16x8BitMaskName              = "i16x8.bitmask"OpcodeVecI16x8NarrowI32x4SName         = "i16x8.narrow_i32x4_s"OpcodeVecI16x8NarrowI32x4UName         = "i16x8.narrow_i32x4_u"OpcodeVecI16x8ExtendLowI8x16SName      = "i16x8.extend_low_i8x16_s"OpcodeVecI16x8ExtendHighI8x16SName     = "i16x8.extend_high_i8x16_s"OpcodeVecI16x8ExtendLowI8x16UName      = "i16x8.extend_low_i8x16_u"OpcodeVecI16x8ExtendHighI8x16UName     = "i16x8.extend_high_i8x16_u"OpcodeVecI16x8ShlName                  = "i16x8.shl"OpcodeVecI16x8ShrSName                 = "i16x8.shr_s"OpcodeVecI16x8ShrUName                 = "i16x8.shr_u"OpcodeVecI16x8AddName                  = "i16x8.add"OpcodeVecI16x8AddSatSName              = "i16x8.add_sat_s"OpcodeVecI16x8AddSatUName              = "i16x8.add_sat_u"OpcodeVecI16x8SubName                  = "i16x8.sub"OpcodeVecI16x8SubSatSName              = "i16x8.sub_sat_s"OpcodeVecI16x8SubSatUName              = "i16x8.sub_sat_u"OpcodeVecI16x8MulName                  = "i16x8.mul"OpcodeVecI16x8MinSName                 = "i16x8.min_s"OpcodeVecI16x8MinUName                 = "i16x8.min_u"OpcodeVecI16x8MaxSName                 = "i16x8.max_s"OpcodeVecI16x8MaxUName                 = "i16x8.max_u"OpcodeVecI16x8AvgrUName                = "i16x8.avgr_u"OpcodeVecI16x8ExtMulLowI8x16SName      = "i16x8.extmul_low_i8x16_s"OpcodeVecI16x8ExtMulHighI8x16SName     = "i16x8.extmul_high_i8x16_s"OpcodeVecI16x8ExtMulLowI8x16UName      = "i16x8.extmul_low_i8x16_u"OpcodeVecI16x8ExtMulHighI8x16UName     = "i16x8.extmul_high_i8x16_u"OpcodeVecI32x4ExtaddPairwiseI16x8SName = "i32x4.extadd_pairwise_i16x8_s"OpcodeVecI32x4ExtaddPairwiseI16x8UName = "i32x4.extadd_pairwise_i16x8_u"OpcodeVecI32x4AbsName                  = "i32x4.abs"OpcodeVecI32x4NegName                  = "i32x4.neg"OpcodeVecI32x4AllTrueName              = "i32x4.all_true"OpcodeVecI32x4BitMaskName              = "i32x4.bitmask"OpcodeVecI32x4ExtendLowI16x8SName      = "i32x4.extend_low_i16x8_s"OpcodeVecI32x4ExtendHighI16x8SName     = "i32x4.extend_high_i16x8_s"OpcodeVecI32x4ExtendLowI16x8UName      = "i32x4.extend_low_i16x8_u"OpcodeVecI32x4ExtendHighI16x8UName     = "i32x4.extend_high_i16x8_u"OpcodeVecI32x4ShlName                  = "i32x4.shl"OpcodeVecI32x4ShrSName                 = "i32x4.shr_s"OpcodeVecI32x4ShrUName                 = "i32x4.shr_u"OpcodeVecI32x4AddName                  = "i32x4.add"OpcodeVecI32x4SubName                  = "i32x4.sub"OpcodeVecI32x4MulName                  = "i32x4.mul"OpcodeVecI32x4MinSName                 = "i32x4.min_s"OpcodeVecI32x4MinUName                 = "i32x4.min_u"OpcodeVecI32x4MaxSName                 = "i32x4.max_s"OpcodeVecI32x4MaxUName                 = "i32x4.max_u"OpcodeVecI32x4DotI16x8SName            = "i32x4.dot_i16x8_s"OpcodeVecI32x4ExtMulLowI16x8SName      = "i32x4.extmul_low_i16x8_s"OpcodeVecI32x4ExtMulHighI16x8SName     = "i32x4.extmul_high_i16x8_s"OpcodeVecI32x4ExtMulLowI16x8UName      = "i32x4.extmul_low_i16x8_u"OpcodeVecI32x4ExtMulHighI16x8UName     = "i32x4.extmul_high_i16x8_u"OpcodeVecI64x2AbsName                  = "i64x2.abs"OpcodeVecI64x2NegName                  = "i64x2.neg"OpcodeVecI64x2AllTrueName              = "i64x2.all_true"OpcodeVecI64x2BitMaskName              = "i64x2.bitmask"OpcodeVecI64x2ExtendLowI32x4SName      = "i64x2.extend_low_i32x4_s"OpcodeVecI64x2ExtendHighI32x4SName     = "i64x2.extend_high_i32x4_s"OpcodeVecI64x2ExtendLowI32x4UName      = "i64x2.extend_low_i32x4_u"OpcodeVecI64x2ExtendHighI32x4UName     = "i64x2.extend_high_i32x4_u"OpcodeVecI64x2ShlName                  = "i64x2.shl"OpcodeVecI64x2ShrSName                 = "i64x2.shr_s"OpcodeVecI64x2ShrUName                 = "i64x2.shr_u"OpcodeVecI64x2AddName                  = "i64x2.add"OpcodeVecI64x2SubName                  = "i64x2.sub"OpcodeVecI64x2MulName                  = "i64x2.mul"OpcodeVecI64x2ExtMulLowI32x4SName      = "i64x2.extmul_low_i32x4_s"OpcodeVecI64x2ExtMulHighI32x4SName     = "i64x2.extmul_high_i32x4_s"OpcodeVecI64x2ExtMulLowI32x4UName      = "i64x2.extmul_low_i32x4_u"OpcodeVecI64x2ExtMulHighI32x4UName     = "i64x2.extmul_high_i32x4_u"OpcodeVecF32x4CeilName                 = "f32x4.ceil"OpcodeVecF32x4FloorName                = "f32x4.floor"OpcodeVecF32x4TruncName                = "f32x4.trunc"OpcodeVecF32x4NearestName              = "f32x4.nearest"OpcodeVecF32x4AbsName                  = "f32x4.abs"OpcodeVecF32x4NegName                  = "f32x4.neg"OpcodeVecF32x4SqrtName                 = "f32x4.sqrt"OpcodeVecF32x4AddName                  = "f32x4.add"OpcodeVecF32x4SubName                  = "f32x4.sub"OpcodeVecF32x4MulName                  = "f32x4.mul"OpcodeVecF32x4DivName                  = "f32x4.div"OpcodeVecF32x4MinName                  = "f32x4.min"OpcodeVecF32x4MaxName                  = "f32x4.max"OpcodeVecF32x4PminName                 = "f32x4.pmin"OpcodeVecF32x4PmaxName                 = "f32x4.pmax"OpcodeVecF64x2CeilName                 = "f64x2.ceil"OpcodeVecF64x2FloorName                = "f64x2.floor"OpcodeVecF64x2TruncName                = "f64x2.trunc"OpcodeVecF64x2NearestName              = "f64x2.nearest"OpcodeVecF64x2AbsName                  = "f64x2.abs"OpcodeVecF64x2NegName                  = "f64x2.neg"OpcodeVecF64x2SqrtName                 = "f64x2.sqrt"OpcodeVecF64x2AddName                  = "f64x2.add"OpcodeVecF64x2SubName                  = "f64x2.sub"OpcodeVecF64x2MulName                  = "f64x2.mul"OpcodeVecF64x2DivName                  = "f64x2.div"OpcodeVecF64x2MinName                  = "f64x2.min"OpcodeVecF64x2MaxName                  = "f64x2.max"OpcodeVecF64x2PminName                 = "f64x2.pmin"OpcodeVecF64x2PmaxName                 = "f64x2.pmax"OpcodeVecI32x4TruncSatF32x4SName       = "i32x4.trunc_sat_f32x4_s"OpcodeVecI32x4TruncSatF32x4UName       = "i32x4.trunc_sat_f32x4_u"OpcodeVecF32x4ConvertI32x4SName        = "f32x4.convert_i32x4_s"OpcodeVecF32x4ConvertI32x4UName        = "f32x4.convert_i32x4_u"OpcodeVecI32x4TruncSatF64x2SZeroName   = "i32x4.trunc_sat_f64x2_s_zero"OpcodeVecI32x4TruncSatF64x2UZeroName   = "i32x4.trunc_sat_f64x2_u_zero"OpcodeVecF64x2ConvertLowI32x4SName     = "f64x2.convert_low_i32x4_s"OpcodeVecF64x2ConvertLowI32x4UName     = "f64x2.convert_low_i32x4_u"OpcodeVecF32x4DemoteF64x2ZeroName      = "f32x4.demote_f64x2_zero"OpcodeVecF64x2PromoteLowF32x4ZeroName  = "f64x2.promote_low_f32x4")
View Source
const (OpcodeAtomicMemoryNotifyName = "memory.atomic.notify"OpcodeAtomicMemoryWait32Name = "memory.atomic.wait32"OpcodeAtomicMemoryWait64Name = "memory.atomic.wait64"OpcodeAtomicFenceName        = "atomic.fence"OpcodeAtomicI32LoadName    = "i32.atomic.load"OpcodeAtomicI64LoadName    = "i64.atomic.load"OpcodeAtomicI32Load8UName  = "i32.atomic.load8_u"OpcodeAtomicI32Load16UName = "i32.atomic.load16_u"OpcodeAtomicI64Load8UName  = "i64.atomic.load8_u"OpcodeAtomicI64Load16UName = "i64.atomic.load16_u"OpcodeAtomicI64Load32UName = "i64.atomic.load32_u"OpcodeAtomicI32StoreName   = "i32.atomic.store"OpcodeAtomicI64StoreName   = "i64.atomic.store"OpcodeAtomicI32Store8Name  = "i32.atomic.store8"OpcodeAtomicI32Store16Name = "i32.atomic.store16"OpcodeAtomicI64Store8Name  = "i64.atomic.store8"OpcodeAtomicI64Store16Name = "i64.atomic.store16"OpcodeAtomicI64Store32Name = "i64.atomic.store32"OpcodeAtomicI32RmwAddName    = "i32.atomic.rmw.add"OpcodeAtomicI64RmwAddName    = "i64.atomic.rmw.add"OpcodeAtomicI32Rmw8AddUName  = "i32.atomic.rmw8.add_u"OpcodeAtomicI32Rmw16AddUName = "i32.atomic.rmw16.add_u"OpcodeAtomicI64Rmw8AddUName  = "i64.atomic.rmw8.add_u"OpcodeAtomicI64Rmw16AddUName = "i64.atomic.rmw16.add_u"OpcodeAtomicI64Rmw32AddUName = "i64.atomic.rmw32.add_u"OpcodeAtomicI32RmwSubName    = "i32.atomic.rmw.sub"OpcodeAtomicI64RmwSubName    = "i64.atomic.rmw.sub"OpcodeAtomicI32Rmw8SubUName  = "i32.atomic.rmw8.sub_u"OpcodeAtomicI32Rmw16SubUName = "i32.atomic.rmw16.sub_u"OpcodeAtomicI64Rmw8SubUName  = "i64.atomic.rmw8.sub_u"OpcodeAtomicI64Rmw16SubUName = "i64.atomic.rmw16.sub_u"OpcodeAtomicI64Rmw32SubUName = "i64.atomic.rmw32.sub_u"OpcodeAtomicI32RmwAndName    = "i32.atomic.rmw.and"OpcodeAtomicI64RmwAndName    = "i64.atomic.rmw.and"OpcodeAtomicI32Rmw8AndUName  = "i32.atomic.rmw8.and_u"OpcodeAtomicI32Rmw16AndUName = "i32.atomic.rmw16.and_u"OpcodeAtomicI64Rmw8AndUName  = "i64.atomic.rmw8.and_u"OpcodeAtomicI64Rmw16AndUName = "i64.atomic.rmw16.and_u"OpcodeAtomicI64Rmw32AndUName = "i64.atomic.rmw32.and_u"OpcodeAtomicI32RmwOrName    = "i32.atomic.rmw.or"OpcodeAtomicI64RmwOrName    = "i64.atomic.rmw.or"OpcodeAtomicI32Rmw8OrUName  = "i32.atomic.rmw8.or_u"OpcodeAtomicI32Rmw16OrUName = "i32.atomic.rmw16.or_u"OpcodeAtomicI64Rmw8OrUName  = "i64.atomic.rmw8.or_u"OpcodeAtomicI64Rmw16OrUName = "i64.atomic.rmw16.or_u"OpcodeAtomicI64Rmw32OrUName = "i64.atomic.rmw32.or_u"OpcodeAtomicI32RmwXorName    = "i32.atomic.rmw.xor"OpcodeAtomicI64RmwXorName    = "i64.atomic.rmw.xor"OpcodeAtomicI32Rmw8XorUName  = "i32.atomic.rmw8.xor_u"OpcodeAtomicI32Rmw16XorUName = "i32.atomic.rmw16.xor_u"OpcodeAtomicI64Rmw8XorUName  = "i64.atomic.rmw8.xor_u"OpcodeAtomicI64Rmw16XorUName = "i64.atomic.rmw16.xor_u"OpcodeAtomicI64Rmw32XorUName = "i64.atomic.rmw32.xor_u"OpcodeAtomicI32RmwXchgName    = "i32.atomic.rmw.xchg"OpcodeAtomicI64RmwXchgName    = "i64.atomic.rmw.xchg"OpcodeAtomicI32Rmw8XchgUName  = "i32.atomic.rmw8.xchg_u"OpcodeAtomicI32Rmw16XchgUName = "i32.atomic.rmw16.xchg_u"OpcodeAtomicI64Rmw8XchgUName  = "i64.atomic.rmw8.xchg_u"OpcodeAtomicI64Rmw16XchgUName = "i64.atomic.rmw16.xchg_u"OpcodeAtomicI64Rmw32XchgUName = "i64.atomic.rmw32.xchg_u"OpcodeAtomicI32RmwCmpxchgName    = "i32.atomic.rmw.cmpxchg"OpcodeAtomicI64RmwCmpxchgName    = "i64.atomic.rmw.cmpxchg"OpcodeAtomicI32Rmw8CmpxchgUName  = "i32.atomic.rmw8.cmpxchg_u"OpcodeAtomicI32Rmw16CmpxchgUName = "i32.atomic.rmw16.cmpxchg_u"OpcodeAtomicI64Rmw8CmpxchgUName  = "i64.atomic.rmw8.cmpxchg_u"OpcodeAtomicI64Rmw16CmpxchgUName = "i64.atomic.rmw16.cmpxchg_u"OpcodeAtomicI64Rmw32CmpxchgUName = "i64.atomic.rmw32.cmpxchg_u")
View Source
const (OpcodeTailCallReturnCallName         = "return_call"OpcodeTailCallReturnCallIndirectName = "return_call_indirect")
View Source
const (// MemoryPageSize is the unit of memory length in WebAssembly,// and is defined as 2^16 = 65536.// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instances%E2%91%A0MemoryPageSize =uint32(65536)// MemoryLimitPages is maximum number of pages defined (2^16).// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#grow-memMemoryLimitPages =uint32(65536)// MemoryPageSizeInBits satisfies the relation: "1 << MemoryPageSizeInBits == MemoryPageSize".MemoryPageSizeInBits = 16)
View Source
const (MaximumGlobals       =uint32(1 << 27)MaximumFunctionIndex =uint32(1 << 27)MaximumTableIndex    =uint32(1 << 27))

The wazero specific limitation described at RATIONALE.md.TL;DR; We multiply by 8 (to get offsets in bytes) and the multiplication result must be less than 32bit max

View Source
const (ValueTypeI32 =api.ValueTypeI32ValueTypeI64 =api.ValueTypeI64ValueTypeF32 =api.ValueTypeF32ValueTypeF64 =api.ValueTypeF64// TODO: ValueTypeV128 is not exposed in the api pkg yet.ValueTypeV128ValueType = 0x7b// TODO: ValueTypeFuncref is not exposed in the api pkg yet.ValueTypeFuncrefValueType = 0x70ValueTypeExternref           =api.ValueTypeExternref)
View Source
const (ExternTypeFunc       =api.ExternTypeFuncExternTypeFuncName   =api.ExternTypeFuncNameExternTypeTable      =api.ExternTypeTableExternTypeTableName  =api.ExternTypeTableNameExternTypeMemory     =api.ExternTypeMemoryExternTypeMemoryName =api.ExternTypeMemoryNameExternTypeGlobal     =api.ExternTypeGlobalExternTypeGlobalName =api.ExternTypeGlobalName)
View Source
const (// RefTypeFuncref represents a reference to a function.RefTypeFuncref =ValueTypeFuncref// RefTypeExternref represents a reference to a host object, which is not currently supported in wazero.RefTypeExternref =ValueTypeExternref)

Variables

This section is empty.

Functions

funcAtomicInstructionNameadded inv1.7.0

func AtomicInstructionName(ocOpcodeAtomic) (retstring)

AtomicInstructionName returns the instruction name corresponding to the atomic Opcode.

funcExternTypeName

func ExternTypeName(tValueType)string

ExternTypeName is an alias of api.ExternTypeName defined to simplify imports.

funcInstructionName

func InstructionName(ocOpcode)string

InstructionName returns the instruction corresponding to this binary Opcode.Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#a7-index-of-instructions

funcMemoryPagesToBytesNum

func MemoryPagesToBytesNum(pagesuint32) (bytesNumuint64)

MemoryPagesToBytesNum converts the given pages into the number of bytes contained in these pages.

funcMiscInstructionName

func MiscInstructionName(ocOpcodeMisc)string

MiscInstructionName returns the instruction corresponding to this miscellaneous Opcode.

funcPagesToUnitOfBytes

func PagesToUnitOfBytes(pagesuint32)string

PagesToUnitOfBytes converts the pages to a human-readable form similar to what's specified. e.g. 1 -> "64Ki"

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instances%E2%91%A0

funcRefTypeName

func RefTypeName(tRefType) (retstring)

funcSectionIDName

func SectionIDName(sectionIDSectionID)string

SectionIDName returns the canonical name of a module section.https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#sections%E2%91%A0

funcSplitCallStackadded inv1.1.0

func SplitCallStack(ft *FunctionType, stack []uint64) (params []uint64, results []uint64, errerror)

SplitCallStack returns the input stack resliced to the count of params andresults, or errors if it isn't long enough for either.

funcTailCallInstructionNameadded inv1.10.0

func TailCallInstructionName(ocOpcodeTailCall) (retstring)

TailCallInstructionName returns the instruction name corresponding to the tail call Opcode.

funcValueTypeName

func ValueTypeName(tValueType)string

ValueTypeName is an alias of api.ValueTypeName defined to simplify imports.

funcVectorInstructionName

func VectorInstructionName(ocOpcodeVec) (retstring)

VectorInstructionName returns the instruction name corresponding to the vector Opcode.

Types

typeCode

type Code struct {// LocalTypes are any function-scoped variables in insertion order.// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-localLocalTypes []ValueType// Body is a sequence of expressions ending in OpcodeEnd// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-exprBody []byte// GoFunc is non-nil when IsHostFunction and defined in go, either// api.GoFunction or api.GoModuleFunction. When present, LocalTypes and Body must// be nil.//// Note: This has no serialization format, so is not encodable.// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#host-functions%E2%91%A2GoFunc interface{}// BodyOffsetInCodeSection is the offset of the beginning of the body in the code section.// This is used for DWARF based stack trace where a program counter represents an offset in code section.BodyOffsetInCodeSectionuint64}

Code is an entry in the Module.CodeSection containing the locals and body of the function.Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-code

funcMustParseGoReflectFuncCode

func MustParseGoReflectFuncCode(fn interface{})Code

MustParseGoReflectFuncCode parses Code from the go function or panics.

Exposing this simplifies FunctionDefinition of host functions in built-in hostmodules and tests.

typeConstantExpression

type ConstantExpression struct {OpcodeOpcodeData   []byte}

typeCustomSection

type CustomSection struct {NamestringData []byte}

CustomSection contains the name and raw data of a custom section.

typeDataInstance

type DataInstance = []byte

DataInstance holds bytes corresponding to the data segment in a module.

https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/runtime.html#data-instances

typeDataSegment

type DataSegment struct {OffsetExpressionConstantExpressionInit             []bytePassivebool}

func (*DataSegment)IsPassive

func (d *DataSegment) IsPassive()bool

IsPassive returns true if this data segment is "passive" in the sense that memory offset andindex is determined at runtime and used by OpcodeMemoryInitName instruction in the bulk memoryoperations proposal.

Seehttps://www.w3.org/TR/2022/WD-wasm-core-2-20220419/appendix/changes.html#bulk-memory-and-table-instructions

typeElementInstance

type ElementInstance = []Reference

ElementInstance represents an element instance in a module.

Seehttps://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/runtime.html#element-instances

typeElementMode

type ElementMode =byte

ElementMode represents a mode of element segment which is either active, passive or declarative.

https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/syntax/modules.html#element-segments

const (// ElementModeActive is the mode which requires the runtime to initialize table with the contents in .Init field combined with OffsetExpr.ElementModeActiveElementMode =iota// ElementModePassive is the mode which doesn't require the runtime to initialize table, and only used with OpcodeTableInitName.ElementModePassive// ElementModeDeclarative is introduced in reference-types proposal which can be used to declare function indexes used by OpcodeRefFunc.ElementModeDeclarative)

typeElementSegment

type ElementSegment struct {// OffsetExpr returns the table element offset to apply to Init indices.// Note: This can be validated prior to instantiation unless it includes OpcodeGlobalGet (an imported global).OffsetExprConstantExpression// TableIndex is the table's index to which this element segment is applied.// Note: This is used if and only if the Mode is active.TableIndexIndex// Init indices are (nullable) table elements where each index is the function index by which the module initialize the table.Init []Index// Type holds the type of this element segment, which is the RefType in WebAssembly 2.0.TypeRefType// Mode is the mode of this element segment.ModeElementMode}

ElementSegment are initialization instructions for a TableInstance

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#syntax-elem

func (*ElementSegment)IsActive

func (e *ElementSegment) IsActive()bool

IsActive returns true if the element segment is "active" mode which requires the runtime to initialize tablewith the contents in .Init field.

typeEngine

type Engine interface {// Close closes this engine, and releases all the compiled cache.Close() (errerror)// CompileModule implements the same method as documented on wasm.Engine.CompileModule(ctxcontext.Context, module *Module, listeners []experimental.FunctionListener, ensureTerminationbool)error// CompiledModuleCount is exported for testing, to track the size of the compilation cache.CompiledModuleCount()uint32// DeleteCompiledModule releases compilation caches for the given module (source).// Note: it is safe to call this function for a module from which module instances are instantiated even when these// module instances have outstanding calls.DeleteCompiledModule(module *Module)// NewModuleEngine compiles down the function instances in a module, and returns ModuleEngine for the module.//// * module is the source module from which moduleFunctions are instantiated. This is used for caching.// * instance is the *ModuleInstance which is created from `module`.//// Note: Input parameters must be pre-validated with wasm.Module Validate, to ensure no fields are invalid// due to reasons such as out-of-bounds.NewModuleEngine(module *Module, instance *ModuleInstance) (ModuleEngine,error)}

Engine is a Store-scoped mechanism to compile functions declared or imported by a module.This is a top-level type implemented by an interpreter or compiler.

typeExport

type Export struct {TypeExternType// Name is what the host refers to this definition as.Namestring// Index is the index of the definition to export, the index is by Type// e.g. If ExternTypeFunc, this is a position in the function index.IndexIndex}

Export is the binary representation of an export indicated by TypeSeehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-export

typeExternType

type ExternType =api.ExternType

ExternType is an alias of api.ExternType defined to simplify imports.

typeFunctionDefinition

type FunctionDefinition struct {internalapi.WazeroOnlyType// Debugname is exported for testing purpose.Debugnamestring// Functype is exported for testing purpose.Functype *FunctionType// contains filtered or unexported fields}

FunctionDefinition implements api.FunctionDefinition

func (*FunctionDefinition)DebugName

func (f *FunctionDefinition) DebugName()string

DebugName implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)ExportNames

func (f *FunctionDefinition) ExportNames() []string

ExportNames implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)GoFunction

func (f *FunctionDefinition) GoFunction() interface{}

GoFunction implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)Import

func (f *FunctionDefinition) Import() (moduleName, namestring, isImportbool)

Import implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)Index

func (f *FunctionDefinition) Index()uint32

Index implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)ModuleName

func (f *FunctionDefinition) ModuleName()string

ModuleName implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)Name

func (f *FunctionDefinition) Name()string

Name implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)ParamNames

func (f *FunctionDefinition) ParamNames() []string

ParamNames implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)ParamTypes

func (f *FunctionDefinition) ParamTypes() []ValueType

ParamTypes implements api.FunctionDefinition ParamTypes.

func (*FunctionDefinition)ResultNames

func (f *FunctionDefinition) ResultNames() []string

ResultNames implements the same method as documented on api.FunctionDefinition.

func (*FunctionDefinition)ResultTypes

func (f *FunctionDefinition) ResultTypes() []ValueType

ResultTypes implements api.FunctionDefinition ResultTypes.

typeFunctionType

type FunctionType struct {// Params are the possibly empty sequence of value types accepted by a function with this signature.Params []ValueType// Results are the possibly empty sequence of value types returned by a function with this signature.//// Note: In WebAssembly 1.0 (20191205), there can be at most one result.// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#result-types%E2%91%A0Results []ValueType// ParamNumInUint64 is the number of uint64 values requires to represent the Wasm param type.ParamNumInUint64int// ResultsNumInUint64 is the number of uint64 values requires to represent the Wasm result type.ResultNumInUint64int// contains filtered or unexported fields}

FunctionType is a possibly empty function signature.

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#function-types%E2%91%A0

funcDecodeBlockType

func DecodeBlockType(types []FunctionType, r *bytes.Reader, enabledFeaturesapi.CoreFeatures) (*FunctionType,uint64,error)

DecodeBlockType decodes the type index from a positive 33-bit signed integer. Negative numbers indicate up to oneWebAssembly 1.0 (20191205) compatible result type. Positive numbers are decoded when `enabledFeatures` includeCoreFeatureMultiValue and include an index in the Module.TypeSection.

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-blocktypeSeehttps://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/multi-value/Overview.md

func (*FunctionType)CacheNumInUint64

func (f *FunctionType) CacheNumInUint64()

func (*FunctionType)EqualsSignature

func (f *FunctionType) EqualsSignature(params []ValueType, results []ValueType)bool

EqualsSignature returns true if the function type has the same parameters and results.

func (*FunctionType)String

func (f *FunctionType) String()string

String implements fmt.Stringer.

typeFunctionTypeID

type FunctionTypeIDuint32

FunctionTypeID is a uniquely assigned integer for a function type.This is wazero specific runtime object and specific to a store,and used at runtime to do type-checks on indirect function calls.

typeGlobal

type Global struct {TypeGlobalTypeInitConstantExpression}

typeGlobalInstance

type GlobalInstance struct {TypeGlobalType// Val holds a 64-bit representation of the actual value.// If me is non-nil, the value will not be updated and the current value is stored in the module engine.Valuint64// ValHi is only used for vector type globals, and holds the higher bits of the vector.// If me is non-nil, the value will not be updated and the current value is stored in the module engine.ValHiuint64// Me is the module engine that owns this global instance.// The .Val and .ValHi fields are only valid when me is nil.// If me is non-nil, the value is stored in the module engine.MeModuleEngineIndexIndex}

GlobalInstance represents a global instance in a store.Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#global-instances%E2%91%A0

func (*GlobalInstance)SetValueadded inv1.7.0

func (g *GlobalInstance) SetValue(lo, hiuint64)

func (*GlobalInstance)Stringadded inv1.1.0

func (g *GlobalInstance) String()string

String implements api.Global.

func (*GlobalInstance)Valueadded inv1.6.0

func (g *GlobalInstance) Value() (uint64,uint64)

typeGlobalType

type GlobalType struct {ValTypeValueTypeMutablebool}

typeHostFunc

type HostFunc struct {// ExportName is the only value returned by api.FunctionDefinition.ExportNamestring// Name is equivalent to the same method on api.FunctionDefinition.Namestring// ParamTypes is equivalent to the same method on api.FunctionDefinition.ParamTypes []ValueType// ParamNames is equivalent to the same method on api.FunctionDefinition.ParamNames []string// ResultTypes is equivalent to the same method on api.FunctionDefinition.ResultTypes []ValueType// ResultNames is equivalent to the same method on api.FunctionDefinition.ResultNames []string// Code is the equivalent function in the SectionIDCode.CodeCode}

HostFunc is a function with an inlined type, used for NewHostModule.Any corresponding FunctionType will be reused or added to the Module.

func (*HostFunc)WithGoModuleFunc

func (f *HostFunc) WithGoModuleFunc(fnapi.GoModuleFunc) *HostFunc

WithGoModuleFunc returns a copy of the function, replacing its Code.GoFunc.

typeHostFuncExporter

type HostFuncExporter interface {ExportHostFunc(*HostFunc)}

typeImport

type Import struct {TypeExternType// Module is the possibly empty primary namespace of this importModulestring// Module is the possibly empty secondary namespace of this importNamestring// DescFunc is the index in Module.TypeSection when Type equals ExternTypeFuncDescFuncIndex// DescTable is the inlined Table when Type equals ExternTypeTableDescTableTable// DescMem is the inlined Memory when Type equals ExternTypeMemoryDescMem *Memory// DescGlobal is the inlined GlobalType when Type equals ExternTypeGlobalDescGlobalGlobalType// IndexPerType has the index of this import per ExternType.IndexPerTypeIndex}

Import is the binary representation of an import indicated by TypeSeehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-import

typeIndex

type Index =uint32

Index is the offset in an index, not necessarily an absolute position in a Module section. This is becauseindexs are often preceded by a corresponding type in the Module.ImportSection.

For example, the function index starts with any ExternTypeFunc in the Module.ImportSection followed bythe Module.FunctionSection

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-index

const (// ElementInitNullReference represents the null reference in ElementSegment's Init.// In Wasm spec, an init item represents either Function's Index or null reference,// and in wazero, we limit the maximum number of functions available in a module to// MaximumFunctionIndex. Therefore, it is safe to use 1 << 31 to represent the null// reference in Element segments.ElementInitNullReferenceIndex = 1 << 31)

funcWrapGlobalIndexAsElementInitadded inv1.7.0

func WrapGlobalIndexAsElementInit(initIndex)Index

WrapGlobalIndexAsElementInit wraps the given index as an init item which is resolved via an imported global value.See the comments on elementInitImportedGlobalReferenceType for more details.

typeIndirectNameMap

type IndirectNameMap []NameMapAssoc

IndirectNameMap associates an index with an association of names.

Note: IndirectNameMap is unique by NameMapAssoc.Index, but NameMapAssoc.NameMap needn't be unique.Note: When encoding in the Binary format, this must be ordered by NameMapAssoc.Indexhttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-indirectnamemap

typeMemory

type Memory struct {Min, Cap, Maxuint32// IsMaxEncoded true if the Max is encoded in the original binary.IsMaxEncodedbool// IsShared true if the memory is shared for access from multiple agents.IsSharedbool}

Memory describes the limits of pages (64KB) in a memory.

func (*Memory)Validate

func (m *Memory) Validate(memoryLimitPagesuint32)error

Validate ensures values assigned to Min, Cap and Max are within valid thresholds.

typeMemoryDefinition

type MemoryDefinition struct {internalapi.WazeroOnlyType// contains filtered or unexported fields}

MemoryDefinition implements api.MemoryDefinition

func (*MemoryDefinition)ExportNames

func (f *MemoryDefinition) ExportNames() []string

ExportNames implements the same method as documented on api.MemoryDefinition.

func (*MemoryDefinition)Import

func (f *MemoryDefinition) Import() (moduleName, namestring, isImportbool)

Import implements the same method as documented on api.MemoryDefinition.

func (*MemoryDefinition)Index

func (f *MemoryDefinition) Index()uint32

Index implements the same method as documented on api.MemoryDefinition.

func (*MemoryDefinition)Max

func (f *MemoryDefinition) Max() (maxuint32, encodedbool)

Max implements the same method as documented on api.MemoryDefinition.

func (*MemoryDefinition)Min

func (f *MemoryDefinition) Min()uint32

Min implements the same method as documented on api.MemoryDefinition.

func (*MemoryDefinition)ModuleName

func (f *MemoryDefinition) ModuleName()string

ModuleName implements the same method as documented on api.MemoryDefinition.

typeMemoryInstance

type MemoryInstance struct {internalapi.WazeroOnlyTypeBuffer        []byteMin, Cap, Maxuint32Sharedbool// Mux is used in interpreter mode to prevent overlapping calls to atomic instructions,// introduced with WebAssembly threads proposal, and in compiler mode to make memory modifications// within Grow non-racy for the Go race detector.Muxsync.Mutex// contains filtered or unexported fields}

MemoryInstance represents a memory instance in a store, and implements api.Memory.

Note: In WebAssembly 1.0 (20191205), there may be up to one Memory per store, which means the precise memory is alwayswasm.Store Memories index zero: `store.Memories[0]`Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instances%E2%91%A0.

funcNewMemoryInstance

func NewMemoryInstance(memSec *Memory, allocatorexperimental.MemoryAllocator, moduleEngineModuleEngine) *MemoryInstance

NewMemoryInstance creates a new instance based on the parameters in the SectionIDMemory.

func (*MemoryInstance)Definition

func (m *MemoryInstance) Definition()api.MemoryDefinition

Definition implements the same method as documented on api.Memory.

func (*MemoryInstance)Grow

func (m *MemoryInstance) Grow(deltauint32) (resultuint32, okbool)

Grow implements the same method as documented on api.Memory.

func (*MemoryInstance)Notifyadded inv1.7.0

func (m *MemoryInstance) Notify(offsetuint32, countuint32)uint32

Notify wakes up at most count waiters at the given offset.

func (*MemoryInstance)Pagesadded inv1.7.1

func (m *MemoryInstance) Pages() (resultuint32)

Pages implements the same method as documented on api.Memory.

func (*MemoryInstance)Read

func (m *MemoryInstance) Read(offset, byteCountuint32) ([]byte,bool)

Read implements the same method as documented on api.Memory.

func (*MemoryInstance)ReadByte

func (m *MemoryInstance) ReadByte(offsetuint32) (byte,bool)

ReadByte implements the same method as documented on api.Memory.

func (*MemoryInstance)ReadFloat32Le

func (m *MemoryInstance) ReadFloat32Le(offsetuint32) (float32,bool)

ReadFloat32Le implements the same method as documented on api.Memory.

func (*MemoryInstance)ReadFloat64Le

func (m *MemoryInstance) ReadFloat64Le(offsetuint32) (float64,bool)

ReadFloat64Le implements the same method as documented on api.Memory.

func (*MemoryInstance)ReadUint16Le

func (m *MemoryInstance) ReadUint16Le(offsetuint32) (uint16,bool)

ReadUint16Le implements the same method as documented on api.Memory.

func (*MemoryInstance)ReadUint32Le

func (m *MemoryInstance) ReadUint32Le(offsetuint32) (uint32,bool)

ReadUint32Le implements the same method as documented on api.Memory.

func (*MemoryInstance)ReadUint64Le

func (m *MemoryInstance) ReadUint64Le(offsetuint32) (uint64,bool)

ReadUint64Le implements the same method as documented on api.Memory.

func (*MemoryInstance)Size

func (m *MemoryInstance) Size()uint32

Size implements the same method as documented on api.Memory.

func (*MemoryInstance)Wait32added inv1.7.0

func (m *MemoryInstance) Wait32(offsetuint32, expuint32, timeoutint64, reader func(mem *MemoryInstance, offsetuint32)uint32)uint64

Wait32 suspends the caller until the offset is notified by a different agent.

func (*MemoryInstance)Wait64added inv1.7.0

func (m *MemoryInstance) Wait64(offsetuint32, expuint64, timeoutint64, reader func(mem *MemoryInstance, offsetuint32)uint64)uint64

Wait64 suspends the caller until the offset is notified by a different agent.

func (*MemoryInstance)Write

func (m *MemoryInstance) Write(offsetuint32, val []byte)bool

Write implements the same method as documented on api.Memory.

func (*MemoryInstance)WriteByte

func (m *MemoryInstance) WriteByte(offsetuint32, vbyte)bool

WriteByte implements the same method as documented on api.Memory.

func (*MemoryInstance)WriteFloat32Le

func (m *MemoryInstance) WriteFloat32Le(offsetuint32, vfloat32)bool

WriteFloat32Le implements the same method as documented on api.Memory.

func (*MemoryInstance)WriteFloat64Le

func (m *MemoryInstance) WriteFloat64Le(offsetuint32, vfloat64)bool

WriteFloat64Le implements the same method as documented on api.Memory.

func (*MemoryInstance)WriteString

func (m *MemoryInstance) WriteString(offsetuint32, valstring)bool

WriteString implements the same method as documented on api.Memory.

func (*MemoryInstance)WriteUint16Le

func (m *MemoryInstance) WriteUint16Le(offsetuint32, vuint16)bool

WriteUint16Le implements the same method as documented on api.Memory.

func (*MemoryInstance)WriteUint32Le

func (m *MemoryInstance) WriteUint32Le(offset, vuint32)bool

WriteUint32Le implements the same method as documented on api.Memory.

func (*MemoryInstance)WriteUint64Le

func (m *MemoryInstance) WriteUint64Le(offsetuint32, vuint64)bool

WriteUint64Le implements the same method as documented on api.Memory.

typeModule

type Module struct {// TypeSection contains the unique FunctionType of functions imported or defined in this module.//// Note: Currently, there is no type ambiguity in the index as WebAssembly 1.0 only defines function type.// In the future, other types may be introduced to support CoreFeatures such as module linking.//// Note: In the Binary Format, this is SectionIDType.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#types%E2%91%A0%E2%91%A0TypeSection []FunctionType// ImportSection contains imported functions, tables, memories or globals required for instantiation// (Store.Instantiate).//// Note: there are no unique constraints relating to the two-level namespace of Import.Module and Import.Name.//// Note: In the Binary Format, this is SectionIDImport.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#import-section%E2%91%A0ImportSection []Import// ImportFunctionCount ImportGlobalCount ImportMemoryCount, and ImportTableCount are// the cached import count per ExternType set during decoding.ImportFunctionCount,ImportGlobalCount,ImportMemoryCount,ImportTableCountIndex// ImportPerModule maps a module name to the list of Import to be imported from the module.// This is used to do fast import resolution during instantiation.ImportPerModule map[string][]*Import// FunctionSection contains the index in TypeSection of each function defined in this module.//// Note: The function Index space begins with imported functions and ends with those defined in this module.// For example, if there are two imported functions and one defined in this module, the function Index 3 is defined// in this module at FunctionSection[0].//// Note: FunctionSection is index correlated with the CodeSection. If given the same position, e.g. 2, a function// type is at TypeSection[FunctionSection[2]], while its locals and body are at CodeSection[2].//// Note: In the Binary Format, this is SectionIDFunction.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#function-section%E2%91%A0FunctionSection []Index// TableSection contains each table defined in this module.//// Note: The table Index space begins with imported tables and ends with those defined in this module.// For example, if there are two imported tables and one defined in this module, the table Index 3 is defined in// this module at TableSection[0].//// Note: Version 1.0 (20191205) of the WebAssembly spec allows at most one table definition per module, so the// length of the TableSection can be zero or one, and can only be one if there is no imported table.//// Note: In the Binary Format, this is SectionIDTable.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#table-section%E2%91%A0TableSection []Table// MemorySection contains each memory defined in this module.//// Note: The memory Index space begins with imported memories and ends with those defined in this module.// For example, if there are two imported memories and one defined in this module, the memory Index 3 is defined in// this module at TableSection[0].//// Note: Version 1.0 (20191205) of the WebAssembly spec allows at most one memory definition per module, so the// length of the MemorySection can be zero or one, and can only be one if there is no imported memory.//// Note: In the Binary Format, this is SectionIDMemory.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-section%E2%91%A0MemorySection *Memory// GlobalSection contains each global defined in this module.//// Global indexes are offset by any imported globals because the global index begins with imports, followed by// ones defined in this module. For example, if there are two imported globals and three defined in this module, the// global at index 3 is defined in this module at GlobalSection[0].//// Note: In the Binary Format, this is SectionIDGlobal.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#global-section%E2%91%A0GlobalSection []Global// ExportSection contains each export defined in this module.//// Note: In the Binary Format, this is SectionIDExport.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#exports%E2%91%A0ExportSection []Export// Exports maps a name to Export, and is convenient for fast look up of exported instances at runtime.// Each item of this map points to an element of ExportSection.Exports map[string]*Export// StartSection is the index of a function to call before returning from Store.Instantiate.//// Note: The index here is not the position in the FunctionSection, rather in the function index, which// begins with imported functions.//// Note: In the Binary Format, this is SectionIDStart.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#start-section%E2%91%A0StartSection *Index// Note: In the Binary Format, this is SectionIDElement.ElementSection []ElementSegment// CodeSection is index-correlated with FunctionSection and contains each// function's locals and body.//// When present, the HostFunctionSection of the same index must be nil.//// Note: In the Binary Format, this is SectionIDCode.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#code-section%E2%91%A0CodeSection []Code// Note: In the Binary Format, this is SectionIDData.DataSection []DataSegment// NameSection is set when the SectionIDCustom "name" was successfully decoded from the binary format.//// Note: This is the only SectionIDCustom defined in the WebAssembly 1.0 (20191205) Binary Format.// Others are skipped as they are not used in wazero.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#name-section%E2%91%A0// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#custom-section%E2%91%A0NameSection *NameSection// CustomSections are set when the SectionIDCustom other than "name" were successfully decoded from the binary format.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#custom-section%E2%91%A0CustomSections []*CustomSection// DataCountSection is the optional section and holds the number of data segments in the data section.//// Note: This may exist in WebAssembly 2.0 or WebAssembly 1.0 with CoreFeatureBulkMemoryOperations.// Seehttps://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#data-count-section// Seehttps://www.w3.org/TR/2022/WD-wasm-core-2-20220419/appendix/changes.html#bulk-memory-and-table-instructionsDataCountSection *uint32// ID is the sha256 value of the source wasm plus the configurations which affect the runtime representation of// Wasm binary. This is only used for caching.IDModuleID// IsHostModule true if this is the host module, false otherwise.IsHostModulebool// FunctionDefinitionSection is a wazero-specific section.FunctionDefinitionSection []FunctionDefinition// MemoryDefinitionSection is a wazero-specific section.MemoryDefinitionSection []MemoryDefinition// DWARFLines is used to emit DWARF based stack trace. This is created from the multiple custom sections// as described inhttps://yurydelendik.github.io/webassembly-dwarf/, though it is not specified in the Wasm// specification:https://github.com/WebAssembly/debugging/issues/1DWARFLines *wasmdebug.DWARFLines// contains filtered or unexported fields}

Module is a WebAssembly binary representation.Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#modules%E2%91%A8

Differences from the specification:* NameSection is the only key ("name") decoded from the SectionIDCustom.* ExportSection is represented as a map for lookup convenience.* Code.GoFunc is contains any go `func`. It may be present when Code.Body is not.

funcNewHostModule

func NewHostModule(moduleNamestring,exportNames []string,nameToHostFunc map[string]*HostFunc,enabledFeaturesapi.CoreFeatures,) (m *Module, errerror)

NewHostModule is defined internally for use in WASI tests and to keep the code size in the root directory small.

func (*Module)AllDeclarations

func (m *Module) AllDeclarations() (functions []Index, globals []GlobalType, memory *Memory, tables []Table, errerror)

AllDeclarations returns all declarations for functions, globals, memories and tables in a module including imported ones.

func (*Module)AssignModuleID

func (m *Module) AssignModuleID(wasm []byte, listeners []experimental.FunctionListener, withEnsureTerminationbool)

AssignModuleID calculates a sha256 checksum on `wasm` and other args, and set Module.ID to the result.See the doc on Module.ID on what it's used for.

func (*Module)BuildMemoryDefinitions

func (m *Module) BuildMemoryDefinitions()

BuildMemoryDefinitions generates memory metadata that can be parsed fromthe module. This must be called after all validation.

Note: This is exported for wazero.Runtime `CompileModule`.

func (*Module)ExportedFunctions

func (m *Module) ExportedFunctions() map[string]api.FunctionDefinition

ExportedFunctions returns the definitions of each exported function.

func (*Module)ExportedMemories

func (m *Module) ExportedMemories() map[string]api.MemoryDefinition

ExportedMemories implements the same method as documented on wazero.CompiledModule.

func (*Module)FunctionDefinitionadded inv1.2.0

func (m *Module) FunctionDefinition(indexIndex) *FunctionDefinition

FunctionDefinition returns the FunctionDefinition for the given `index`.

func (*Module)ImportedFunctions

func (m *Module) ImportedFunctions() (ret []api.FunctionDefinition)

ImportedFunctions returns the definitions of each imported function.

Note: Unlike ExportedFunctions, there is no unique constraint on imports.

func (*Module)ImportedMemories

func (m *Module) ImportedMemories() (ret []api.MemoryDefinition)

ImportedMemories implements the same method as documented on wazero.CompiledModule.

func (*Module)SectionElementCount

func (m *Module) SectionElementCount(sectionIDSectionID)uint32

SectionElementCount returns the count of elements in a given section ID

For example...* SectionIDType returns the count of FunctionType* SectionIDCustom returns the count of CustomSections plus one if NameSection is present* SectionIDHostFunction returns the count of HostFunctionSection* SectionIDExport returns the count of unique export names

func (*Module)Validate

func (m *Module) Validate(enabledFeaturesapi.CoreFeatures)error

typeModuleEngine

type ModuleEngine interface {// DoneInstantiation is called at the end of the instantiation of the module.DoneInstantiation()// NewFunction returns an api.Function for the given function pointed by the given Index.NewFunction(indexIndex)api.Function// ResolveImportedFunction is used to add imported functions needed to make this ModuleEngine fully functional.// - `index` is the function Index of this imported function.// - `descFunc` is the type Index in Module.TypeSection of this imported function. It corresponds to Import.DescFunc.// - `indexInImportedModule` is the function Index of the imported function in the imported module.//- `importedModuleEngine` is the ModuleEngine for the imported ModuleInstance.ResolveImportedFunction(index, descFunc, indexInImportedModuleIndex, importedModuleEngineModuleEngine)// ResolveImportedMemory is called when this module imports a memory from another module.ResolveImportedMemory(importedModuleEngineModuleEngine)// LookupFunction returns the FunctionModule and the Index of the function in the returned ModuleInstance at the given offset in the table.LookupFunction(t *TableInstance, typeIdFunctionTypeID, tableOffsetIndex) (*ModuleInstance,Index)// GetGlobalValue returns the value of the global variable at the given Index.// Only called when OwnsGlobals() returns true, and must not be called for imported globalsGetGlobalValue(idxIndex) (lo, hiuint64)// SetGlobalValue sets the value of the global variable at the given Index.// Only called when OwnsGlobals() returns true, and must not be called for imported globalsSetGlobalValue(idxIndex, lo, hiuint64)// OwnsGlobals returns true if this ModuleEngine owns the global variables. If true, wasm.GlobalInstance's Val,ValHi should// not be accessed directly.OwnsGlobals()bool// FunctionInstanceReference returns Reference for the given Index for a FunctionInstance. The returned values are used by// the initialization via ElementSegment.FunctionInstanceReference(funcIndexIndex)Reference// MemoryGrown notifies the engine that the memory has grown.MemoryGrown()}

ModuleEngine implements function calls for a given module.

typeModuleID

type ModuleID = [sha256.Size]byte

ModuleID represents sha256 hash value uniquely assigned to Module.

typeModuleInstance

type ModuleInstance struct {internalapi.WazeroOnlyTypeModuleNamestringExports        map[string]*ExportGlobals        []*GlobalInstanceMemoryInstance *MemoryInstanceTables         []*TableInstance// Engine implements function calls for this module.EngineModuleEngine// TypeIDs is index-correlated with types and holds typeIDs which is uniquely assigned to a type by store.// This is necessary to achieve fast runtime type checking for indirect function calls at runtime.TypeIDs []FunctionTypeID// DataInstances holds data segments bytes of the module.// This is only used by bulk memory operations.////https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/runtime.html#data-instancesDataInstances []DataInstance// ElementInstances holds the element instance, and each holds the references to either functions// or external objects (unimplemented).ElementInstances []ElementInstance// Sys is exposed for use in special imports such as WASI, assemblyscript.//// # Notes////   - This is a part of ModuleInstance so that scope and Close is coherent.//   - This is not exposed outside this repository (as a host function//  parameter) because we haven't thought through capabilities based//  security implications.Sys *internalsys.Context// Closed is used both to guard moduleEngine.CloseWithExitCode and to store the exit code.//// The update value is closedType + exitCode << 32. This ensures an exit code of zero isn't mistaken for never closed.//// Note: Exclusively reading and updating this with atomics guarantees cross-goroutine observations.// See /RATIONALE.mdClosedatomic.Uint64// CodeCloser is non-nil when the code should be closed after this module.CodeCloserapi.Closer// Source is a pointer to the Module from which this ModuleInstance derives.Source *Module// CloseNotifier is an experimental hook called once on close.CloseNotifierexperimental.CloseNotifier// contains filtered or unexported fields}

ModuleInstance represents instantiated wasm module.The difference from the spec is that in wazero, a ModuleInstance holds pointersto the instances, rather than "addresses" (i.e. index to Store.Functions, Globals, etc) for convenience.

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#syntax-moduleinst

This implements api.Module.

func (*ModuleInstance)Closeadded inv1.0.1

func (m *ModuleInstance) Close(ctxcontext.Context) (errerror)

Close implements the same method as documented on api.Module.

func (*ModuleInstance)CloseModuleOnCanceledOrTimeoutadded inv1.0.1

func (m *ModuleInstance) CloseModuleOnCanceledOrTimeout(ctxcontext.Context)context.CancelFunc

CloseModuleOnCanceledOrTimeout take a context `ctx`, which might be a Cancel or Timeout context,and spawns the Goroutine to check the context is canceled ot deadline exceeded. If it reachesone of the conditions, it sets the appropriate exit code.

Callers of this function must invoke the returned context.CancelFunc to release the spawned Goroutine.

func (*ModuleInstance)CloseWithCtxErradded inv1.0.1

func (m *ModuleInstance) CloseWithCtxErr(ctxcontext.Context)

CloseWithCtxErr closes the module with an exit code based on the type oferror reported by the context.

If the context's error is unknown or nil, the module does not close.

func (*ModuleInstance)CloseWithExitCodeadded inv1.0.1

func (m *ModuleInstance) CloseWithExitCode(ctxcontext.Context, exitCodeuint32) (errerror)

CloseWithExitCode implements the same method as documented on api.Module.

func (*ModuleInstance)ExportedFunctionadded inv1.0.1

func (m *ModuleInstance) ExportedFunction(namestring)api.Function

ExportedFunction implements the same method as documented on api.Module.

func (*ModuleInstance)ExportedFunctionDefinitionsadded inv1.0.1

func (m *ModuleInstance) ExportedFunctionDefinitions() map[string]api.FunctionDefinition

ExportedFunctionDefinitions implements the same method as documented onapi.Module.

func (*ModuleInstance)ExportedGlobaladded inv1.0.1

func (m *ModuleInstance) ExportedGlobal(namestring)api.Global

ExportedGlobal implements the same method as documented on api.Module.

func (*ModuleInstance)ExportedMemoryadded inv1.0.1

func (m *ModuleInstance) ExportedMemory(namestring)api.Memory

ExportedMemory implements the same method as documented on api.Module.

func (*ModuleInstance)ExportedMemoryDefinitionsadded inv1.0.1

func (m *ModuleInstance) ExportedMemoryDefinitions() map[string]api.MemoryDefinition

ExportedMemoryDefinitions implements the same method as documented onapi.Module.

func (*ModuleInstance)FailIfClosedadded inv1.0.1

func (m *ModuleInstance) FailIfClosed() (errerror)

FailIfClosed returns a sys.ExitError if CloseWithExitCode was called.

func (*ModuleInstance)GetFunctionTypeIDadded inv1.0.2

func (m *ModuleInstance) GetFunctionTypeID(t *FunctionType)FunctionTypeID

GetFunctionTypeID is used by emscripten.

func (*ModuleInstance)Globaladded inv1.1.0

func (m *ModuleInstance) Global(idxint)api.Global

Global implements experimental.InternalModule.

func (*ModuleInstance)GlobalValadded inv1.0.1

func (m *ModuleInstance) GlobalVal(idxIndex)uint64

GlobalVal is an internal hack to get the lower 64 bits of a global.

func (*ModuleInstance)IsClosedadded inv1.3.0

func (m *ModuleInstance) IsClosed()bool

IsClosed implements the same method as documented on api.Module.

func (*ModuleInstance)LookupFunctionadded inv1.5.0

func (m *ModuleInstance) LookupFunction(t *TableInstance, typeIdFunctionTypeID, tableOffsetIndex)api.Function

LookupFunction looks up the table by the given index, and returns the api.Function implementation if found,otherwise this panics according to the same semantics as call_indirect instruction.Currently, this is only used by emscripten which needs to do call_indirect-like operation in the host function.

func (*ModuleInstance)Memory

func (m *ModuleInstance) Memory()api.Memory

Memory implements the same method as documented on api.Module.

func (*ModuleInstance)Name

func (m *ModuleInstance) Name()string

Name implements the same method as documented on api.Module

func (*ModuleInstance)NumGlobaladded inv1.1.0

func (m *ModuleInstance) NumGlobal()int

NumGlobal implements experimental.InternalModule.

func (*ModuleInstance)Stringadded inv1.0.1

func (m *ModuleInstance) String()string

String implements the same method as documented on api.Module

typeNameAssoc

type NameAssoc struct {IndexIndexNamestring}

typeNameMap

type NameMap []NameAssoc

NameMap associates an index with any associated names.

Note: Often the index bridges multiple sections. For example, the function index starts with anyExternTypeFunc in the Module.ImportSection followed by the Module.FunctionSection

Note: NameMap is unique by NameAssoc.Index, but NameAssoc.Name needn't be unique.Note: When encoding in the Binary format, this must be ordered by NameAssoc.IndexSeehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-namemap

typeNameMapAssoc

type NameMapAssoc struct {IndexIndexNameMapNameMap}

typeNameSection

type NameSection struct {// ModuleName is the symbolic identifier for a module. e.g. math//// Note: This can be empty for any reason including configuration.ModuleNamestring// FunctionNames is an association of a function index to its symbolic identifier. e.g. add//// * the key (idx) is in the function index, where module defined functions are preceded by imported ones.// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#functions%E2%91%A7//// For example, assuming the below text format is the second import, you would expect FunctionNames[1] = "mul"//(import "Math" "Mul" (func $mul (param $x f32) (param $y f32) (result f32)))//// Note: FunctionNames are only used for debugging. At runtime, functions are called based on raw numeric index.// Note: This can be nil for any reason including configuration.FunctionNamesNameMap// LocalNames contains symbolic names for function parameters or locals that have one.//// Note: In the Text Format, function local names can inherit parameter// names from their type. Here are some examples://  * (module (import (func (param $x i32) (param i32))) (func (type 0))) = [{0, {x,0}}]//  * (module (import (func (param i32) (param $y i32))) (func (type 0) (local $z i32))) = [0, [{y,1},{z,2}]]//  * (module (func (param $x i32) (local $y i32) (local $z i32))) = [{x,0},{y,1},{z,2}]//// Note: LocalNames are only used for debugging. At runtime, locals are called based on raw numeric index.// Note: This can be nil for any reason including configuration.LocalNamesIndirectNameMap// ResultNames is a wazero-specific mechanism to store result names.ResultNamesIndirectNameMap}

NameSection represent the known custom name subsections defined in the WebAssembly Binary Format

Note: This can be nil if no names were decoded for any reason including configuration.Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#name-section%E2%91%A0

typeOpcode

type Opcode =byte

Opcode is the binary Opcode of an instruction. See also InstructionName

const (// OpcodeUnreachable causes an unconditional trap.OpcodeUnreachableOpcode = 0x00// OpcodeNop does nothingOpcodeNopOpcode = 0x01// OpcodeBlock brackets a sequence of instructions. A branch instruction on an if label breaks out to after its// OpcodeEnd.OpcodeBlockOpcode = 0x02// OpcodeLoop brackets a sequence of instructions. A branch instruction on a loop label will jump back to the// beginning of its block.OpcodeLoopOpcode = 0x03// OpcodeIf brackets a sequence of instructions. When the top of the stack evaluates to 1, the block is executed.// Zero jumps to the optional OpcodeElse. A branch instruction on an if label breaks out to after its OpcodeEnd.OpcodeIfOpcode = 0x04// OpcodeElse brackets a sequence of instructions enclosed by an OpcodeIf. A branch instruction on a then label// breaks out to after the OpcodeEnd on the enclosing OpcodeIf.OpcodeElseOpcode = 0x05// OpcodeEnd terminates a control instruction OpcodeBlock, OpcodeLoop or OpcodeIf.OpcodeEndOpcode = 0x0b// OpcodeBr is a stack-polymorphic opcode that performs an unconditional branch. How the stack is modified depends// on whether the "br" is enclosed by a loop, and if CoreFeatureMultiValue is enabled.//// Here are the rules in pseudocode about how the stack is modified based on the "br" operand L (label)://if L is loop: append(L.originalStackWithoutInputs, N-values popped from the stack) where N == L.inputs//else: append(L.originalStackWithoutInputs, N-values popped from the stack) where N == L.results//// In WebAssembly 1.0 (20191205), N can be zero or one. When CoreFeatureMultiValue is enabled, N can be more than one,// depending on the type use of the label L.//// Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#-hrefsyntax-instr-controlmathsfbrlOpcodeBrOpcode = 0x0cOpcodeBrIfOpcode = 0x0dOpcodeBrTableOpcode = 0x0eOpcodeReturnOpcode = 0x0fOpcodeCallOpcode = 0x10OpcodeCallIndirectOpcode = 0x11OpcodeDropOpcode = 0x1aOpcodeSelectOpcode = 0x1bOpcodeTypedSelectOpcode = 0x1cOpcodeLocalGetOpcode = 0x20OpcodeLocalSetOpcode = 0x21OpcodeLocalTeeOpcode = 0x22OpcodeGlobalGetOpcode = 0x23OpcodeGlobalSetOpcode = 0x24OpcodeTableGetOpcode = 0x25OpcodeTableSetOpcode = 0x26OpcodeI32LoadOpcode = 0x28OpcodeI64LoadOpcode = 0x29OpcodeF32LoadOpcode = 0x2aOpcodeF64LoadOpcode = 0x2bOpcodeI32Load8SOpcode = 0x2cOpcodeI32Load8UOpcode = 0x2dOpcodeI32Load16SOpcode = 0x2eOpcodeI32Load16UOpcode = 0x2fOpcodeI64Load8SOpcode = 0x30OpcodeI64Load8UOpcode = 0x31OpcodeI64Load16SOpcode = 0x32OpcodeI64Load16UOpcode = 0x33OpcodeI64Load32SOpcode = 0x34OpcodeI64Load32UOpcode = 0x35OpcodeI32StoreOpcode = 0x36OpcodeI64StoreOpcode = 0x37OpcodeF32StoreOpcode = 0x38OpcodeF64StoreOpcode = 0x39OpcodeI32Store8Opcode = 0x3aOpcodeI32Store16Opcode = 0x3bOpcodeI64Store8Opcode = 0x3cOpcodeI64Store16Opcode = 0x3dOpcodeI64Store32Opcode = 0x3eOpcodeMemorySizeOpcode = 0x3fOpcodeMemoryGrowOpcode = 0x40OpcodeI32ConstOpcode = 0x41OpcodeI64ConstOpcode = 0x42OpcodeF32ConstOpcode = 0x43OpcodeF64ConstOpcode = 0x44OpcodeI32EqzOpcode = 0x45OpcodeI32EqOpcode = 0x46OpcodeI32NeOpcode = 0x47OpcodeI32LtSOpcode = 0x48OpcodeI32LtUOpcode = 0x49OpcodeI32GtSOpcode = 0x4aOpcodeI32GtUOpcode = 0x4bOpcodeI32LeSOpcode = 0x4cOpcodeI32LeUOpcode = 0x4dOpcodeI32GeSOpcode = 0x4eOpcodeI32GeUOpcode = 0x4fOpcodeI64EqzOpcode = 0x50OpcodeI64EqOpcode = 0x51OpcodeI64NeOpcode = 0x52OpcodeI64LtSOpcode = 0x53OpcodeI64LtUOpcode = 0x54OpcodeI64GtSOpcode = 0x55OpcodeI64GtUOpcode = 0x56OpcodeI64LeSOpcode = 0x57OpcodeI64LeUOpcode = 0x58OpcodeI64GeSOpcode = 0x59OpcodeI64GeUOpcode = 0x5aOpcodeF32EqOpcode = 0x5bOpcodeF32NeOpcode = 0x5cOpcodeF32LtOpcode = 0x5dOpcodeF32GtOpcode = 0x5eOpcodeF32LeOpcode = 0x5fOpcodeF32GeOpcode = 0x60OpcodeF64EqOpcode = 0x61OpcodeF64NeOpcode = 0x62OpcodeF64LtOpcode = 0x63OpcodeF64GtOpcode = 0x64OpcodeF64LeOpcode = 0x65OpcodeF64GeOpcode = 0x66OpcodeI32ClzOpcode = 0x67OpcodeI32CtzOpcode = 0x68OpcodeI32PopcntOpcode = 0x69OpcodeI32AddOpcode = 0x6aOpcodeI32SubOpcode = 0x6bOpcodeI32MulOpcode = 0x6cOpcodeI32DivSOpcode = 0x6dOpcodeI32DivUOpcode = 0x6eOpcodeI32RemSOpcode = 0x6fOpcodeI32RemUOpcode = 0x70OpcodeI32AndOpcode = 0x71OpcodeI32OrOpcode = 0x72OpcodeI32XorOpcode = 0x73OpcodeI32ShlOpcode = 0x74OpcodeI32ShrSOpcode = 0x75OpcodeI32ShrUOpcode = 0x76OpcodeI32RotlOpcode = 0x77OpcodeI32RotrOpcode = 0x78OpcodeI64ClzOpcode = 0x79OpcodeI64CtzOpcode = 0x7aOpcodeI64PopcntOpcode = 0x7bOpcodeI64AddOpcode = 0x7cOpcodeI64SubOpcode = 0x7dOpcodeI64MulOpcode = 0x7eOpcodeI64DivSOpcode = 0x7fOpcodeI64DivUOpcode = 0x80OpcodeI64RemSOpcode = 0x81OpcodeI64RemUOpcode = 0x82OpcodeI64AndOpcode = 0x83OpcodeI64OrOpcode = 0x84OpcodeI64XorOpcode = 0x85OpcodeI64ShlOpcode = 0x86OpcodeI64ShrSOpcode = 0x87OpcodeI64ShrUOpcode = 0x88OpcodeI64RotlOpcode = 0x89OpcodeI64RotrOpcode = 0x8aOpcodeF32AbsOpcode = 0x8bOpcodeF32NegOpcode = 0x8cOpcodeF32CeilOpcode = 0x8dOpcodeF32FloorOpcode = 0x8eOpcodeF32TruncOpcode = 0x8fOpcodeF32NearestOpcode = 0x90OpcodeF32SqrtOpcode = 0x91OpcodeF32AddOpcode = 0x92OpcodeF32SubOpcode = 0x93OpcodeF32MulOpcode = 0x94OpcodeF32DivOpcode = 0x95OpcodeF32MinOpcode = 0x96OpcodeF32MaxOpcode = 0x97OpcodeF32CopysignOpcode = 0x98OpcodeF64AbsOpcode = 0x99OpcodeF64NegOpcode = 0x9aOpcodeF64CeilOpcode = 0x9bOpcodeF64FloorOpcode = 0x9cOpcodeF64TruncOpcode = 0x9dOpcodeF64NearestOpcode = 0x9eOpcodeF64SqrtOpcode = 0x9fOpcodeF64AddOpcode = 0xa0OpcodeF64SubOpcode = 0xa1OpcodeF64MulOpcode = 0xa2OpcodeF64DivOpcode = 0xa3OpcodeF64MinOpcode = 0xa4OpcodeF64MaxOpcode = 0xa5OpcodeF64CopysignOpcode = 0xa6OpcodeI32WrapI64Opcode = 0xa7OpcodeI32TruncF32SOpcode = 0xa8OpcodeI32TruncF32UOpcode = 0xa9OpcodeI32TruncF64SOpcode = 0xaaOpcodeI32TruncF64UOpcode = 0xabOpcodeI64ExtendI32SOpcode = 0xacOpcodeI64ExtendI32UOpcode = 0xadOpcodeI64TruncF32SOpcode = 0xaeOpcodeI64TruncF32UOpcode = 0xafOpcodeI64TruncF64SOpcode = 0xb0OpcodeI64TruncF64UOpcode = 0xb1OpcodeF32ConvertI32SOpcode = 0xb2OpcodeF32ConvertI32UOpcode = 0xb3OpcodeF32ConvertI64SOpcode = 0xb4OpcodeF32ConvertI64UOpcode = 0xb5OpcodeF32DemoteF64Opcode = 0xb6OpcodeF64ConvertI32SOpcode = 0xb7OpcodeF64ConvertI32UOpcode = 0xb8OpcodeF64ConvertI64SOpcode = 0xb9OpcodeF64ConvertI64UOpcode = 0xbaOpcodeF64PromoteF32Opcode = 0xbbOpcodeI32ReinterpretF32Opcode = 0xbcOpcodeI64ReinterpretF64Opcode = 0xbdOpcodeF32ReinterpretI32Opcode = 0xbeOpcodeF64ReinterpretI64Opcode = 0xbf// OpcodeRefNull pushes a null reference value whose type is specified by immediate to this opcode.// This is defined in the reference-types proposal, but necessary for CoreFeatureBulkMemoryOperations as well.//// Currently only supported in the constant expression in element segments.OpcodeRefNull = 0xd0// OpcodeRefIsNull pops a reference value, and pushes 1 if it is null, 0 otherwise.// This is defined in the reference-types proposal, but necessary for CoreFeatureBulkMemoryOperations as well.//// Currently not supported.OpcodeRefIsNull = 0xd1// OpcodeRefFunc pushes a funcref value whose index equals the immediate to this opcode.// This is defined in the reference-types proposal, but necessary for CoreFeatureBulkMemoryOperations as well.//// Currently, this is only supported in the constant expression in element segments.OpcodeRefFunc = 0xd2// OpcodeI32Extend8S extends a signed 8-bit integer to a 32-bit integer.// Note: This is dependent on the flag CoreFeatureSignExtensionOpsOpcodeI32Extend8SOpcode = 0xc0// OpcodeI32Extend16S extends a signed 16-bit integer to a 32-bit integer.// Note: This is dependent on the flag CoreFeatureSignExtensionOpsOpcodeI32Extend16SOpcode = 0xc1// OpcodeI64Extend8S extends a signed 8-bit integer to a 64-bit integer.// Note: This is dependent on the flag CoreFeatureSignExtensionOpsOpcodeI64Extend8SOpcode = 0xc2// OpcodeI64Extend16S extends a signed 16-bit integer to a 64-bit integer.// Note: This is dependent on the flag CoreFeatureSignExtensionOpsOpcodeI64Extend16SOpcode = 0xc3// OpcodeI64Extend32S extends a signed 32-bit integer to a 64-bit integer.// Note: This is dependent on the flag CoreFeatureSignExtensionOpsOpcodeI64Extend32SOpcode = 0xc4// OpcodeMiscPrefix is the prefix of various multi-byte opcodes.// Introduced in CoreFeatureNonTrappingFloatToIntConversion, but used in other// features, such as CoreFeatureBulkMemoryOperations.OpcodeMiscPrefixOpcode = 0xfc// OpcodeVecPrefix is the prefix of all vector isntructions introduced in// CoreFeatureSIMD.OpcodeVecPrefixOpcode = 0xfd// OpcodeAtomicPrefix is the prefix of all atomic instructions introduced in// CoreFeatureThreads.OpcodeAtomicPrefixOpcode = 0xfe)

typeOpcodeAtomicadded inv1.7.0

type OpcodeAtomic =byte

OpcodeAtomic represents an opcode of atomic instructions which hasmulti-byte encoding and is prefixed by OpcodeAtomicPrefix.

These opcodes are toggled with CoreFeaturesThreads.

const (// OpcodeAtomicMemoryNotify represents the instruction memory.atomic.notify.OpcodeAtomicMemoryNotifyOpcodeAtomic = 0x00// OpcodeAtomicMemoryWait32 represents the instruction memory.atomic.wait32.OpcodeAtomicMemoryWait32OpcodeAtomic = 0x01// OpcodeAtomicMemoryWait64 represents the instruction memory.atomic.wait64.OpcodeAtomicMemoryWait64OpcodeAtomic = 0x02// OpcodeAtomicFence represents the instruction atomic.fence.OpcodeAtomicFenceOpcodeAtomic = 0x03// OpcodeAtomicI32Load represents the instruction i32.atomic.load.OpcodeAtomicI32LoadOpcodeAtomic = 0x10// OpcodeAtomicI64Load represents the instruction i64.atomic.load.OpcodeAtomicI64LoadOpcodeAtomic = 0x11// OpcodeAtomicI32Load8U represents the instruction i32.atomic.load8_u.OpcodeAtomicI32Load8UOpcodeAtomic = 0x12// OpcodeAtomicI32Load16U represents the instruction i32.atomic.load16_u.OpcodeAtomicI32Load16UOpcodeAtomic = 0x13// OpcodeAtomicI64Load8U represents the instruction i64.atomic.load8_u.OpcodeAtomicI64Load8UOpcodeAtomic = 0x14// OpcodeAtomicI64Load16U represents the instruction i64.atomic.load16_u.OpcodeAtomicI64Load16UOpcodeAtomic = 0x15// OpcodeAtomicI64Load32U represents the instruction i64.atomic.load32_u.OpcodeAtomicI64Load32UOpcodeAtomic = 0x16// OpcodeAtomicI32Store represents the instruction i32.atomic.store.OpcodeAtomicI32StoreOpcodeAtomic = 0x17// OpcodeAtomicI64Store represents the instruction i64.atomic.store.OpcodeAtomicI64StoreOpcodeAtomic = 0x18// OpcodeAtomicI32Store8 represents the instruction i32.atomic.store8.OpcodeAtomicI32Store8OpcodeAtomic = 0x19// OpcodeAtomicI32Store16 represents the instruction i32.atomic.store16.OpcodeAtomicI32Store16OpcodeAtomic = 0x1a// OpcodeAtomicI64Store8 represents the instruction i64.atomic.store8.OpcodeAtomicI64Store8OpcodeAtomic = 0x1b// OpcodeAtomicI64Store16 represents the instruction i64.atomic.store16.OpcodeAtomicI64Store16OpcodeAtomic = 0x1c// OpcodeAtomicI64Store32 represents the instruction i64.atomic.store32.OpcodeAtomicI64Store32OpcodeAtomic = 0x1d// OpcodeAtomicI32RmwAdd represents the instruction i32.atomic.rmw.add.OpcodeAtomicI32RmwAddOpcodeAtomic = 0x1e// OpcodeAtomicI64RmwAdd represents the instruction i64.atomic.rmw.add.OpcodeAtomicI64RmwAddOpcodeAtomic = 0x1f// OpcodeAtomicI32Rmw8AddU represents the instruction i32.atomic.rmw8.add_u.OpcodeAtomicI32Rmw8AddUOpcodeAtomic = 0x20// OpcodeAtomicI32Rmw16AddU represents the instruction i32.atomic.rmw16.add_u.OpcodeAtomicI32Rmw16AddUOpcodeAtomic = 0x21// OpcodeAtomicI64Rmw8AddU represents the instruction i64.atomic.rmw8.add_u.OpcodeAtomicI64Rmw8AddUOpcodeAtomic = 0x22// OpcodeAtomicI64Rmw16AddU represents the instruction i64.atomic.rmw16.add_u.OpcodeAtomicI64Rmw16AddUOpcodeAtomic = 0x23// OpcodeAtomicI64Rmw32AddU represents the instruction i64.atomic.rmw32.add_u.OpcodeAtomicI64Rmw32AddUOpcodeAtomic = 0x24// OpcodeAtomicI32RmwSub represents the instruction i32.atomic.rmw.sub.OpcodeAtomicI32RmwSubOpcodeAtomic = 0x25// OpcodeAtomicI64RmwSub represents the instruction i64.atomic.rmw.sub.OpcodeAtomicI64RmwSubOpcodeAtomic = 0x26// OpcodeAtomicI32Rmw8SubU represents the instruction i32.atomic.rmw8.sub_u.OpcodeAtomicI32Rmw8SubUOpcodeAtomic = 0x27// OpcodeAtomicI32Rmw16SubU represents the instruction i32.atomic.rmw16.sub_u.OpcodeAtomicI32Rmw16SubUOpcodeAtomic = 0x28// OpcodeAtomicI64Rmw8SubU represents the instruction i64.atomic.rmw8.sub_u.OpcodeAtomicI64Rmw8SubUOpcodeAtomic = 0x29// OpcodeAtomicI64Rmw16SubU represents the instruction i64.atomic.rmw16.sub_u.OpcodeAtomicI64Rmw16SubUOpcodeAtomic = 0x2a// OpcodeAtomicI64Rmw32SubU represents the instruction i64.atomic.rmw32.sub_u.OpcodeAtomicI64Rmw32SubUOpcodeAtomic = 0x2b// OpcodeAtomicI32RmwAnd represents the instruction i32.atomic.rmw.and.OpcodeAtomicI32RmwAndOpcodeAtomic = 0x2c// OpcodeAtomicI64RmwAnd represents the instruction i64.atomic.rmw.and.OpcodeAtomicI64RmwAndOpcodeAtomic = 0x2d// OpcodeAtomicI32Rmw8AndU represents the instruction i32.atomic.rmw8.and_u.OpcodeAtomicI32Rmw8AndUOpcodeAtomic = 0x2e// OpcodeAtomicI32Rmw16AndU represents the instruction i32.atomic.rmw16.and_u.OpcodeAtomicI32Rmw16AndUOpcodeAtomic = 0x2f// OpcodeAtomicI64Rmw8AndU represents the instruction i64.atomic.rmw8.and_u.OpcodeAtomicI64Rmw8AndUOpcodeAtomic = 0x30// OpcodeAtomicI64Rmw16AndU represents the instruction i64.atomic.rmw16.and_u.OpcodeAtomicI64Rmw16AndUOpcodeAtomic = 0x31// OpcodeAtomicI64Rmw32AndU represents the instruction i64.atomic.rmw32.and_u.OpcodeAtomicI64Rmw32AndUOpcodeAtomic = 0x32// OpcodeAtomicI32RmwOr represents the instruction i32.atomic.rmw.or.OpcodeAtomicI32RmwOrOpcodeAtomic = 0x33// OpcodeAtomicI64RmwOr represents the instruction i64.atomic.rmw.or.OpcodeAtomicI64RmwOrOpcodeAtomic = 0x34// OpcodeAtomicI32Rmw8OrU represents the instruction i32.atomic.rmw8.or_u.OpcodeAtomicI32Rmw8OrUOpcodeAtomic = 0x35// OpcodeAtomicI32Rmw16OrU represents the instruction i32.atomic.rmw16.or_u.OpcodeAtomicI32Rmw16OrUOpcodeAtomic = 0x36// OpcodeAtomicI64Rmw8OrU represents the instruction i64.atomic.rmw8.or_u.OpcodeAtomicI64Rmw8OrUOpcodeAtomic = 0x37// OpcodeAtomicI64Rmw16OrU represents the instruction i64.atomic.rmw16.or_u.OpcodeAtomicI64Rmw16OrUOpcodeAtomic = 0x38// OpcodeAtomicI64Rmw32OrU represents the instruction i64.atomic.rmw32.or_u.OpcodeAtomicI64Rmw32OrUOpcodeAtomic = 0x39// OpcodeAtomicI32RmwXor represents the instruction i32.atomic.rmw.xor.OpcodeAtomicI32RmwXorOpcodeAtomic = 0x3a// OpcodeAtomicI64RmwXor represents the instruction i64.atomic.rmw.xor.OpcodeAtomicI64RmwXorOpcodeAtomic = 0x3b// OpcodeAtomicI32Rmw8XorU represents the instruction i32.atomic.rmw8.xor_u.OpcodeAtomicI32Rmw8XorUOpcodeAtomic = 0x3c// OpcodeAtomicI32Rmw16XorU represents the instruction i32.atomic.rmw16.xor_u.OpcodeAtomicI32Rmw16XorUOpcodeAtomic = 0x3d// OpcodeAtomicI64Rmw8XorU represents the instruction i64.atomic.rmw8.xor_u.OpcodeAtomicI64Rmw8XorUOpcodeAtomic = 0x3e// OpcodeAtomicI64Rmw16XorU represents the instruction i64.atomic.rmw16.xor_u.OpcodeAtomicI64Rmw16XorUOpcodeAtomic = 0x3f// OpcodeAtomicI64Rmw32XorU represents the instruction i64.atomic.rmw32.xor_u.OpcodeAtomicI64Rmw32XorUOpcodeAtomic = 0x40// OpcodeAtomicI32RmwXchg represents the instruction i32.atomic.rmw.xchg.OpcodeAtomicI32RmwXchgOpcodeAtomic = 0x41// OpcodeAtomicI64RmwXchg represents the instruction i64.atomic.rmw.xchg.OpcodeAtomicI64RmwXchgOpcodeAtomic = 0x42// OpcodeAtomicI32Rmw8XchgU represents the instruction i32.atomic.rmw8.xchg_u.OpcodeAtomicI32Rmw8XchgUOpcodeAtomic = 0x43// OpcodeAtomicI32Rmw16XchgU represents the instruction i32.atomic.rmw16.xchg_u.OpcodeAtomicI32Rmw16XchgUOpcodeAtomic = 0x44// OpcodeAtomicI64Rmw8XchgU represents the instruction i64.atomic.rmw8.xchg_u.OpcodeAtomicI64Rmw8XchgUOpcodeAtomic = 0x45// OpcodeAtomicI64Rmw16XchgU represents the instruction i64.atomic.rmw16.xchg_u.OpcodeAtomicI64Rmw16XchgUOpcodeAtomic = 0x46// OpcodeAtomicI64Rmw32XchgU represents the instruction i64.atomic.rmw32.xchg_u.OpcodeAtomicI64Rmw32XchgUOpcodeAtomic = 0x47// OpcodeAtomicI32RmwCmpxchg represents the instruction i32.atomic.rmw.cmpxchg.OpcodeAtomicI32RmwCmpxchgOpcodeAtomic = 0x48// OpcodeAtomicI64RmwCmpxchg represents the instruction i64.atomic.rmw.cmpxchg.OpcodeAtomicI64RmwCmpxchgOpcodeAtomic = 0x49// OpcodeAtomicI32Rmw8CmpxchgU represents the instruction i32.atomic.rmw8.cmpxchg_u.OpcodeAtomicI32Rmw8CmpxchgUOpcodeAtomic = 0x4a// OpcodeAtomicI32Rmw16CmpxchgU represents the instruction i32.atomic.rmw16.cmpxchg_u.OpcodeAtomicI32Rmw16CmpxchgUOpcodeAtomic = 0x4b// OpcodeAtomicI64Rmw8CmpxchgU represents the instruction i64.atomic.rmw8.cmpxchg_u.OpcodeAtomicI64Rmw8CmpxchgUOpcodeAtomic = 0x4c// OpcodeAtomicI64Rmw16CmpxchgU represents the instruction i64.atomic.rmw16.cmpxchg_u.OpcodeAtomicI64Rmw16CmpxchgUOpcodeAtomic = 0x4d// OpcodeAtomicI64Rmw32CmpxchgU represents the instruction i64.atomic.rmw32.cmpxchg_u.OpcodeAtomicI64Rmw32CmpxchgUOpcodeAtomic = 0x4e)

typeOpcodeMisc

type OpcodeMisc =byte

OpcodeMisc represents opcodes of the miscellaneous operations.Such an operations has multi-byte encoding which is prefixed by OpcodeMiscPrefix.

const (OpcodeMiscI32TruncSatF32SOpcodeMisc = 0x00OpcodeMiscI32TruncSatF32UOpcodeMisc = 0x01OpcodeMiscI32TruncSatF64SOpcodeMisc = 0x02OpcodeMiscI32TruncSatF64UOpcodeMisc = 0x03OpcodeMiscI64TruncSatF32SOpcodeMisc = 0x04OpcodeMiscI64TruncSatF32UOpcodeMisc = 0x05OpcodeMiscI64TruncSatF64SOpcodeMisc = 0x06OpcodeMiscI64TruncSatF64UOpcodeMisc = 0x07OpcodeMiscMemoryInitOpcodeMisc = 0x08OpcodeMiscDataDropOpcodeMisc = 0x09OpcodeMiscMemoryCopyOpcodeMisc = 0x0aOpcodeMiscMemoryFillOpcodeMisc = 0x0bOpcodeMiscTableInitOpcodeMisc = 0x0cOpcodeMiscElemDropOpcodeMisc = 0x0dOpcodeMiscTableCopyOpcodeMisc = 0x0eOpcodeMiscTableGrowOpcodeMisc = 0x0fOpcodeMiscTableSizeOpcodeMisc = 0x10OpcodeMiscTableFillOpcodeMisc = 0x11)

typeOpcodeTailCalladded inv1.10.0

type OpcodeTailCall =byte

OpcodeTailCall represents an opcode of a tail call instructions.

These opcodes are toggled with CoreFeaturesTailCall.

const (OpcodeTailCallReturnCallOpcodeTailCall = 0x12OpcodeTailCallReturnCallIndirectOpcodeTailCall = 0x13)

typeOpcodeVec

type OpcodeVec =byte

OpcodeVec represents an opcode of a vector instructions which hasmulti-byte encoding and is prefixed by OpcodeMiscPrefix.

These opcodes are toggled with CoreFeatureSIMD.

const (OpcodeVecV128LoadOpcodeVec = 0x00OpcodeVecV128Load8x8sOpcodeVec = 0x01OpcodeVecV128Load8x8uOpcodeVec = 0x02OpcodeVecV128Load16x4sOpcodeVec = 0x03OpcodeVecV128Load16x4uOpcodeVec = 0x04OpcodeVecV128Load32x2sOpcodeVec = 0x05OpcodeVecV128Load32x2uOpcodeVec = 0x06OpcodeVecV128Load8SplatOpcodeVec = 0x07OpcodeVecV128Load16SplatOpcodeVec = 0x08OpcodeVecV128Load32SplatOpcodeVec = 0x09OpcodeVecV128Load64SplatOpcodeVec = 0x0aOpcodeVecV128Load32zeroOpcodeVec = 0x5cOpcodeVecV128Load64zeroOpcodeVec = 0x5dOpcodeVecV128StoreOpcodeVec = 0x0bOpcodeVecV128Load8LaneOpcodeVec = 0x54OpcodeVecV128Load16LaneOpcodeVec = 0x55OpcodeVecV128Load32LaneOpcodeVec = 0x56OpcodeVecV128Load64LaneOpcodeVec = 0x57OpcodeVecV128Store8LaneOpcodeVec = 0x58OpcodeVecV128Store16LaneOpcodeVec = 0x59OpcodeVecV128Store32LaneOpcodeVec = 0x5aOpcodeVecV128Store64LaneOpcodeVec = 0x5b// OpcodeVecV128Const is the vector const instruction.OpcodeVecV128ConstOpcodeVec = 0x0c// OpcodeVecV128i8x16Shuffle is the vector shuffle instruction.OpcodeVecV128i8x16ShuffleOpcodeVec = 0x0dOpcodeVecI8x16ExtractLaneSOpcodeVec = 0x15OpcodeVecI8x16ExtractLaneUOpcodeVec = 0x16OpcodeVecI8x16ReplaceLaneOpcodeVec = 0x17OpcodeVecI16x8ExtractLaneSOpcodeVec = 0x18OpcodeVecI16x8ExtractLaneUOpcodeVec = 0x19OpcodeVecI16x8ReplaceLaneOpcodeVec = 0x1aOpcodeVecI32x4ExtractLaneOpcodeVec = 0x1bOpcodeVecI32x4ReplaceLaneOpcodeVec = 0x1cOpcodeVecI64x2ExtractLaneOpcodeVec = 0x1dOpcodeVecI64x2ReplaceLaneOpcodeVec = 0x1eOpcodeVecF32x4ExtractLaneOpcodeVec = 0x1fOpcodeVecF32x4ReplaceLaneOpcodeVec = 0x20OpcodeVecF64x2ExtractLaneOpcodeVec = 0x21OpcodeVecF64x2ReplaceLaneOpcodeVec = 0x22OpcodeVecI8x16SwizzleOpcodeVec = 0x0eOpcodeVecI8x16SplatOpcodeVec = 0x0fOpcodeVecI16x8SplatOpcodeVec = 0x10OpcodeVecI32x4SplatOpcodeVec = 0x11OpcodeVecI64x2SplatOpcodeVec = 0x12OpcodeVecF32x4SplatOpcodeVec = 0x13OpcodeVecF64x2SplatOpcodeVec = 0x14OpcodeVecI8x16EqOpcodeVec = 0x23OpcodeVecI8x16NeOpcodeVec = 0x24OpcodeVecI8x16LtSOpcodeVec = 0x25OpcodeVecI8x16LtUOpcodeVec = 0x26OpcodeVecI8x16GtSOpcodeVec = 0x27OpcodeVecI8x16GtUOpcodeVec = 0x28OpcodeVecI8x16LeSOpcodeVec = 0x29OpcodeVecI8x16LeUOpcodeVec = 0x2aOpcodeVecI8x16GeSOpcodeVec = 0x2bOpcodeVecI8x16GeUOpcodeVec = 0x2cOpcodeVecI16x8EqOpcodeVec = 0x2dOpcodeVecI16x8NeOpcodeVec = 0x2eOpcodeVecI16x8LtSOpcodeVec = 0x2fOpcodeVecI16x8LtUOpcodeVec = 0x30OpcodeVecI16x8GtSOpcodeVec = 0x31OpcodeVecI16x8GtUOpcodeVec = 0x32OpcodeVecI16x8LeSOpcodeVec = 0x33OpcodeVecI16x8LeUOpcodeVec = 0x34OpcodeVecI16x8GeSOpcodeVec = 0x35OpcodeVecI16x8GeUOpcodeVec = 0x36OpcodeVecI32x4EqOpcodeVec = 0x37OpcodeVecI32x4NeOpcodeVec = 0x38OpcodeVecI32x4LtSOpcodeVec = 0x39OpcodeVecI32x4LtUOpcodeVec = 0x3aOpcodeVecI32x4GtSOpcodeVec = 0x3bOpcodeVecI32x4GtUOpcodeVec = 0x3cOpcodeVecI32x4LeSOpcodeVec = 0x3dOpcodeVecI32x4LeUOpcodeVec = 0x3eOpcodeVecI32x4GeSOpcodeVec = 0x3fOpcodeVecI32x4GeUOpcodeVec = 0x40OpcodeVecI64x2EqOpcodeVec = 0xd6OpcodeVecI64x2NeOpcodeVec = 0xd7OpcodeVecI64x2LtSOpcodeVec = 0xd8OpcodeVecI64x2GtSOpcodeVec = 0xd9OpcodeVecI64x2LeSOpcodeVec = 0xdaOpcodeVecI64x2GeSOpcodeVec = 0xdbOpcodeVecF32x4EqOpcodeVec = 0x41OpcodeVecF32x4NeOpcodeVec = 0x42OpcodeVecF32x4LtOpcodeVec = 0x43OpcodeVecF32x4GtOpcodeVec = 0x44OpcodeVecF32x4LeOpcodeVec = 0x45OpcodeVecF32x4GeOpcodeVec = 0x46OpcodeVecF64x2EqOpcodeVec = 0x47OpcodeVecF64x2NeOpcodeVec = 0x48OpcodeVecF64x2LtOpcodeVec = 0x49OpcodeVecF64x2GtOpcodeVec = 0x4aOpcodeVecF64x2LeOpcodeVec = 0x4bOpcodeVecF64x2GeOpcodeVec = 0x4cOpcodeVecV128NotOpcodeVec = 0x4dOpcodeVecV128AndOpcodeVec = 0x4eOpcodeVecV128AndNotOpcodeVec = 0x4fOpcodeVecV128OrOpcodeVec = 0x50OpcodeVecV128XorOpcodeVec = 0x51OpcodeVecV128BitselectOpcodeVec = 0x52OpcodeVecV128AnyTrueOpcodeVec = 0x53OpcodeVecI8x16AbsOpcodeVec = 0x60OpcodeVecI8x16NegOpcodeVec = 0x61OpcodeVecI8x16PopcntOpcodeVec = 0x62OpcodeVecI8x16AllTrueOpcodeVec = 0x63OpcodeVecI8x16BitMaskOpcodeVec = 0x64OpcodeVecI8x16NarrowI16x8SOpcodeVec = 0x65OpcodeVecI8x16NarrowI16x8UOpcodeVec = 0x66OpcodeVecI8x16ShlOpcodeVec = 0x6bOpcodeVecI8x16ShrSOpcodeVec = 0x6cOpcodeVecI8x16ShrUOpcodeVec = 0x6dOpcodeVecI8x16AddOpcodeVec = 0x6eOpcodeVecI8x16AddSatSOpcodeVec = 0x6fOpcodeVecI8x16AddSatUOpcodeVec = 0x70OpcodeVecI8x16SubOpcodeVec = 0x71OpcodeVecI8x16SubSatSOpcodeVec = 0x72OpcodeVecI8x16SubSatUOpcodeVec = 0x73OpcodeVecI8x16MinSOpcodeVec = 0x76OpcodeVecI8x16MinUOpcodeVec = 0x77OpcodeVecI8x16MaxSOpcodeVec = 0x78OpcodeVecI8x16MaxUOpcodeVec = 0x79OpcodeVecI8x16AvgrUOpcodeVec = 0x7bOpcodeVecI16x8ExtaddPairwiseI8x16SOpcodeVec = 0x7cOpcodeVecI16x8ExtaddPairwiseI8x16UOpcodeVec = 0x7dOpcodeVecI16x8AbsOpcodeVec = 0x80OpcodeVecI16x8NegOpcodeVec = 0x81OpcodeVecI16x8Q15mulrSatSOpcodeVec = 0x82OpcodeVecI16x8AllTrueOpcodeVec = 0x83OpcodeVecI16x8BitMaskOpcodeVec = 0x84OpcodeVecI16x8NarrowI32x4SOpcodeVec = 0x85OpcodeVecI16x8NarrowI32x4UOpcodeVec = 0x86OpcodeVecI16x8ExtendLowI8x16SOpcodeVec = 0x87OpcodeVecI16x8ExtendHighI8x16SOpcodeVec = 0x88OpcodeVecI16x8ExtendLowI8x16UOpcodeVec = 0x89OpcodeVecI16x8ExtendHighI8x16UOpcodeVec = 0x8aOpcodeVecI16x8ShlOpcodeVec = 0x8bOpcodeVecI16x8ShrSOpcodeVec = 0x8cOpcodeVecI16x8ShrUOpcodeVec = 0x8dOpcodeVecI16x8AddOpcodeVec = 0x8eOpcodeVecI16x8AddSatSOpcodeVec = 0x8fOpcodeVecI16x8AddSatUOpcodeVec = 0x90OpcodeVecI16x8SubOpcodeVec = 0x91OpcodeVecI16x8SubSatSOpcodeVec = 0x92OpcodeVecI16x8SubSatUOpcodeVec = 0x93OpcodeVecI16x8MulOpcodeVec = 0x95OpcodeVecI16x8MinSOpcodeVec = 0x96OpcodeVecI16x8MinUOpcodeVec = 0x97OpcodeVecI16x8MaxSOpcodeVec = 0x98OpcodeVecI16x8MaxUOpcodeVec = 0x99OpcodeVecI16x8AvgrUOpcodeVec = 0x9bOpcodeVecI16x8ExtMulLowI8x16SOpcodeVec = 0x9cOpcodeVecI16x8ExtMulHighI8x16SOpcodeVec = 0x9dOpcodeVecI16x8ExtMulLowI8x16UOpcodeVec = 0x9eOpcodeVecI16x8ExtMulHighI8x16UOpcodeVec = 0x9fOpcodeVecI32x4ExtaddPairwiseI16x8SOpcodeVec = 0x7eOpcodeVecI32x4ExtaddPairwiseI16x8UOpcodeVec = 0x7fOpcodeVecI32x4AbsOpcodeVec = 0xa0OpcodeVecI32x4NegOpcodeVec = 0xa1OpcodeVecI32x4AllTrueOpcodeVec = 0xa3OpcodeVecI32x4BitMaskOpcodeVec = 0xa4OpcodeVecI32x4ExtendLowI16x8SOpcodeVec = 0xa7OpcodeVecI32x4ExtendHighI16x8SOpcodeVec = 0xa8OpcodeVecI32x4ExtendLowI16x8UOpcodeVec = 0xa9OpcodeVecI32x4ExtendHighI16x8UOpcodeVec = 0xaaOpcodeVecI32x4ShlOpcodeVec = 0xabOpcodeVecI32x4ShrSOpcodeVec = 0xacOpcodeVecI32x4ShrUOpcodeVec = 0xadOpcodeVecI32x4AddOpcodeVec = 0xaeOpcodeVecI32x4SubOpcodeVec = 0xb1OpcodeVecI32x4MulOpcodeVec = 0xb5OpcodeVecI32x4MinSOpcodeVec = 0xb6OpcodeVecI32x4MinUOpcodeVec = 0xb7OpcodeVecI32x4MaxSOpcodeVec = 0xb8OpcodeVecI32x4MaxUOpcodeVec = 0xb9OpcodeVecI32x4DotI16x8SOpcodeVec = 0xbaOpcodeVecI32x4ExtMulLowI16x8SOpcodeVec = 0xbcOpcodeVecI32x4ExtMulHighI16x8SOpcodeVec = 0xbdOpcodeVecI32x4ExtMulLowI16x8UOpcodeVec = 0xbeOpcodeVecI32x4ExtMulHighI16x8UOpcodeVec = 0xbfOpcodeVecI64x2AbsOpcodeVec = 0xc0OpcodeVecI64x2NegOpcodeVec = 0xc1OpcodeVecI64x2AllTrueOpcodeVec = 0xc3OpcodeVecI64x2BitMaskOpcodeVec = 0xc4OpcodeVecI64x2ExtendLowI32x4SOpcodeVec = 0xc7OpcodeVecI64x2ExtendHighI32x4SOpcodeVec = 0xc8OpcodeVecI64x2ExtendLowI32x4UOpcodeVec = 0xc9OpcodeVecI64x2ExtendHighI32x4UOpcodeVec = 0xcaOpcodeVecI64x2ShlOpcodeVec = 0xcbOpcodeVecI64x2ShrSOpcodeVec = 0xccOpcodeVecI64x2ShrUOpcodeVec = 0xcdOpcodeVecI64x2AddOpcodeVec = 0xceOpcodeVecI64x2SubOpcodeVec = 0xd1OpcodeVecI64x2MulOpcodeVec = 0xd5OpcodeVecI64x2ExtMulLowI32x4SOpcodeVec = 0xdcOpcodeVecI64x2ExtMulHighI32x4SOpcodeVec = 0xddOpcodeVecI64x2ExtMulLowI32x4UOpcodeVec = 0xdeOpcodeVecI64x2ExtMulHighI32x4UOpcodeVec = 0xdfOpcodeVecF32x4CeilOpcodeVec = 0x67OpcodeVecF32x4FloorOpcodeVec = 0x68OpcodeVecF32x4TruncOpcodeVec = 0x69OpcodeVecF32x4NearestOpcodeVec = 0x6aOpcodeVecF32x4AbsOpcodeVec = 0xe0OpcodeVecF32x4NegOpcodeVec = 0xe1OpcodeVecF32x4SqrtOpcodeVec = 0xe3OpcodeVecF32x4AddOpcodeVec = 0xe4OpcodeVecF32x4SubOpcodeVec = 0xe5OpcodeVecF32x4MulOpcodeVec = 0xe6OpcodeVecF32x4DivOpcodeVec = 0xe7OpcodeVecF32x4MinOpcodeVec = 0xe8OpcodeVecF32x4MaxOpcodeVec = 0xe9OpcodeVecF32x4PminOpcodeVec = 0xeaOpcodeVecF32x4PmaxOpcodeVec = 0xebOpcodeVecF64x2CeilOpcodeVec = 0x74OpcodeVecF64x2FloorOpcodeVec = 0x75OpcodeVecF64x2TruncOpcodeVec = 0x7aOpcodeVecF64x2NearestOpcodeVec = 0x94OpcodeVecF64x2AbsOpcodeVec = 0xecOpcodeVecF64x2NegOpcodeVec = 0xedOpcodeVecF64x2SqrtOpcodeVec = 0xefOpcodeVecF64x2AddOpcodeVec = 0xf0OpcodeVecF64x2SubOpcodeVec = 0xf1OpcodeVecF64x2MulOpcodeVec = 0xf2OpcodeVecF64x2DivOpcodeVec = 0xf3OpcodeVecF64x2MinOpcodeVec = 0xf4OpcodeVecF64x2MaxOpcodeVec = 0xf5OpcodeVecF64x2PminOpcodeVec = 0xf6OpcodeVecF64x2PmaxOpcodeVec = 0xf7OpcodeVecI32x4TruncSatF32x4SOpcodeVec = 0xf8OpcodeVecI32x4TruncSatF32x4UOpcodeVec = 0xf9OpcodeVecF32x4ConvertI32x4SOpcodeVec = 0xfaOpcodeVecF32x4ConvertI32x4UOpcodeVec = 0xfbOpcodeVecI32x4TruncSatF64x2SZeroOpcodeVec = 0xfcOpcodeVecI32x4TruncSatF64x2UZeroOpcodeVec = 0xfdOpcodeVecF64x2ConvertLowI32x4SOpcodeVec = 0xfeOpcodeVecF64x2ConvertLowI32x4UOpcodeVec = 0xffOpcodeVecF32x4DemoteF64x2ZeroOpcodeVec = 0x5eOpcodeVecF64x2PromoteLowF32x4ZeroOpcodeVec = 0x5f)

typeRefType

type RefType =byte

RefType is either RefTypeFuncref or RefTypeExternref as of WebAssembly core 2.0.

typeReference

type Reference =uintptr

Reference is the runtime representation of RefType which is either RefTypeFuncref or RefTypeExternref.

typeSectionID

type SectionID =byte

SectionID identifies the sections of a Module in the WebAssembly 1.0 (20191205) Binary Format.

Note: these are defined in the wasm package, instead of the binary package, as a key per section is needed regardlessof format, and deferring to the binary type avoids confusion.

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#sections%E2%91%A0

const (// SectionIDCustom includes the standard defined NameSection and possibly others not defined in the standard.SectionIDCustomSectionID =iota// don't add anything not inhttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#sections%E2%91%A0SectionIDTypeSectionIDImportSectionIDFunctionSectionIDTableSectionIDMemorySectionIDGlobalSectionIDExportSectionIDStartSectionIDElementSectionIDCodeSectionIDData// SectionIDDataCount may exist in WebAssembly 2.0 or WebAssembly 1.0 with CoreFeatureBulkMemoryOperations enabled.//// Seehttps://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#data-count-section// Seehttps://www.w3.org/TR/2022/WD-wasm-core-2-20220419/appendix/changes.html#bulk-memory-and-table-instructionsSectionIDDataCount)

typeStore

type Store struct {// EnabledFeatures are read-only to allow optimizations.EnabledFeaturesapi.CoreFeatures// Engine is a global context for a Store which is in responsible for compilation and execution of Wasm modules.EngineEngine// contains filtered or unexported fields}

Store is the runtime representation of "instantiated" Wasm module and objects.Multiple modules can be instantiated within a single store, and each instance,(e.g. function instance) can be referenced by other module instances in a Store via Module.ImportSection.

Every type whose name ends with "Instance" suffix belongs to exactly one store.

Note that store is not thread (concurrency) safe, meaning that using single Storevia multiple goroutines might result in race conditions. In that case, the invocationand access to any methods and field of Store must be guarded by mutex.

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#store%E2%91%A0

funcNewStore

func NewStore(enabledFeaturesapi.CoreFeatures, engineEngine) *Store

func (*Store)CloseWithExitCode

func (s *Store) CloseWithExitCode(ctxcontext.Context, exitCodeuint32)error

CloseWithExitCode implements the same method as documented on wazero.Runtime.

func (*Store)GetFunctionTypeIDadded inv1.0.2

func (s *Store) GetFunctionTypeID(t *FunctionType) (FunctionTypeID,error)

func (*Store)GetFunctionTypeIDs

func (s *Store) GetFunctionTypeIDs(ts []FunctionType) ([]FunctionTypeID,error)

func (*Store)Instantiate

func (s *Store) Instantiate(ctxcontext.Context,module *Module,namestring,sys *internalsys.Context,typeIDs []FunctionTypeID,) (*ModuleInstance,error)

Instantiate uses name instead of the Module.NameSection ModuleName as it allows instantiating the same module underdifferent names safely and concurrently.

* ctx: the default context used for function calls.* name: the name of the module.* sys: the system context, which will be closed (SysContext.Close) on ModuleInstance.Close.

Note: Module.Validate must be called prior to instantiation.

func (*Store)Module

func (s *Store) Module(moduleNamestring) *ModuleInstance

Module implements wazero.Runtime Module

typeTable

type Table struct {Minuint32Max  *uint32TypeRefType}

Table describes the limits of elements and its type in a table.

typeTableInstance

type TableInstance struct {// References holds references whose type is either RefTypeFuncref or RefTypeExternref (unsupported).//// Currently, only function references are supported.References []Reference// Min is the minimum (function) elements in this table and cannot grow to accommodate ElementSegment.Minuint32// Max if present is the maximum (function) elements in this table, or nil if unbounded.Max *uint32// Type is either RefTypeFuncref or RefTypeExternRef.TypeRefType// contains filtered or unexported fields}

TableInstance represents a table of (RefTypeFuncref) elements in a module.

Seehttps://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#table-instances%E2%91%A0

func (*TableInstance)Grow

func (t *TableInstance) Grow(deltauint32, initialRefReference) (currentLenuint32)

Grow appends the `initialRef` by `delta` times into the References slice.Returns -1 if the operation is not valid, otherwise the old length of the table.

https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/instructions.html#xref-syntax-instructions-syntax-instr-table-mathsf-table-grow-x

typeValueType

type ValueType =api.ValueType

ValueType is an alias of api.ValueType defined to simplify imports.

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp