diff options
Diffstat (limited to 'crates/types/src')
| -rw-r--r-- | crates/types/src/instructions.rs | 12 | ||||
| -rw-r--r-- | crates/types/src/lib.rs | 13 |
2 files changed, 25 insertions, 0 deletions
diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs index a1bc0fe..4c76046 100644 --- a/crates/types/src/instructions.rs +++ b/crates/types/src/instructions.rs @@ -132,6 +132,8 @@ pub enum Instruction { BinOpLocalConstTee32(BinOp, LocalAddr, i32, LocalAddr), BinOpLocalConstTee64(BinOp, LocalAddr, i64, LocalAddr), BinOpLocalConstTee128(BinOp128, LocalAddr, ConstIdx, LocalAddr), + BinOpStackGlobal32(BinOp, u32), + BinOpStackGlobal64(BinOp, u32), SetLocalConst32(LocalAddr, i32), SetLocalConst64(LocalAddr, i64), SetLocalConst128(LocalAddr, ConstIdx), StoreLocalLocal32(MemoryArg, u8, u8), StoreLocalLocal64(MemoryArg, u8, u8), @@ -145,6 +147,14 @@ pub enum Instruction { SubConstTee32(i32, LocalAddr), AndConstTee64(i64, LocalAddr), SubConstTee64(i64, LocalAddr), + MulAccLocal32(LocalAddr), + MulAccLocal64(LocalAddr), + FMulAccLocal32(LocalAddr), + FMulAccLocal64(LocalAddr), + I32Add3, + I64Add3, + FMaStoreF32(MemoryArg), + FMaStoreF64(MemoryArg), // > Control Instructions (jump-oriented, lowered from structured control during parsing) // See <https://webassembly.github.io/spec/core/binary/instructions.html#control-instructions> @@ -385,6 +395,8 @@ impl Instruction { | Self::I64Store(arg) | Self::F32Store(arg) | Self::F64Store(arg) + | Self::FMaStoreF32(arg) + | Self::FMaStoreF64(arg) | Self::I32Store8(arg) | Self::I32Store16(arg) | Self::I64Store8(arg) diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index 29eb709..b65e4b7 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -10,6 +10,7 @@ extern crate alloc; use alloc::{boxed::Box, sync::Arc}; +use core::hint::cold_path; use core::ops::{Deref, Range}; // Memory defaults @@ -430,6 +431,18 @@ pub struct WasmFunctionData { pub branch_table_targets: Box<[u32]>, } +impl WasmFunctionData { + /// Panics if `idx` is out of bounds. + #[inline(always)] + pub fn v128_const(&self, idx: ConstIdx) -> [u8; 16] { + let Some(val) = self.v128_constants.get(idx as usize) else { + cold_path(); + unreachable!("invalid v128 constant index"); + }; + *val + } +} + /// A WebAssembly Module Export #[derive(Clone, PartialEq, Eq)] #[cfg_attr(feature = "debug", derive(Debug))] |
