summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wast/src/component
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/rust/wast/src/component
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/wast/src/component')
-rw-r--r--third_party/rust/wast/src/component/binary.rs30
-rw-r--r--third_party/rust/wast/src/component/resolve.rs3
-rw-r--r--third_party/rust/wast/src/component/types.rs16
-rw-r--r--third_party/rust/wast/src/component/wast.rs10
4 files changed, 41 insertions, 18 deletions
diff --git a/third_party/rust/wast/src/component/binary.rs b/third_party/rust/wast/src/component/binary.rs
index a57cc0f912..a04343269f 100644
--- a/third_party/rust/wast/src/component/binary.rs
+++ b/third_party/rust/wast/src/component/binary.rs
@@ -597,7 +597,7 @@ impl From<core::HeapType<'_>> for wasm_encoder::HeapType {
match r {
core::HeapType::Func => Self::Func,
core::HeapType::Extern => Self::Extern,
- core::HeapType::Exn => {
+ core::HeapType::Exn | core::HeapType::NoExn => {
todo!("encoding of exceptions proposal types not yet implemented")
}
core::HeapType::Concrete(Index::Num(i, _)) => Self::Concrete(i),
@@ -640,11 +640,23 @@ impl From<core::TableType<'_>> for wasm_encoder::TableType {
impl From<core::MemoryType> for wasm_encoder::MemoryType {
fn from(ty: core::MemoryType) -> Self {
- let (minimum, maximum, memory64, shared) = match ty {
- core::MemoryType::B32 { limits, shared } => {
- (limits.min.into(), limits.max.map(Into::into), false, shared)
- }
- core::MemoryType::B64 { limits, shared } => (limits.min, limits.max, true, shared),
+ let (minimum, maximum, memory64, shared, page_size_log2) = match ty {
+ core::MemoryType::B32 {
+ limits,
+ shared,
+ page_size_log2,
+ } => (
+ limits.min.into(),
+ limits.max.map(Into::into),
+ false,
+ shared,
+ page_size_log2,
+ ),
+ core::MemoryType::B64 {
+ limits,
+ shared,
+ page_size_log2,
+ } => (limits.min, limits.max, true, shared, page_size_log2),
};
Self {
@@ -652,6 +664,7 @@ impl From<core::MemoryType> for wasm_encoder::MemoryType {
maximum,
memory64,
shared,
+ page_size_log2,
}
}
}
@@ -661,6 +674,7 @@ impl From<core::GlobalType<'_>> for wasm_encoder::GlobalType {
Self {
val_type: ty.ty.into(),
mutable: ty.mutable,
+ shared: ty.shared,
}
}
}
@@ -780,8 +794,8 @@ impl From<PrimitiveValType> for wasm_encoder::PrimitiveValType {
PrimitiveValType::U32 => Self::U32,
PrimitiveValType::S64 => Self::S64,
PrimitiveValType::U64 => Self::U64,
- PrimitiveValType::Float32 => Self::Float32,
- PrimitiveValType::Float64 => Self::Float64,
+ PrimitiveValType::F32 => Self::F32,
+ PrimitiveValType::F64 => Self::F64,
PrimitiveValType::Char => Self::Char,
PrimitiveValType::String => Self::String,
}
diff --git a/third_party/rust/wast/src/component/resolve.rs b/third_party/rust/wast/src/component/resolve.rs
index c0122ef73f..0f33df564a 100644
--- a/third_party/rust/wast/src/component/resolve.rs
+++ b/third_party/rust/wast/src/component/resolve.rs
@@ -531,7 +531,8 @@ impl<'a> Resolver<'a> {
| core::HeapType::Struct
| core::HeapType::None
| core::HeapType::NoFunc
- | core::HeapType::NoExtern => {}
+ | core::HeapType::NoExtern
+ | core::HeapType::NoExn => {}
core::HeapType::Concrete(id) => {
self.resolve_ns(id, Ns::Type)?;
}
diff --git a/third_party/rust/wast/src/component/types.rs b/third_party/rust/wast/src/component/types.rs
index 72eced02a8..dc8a91fd6b 100644
--- a/third_party/rust/wast/src/component/types.rs
+++ b/third_party/rust/wast/src/component/types.rs
@@ -230,8 +230,8 @@ pub enum PrimitiveValType {
U32,
S64,
U64,
- Float32,
- Float64,
+ F32,
+ F64,
Char,
String,
}
@@ -266,12 +266,18 @@ impl<'a> Parse<'a> for PrimitiveValType {
} else if l.peek::<kw::u64>()? {
parser.parse::<kw::u64>()?;
Ok(Self::U64)
+ } else if l.peek::<kw::f32>()? {
+ parser.parse::<kw::f32>()?;
+ Ok(Self::F32)
+ } else if l.peek::<kw::f64>()? {
+ parser.parse::<kw::f64>()?;
+ Ok(Self::F64)
} else if l.peek::<kw::float32>()? {
parser.parse::<kw::float32>()?;
- Ok(Self::Float32)
+ Ok(Self::F32)
} else if l.peek::<kw::float64>()? {
parser.parse::<kw::float64>()?;
- Ok(Self::Float64)
+ Ok(Self::F64)
} else if l.peek::<kw::char>()? {
parser.parse::<kw::char>()?;
Ok(Self::Char)
@@ -297,6 +303,8 @@ impl Peek for PrimitiveValType {
| Some(("u32", _))
| Some(("s64", _))
| Some(("u64", _))
+ | Some(("f32", _))
+ | Some(("f64", _))
| Some(("float32", _))
| Some(("float64", _))
| Some(("char", _))
diff --git a/third_party/rust/wast/src/component/wast.rs b/third_party/rust/wast/src/component/wast.rs
index 72d8bf15bc..28f1ce267c 100644
--- a/third_party/rust/wast/src/component/wast.rs
+++ b/third_party/rust/wast/src/component/wast.rs
@@ -1,6 +1,6 @@
use crate::kw;
use crate::parser::{Cursor, Parse, Parser, Peek, Result};
-use crate::token::{Float32, Float64};
+use crate::token::{F32, F64};
/// Expression that can be used inside of `invoke` expressions for core wasm
/// functions.
@@ -16,8 +16,8 @@ pub enum WastVal<'a> {
S32(i32),
U64(u64),
S64(i64),
- Float32(Float32),
- Float64(Float64),
+ F32(F32),
+ F64(F64),
Char(char),
String(&'a str),
List(Vec<WastVal<'a>>),
@@ -53,8 +53,8 @@ static CASES: &[(&str, fn(Parser<'_>) -> Result<WastVal<'_>>)] = {
("s32.const", |p| Ok(S32(p.parse()?))),
("u64.const", |p| Ok(U64(p.parse()?))),
("s64.const", |p| Ok(S64(p.parse()?))),
- ("f32.const", |p| Ok(Float32(p.parse()?))),
- ("f64.const", |p| Ok(Float64(p.parse()?))),
+ ("f32.const", |p| Ok(F32(p.parse()?))),
+ ("f64.const", |p| Ok(F64(p.parse()?))),
("char.const", |p| {
let s = p.parse::<&str>()?;
let mut ch = s.chars();