Skip to content

Bump wasmparser from 0.224.1 to 0.235.0 #629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/hyperlight_component_macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ name = "hyperlight_component_macro"
proc-macro = true

[dependencies]
wasmparser = { version = "0.224.0" }
wasmparser = { version = "0.235.0" }
quote = { version = "1.0.38" }
proc-macro2 = { version = "1.0.95" }
syn = { version = "2.0.104" }
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_component_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Shared implementation for the procedural macros that generate Hyperlight host an
name = "hyperlight_component_util"

[dependencies]
wasmparser = { version = "0.224.0" }
wasmparser = { version = "0.235.0" }
quote = { version = "1.0.38" }
proc-macro2 = { version = "1.0.95" }
syn = { version = "2.0.104" }
Expand Down
35 changes: 15 additions & 20 deletions src/hyperlight_component_util/src/elaborate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ limitations under the License.
//! substitute.rs for more details of the approach here).

use wasmparser::{
ComponentAlias, ComponentDefinedType, ComponentFuncResult, ComponentFuncType,
ComponentOuterAliasKind, ComponentType, ComponentTypeDeclaration, ComponentTypeRef,
ComponentValType, CompositeInnerType, CoreType, InstanceTypeDeclaration, ModuleTypeDeclaration,
OuterAliasKind, PrimitiveValType, TypeBounds, TypeRef,
ComponentAlias, ComponentDefinedType, ComponentFuncType, ComponentOuterAliasKind,
ComponentType, ComponentTypeDeclaration, ComponentTypeRef, ComponentValType,
CompositeInnerType, CoreType, InstanceTypeDeclaration, ModuleTypeDeclaration, OuterAliasKind,
PrimitiveValType, TypeBounds, TypeRef,
};

use crate::etypes::{
self, BoundedTyvar, Component, CoreDefined, CoreExportDecl, CoreExternDesc, CoreModule,
BoundedTyvar, Component, CoreDefined, CoreExportDecl, CoreExternDesc, CoreModule,
CoreOrComponentExternDesc, Ctx, Defined, ExternDecl, ExternDesc, FloatWidth, Func, Handleable,
Instance, IntWidth, Name, Param, QualifiedInstance, RecordField, Resource, ResourceId,
TypeBound, Tyvar, Value, VariantCase,
Expand Down Expand Up @@ -366,6 +366,7 @@ impl<'p, 'a> Ctx<'p, 'a> {
PrimitiveValType::F64 => Value::F(FloatWidth::F64),
PrimitiveValType::Char => Value::Char,
PrimitiveValType::String => Value::String,
PrimitiveValType::ErrorContext => panic!("async not yet supported"),
}),
}
}
Expand Down Expand Up @@ -428,9 +429,12 @@ impl<'p, 'a> Ctx<'p, 'a> {
Defined::Handleable(h) => Ok(Value::Borrow(h.clone())),
_ => Err(Error::HandleToNonResource),
},
ComponentDefinedType::Future(_)
| ComponentDefinedType::Stream(_)
| ComponentDefinedType::ErrorContext => panic!("async not yet supported"),
ComponentDefinedType::Future(_) | ComponentDefinedType::Stream(_) => {
panic!("async not yet supported")
}
ComponentDefinedType::FixedSizeList(vt, _) => {
Ok(Value::List(Box::new(self.elab_value(vt)?)))
}
}
}

Expand All @@ -446,18 +450,9 @@ impl<'p, 'a> Ctx<'p, 'a> {
})
})
.collect::<Result<Vec<_>, Error<'a>>>()?,
result: match &ft.results {
ComponentFuncResult::Unnamed(vt) => etypes::Result::Unnamed(self.elab_value(vt)?),
ComponentFuncResult::Named(rs) => etypes::Result::Named(
rs.iter()
.map(|(n, vt)| {
Ok(Param {
name: Name { name: n },
ty: self.elab_value(vt)?,
})
})
.collect::<Result<Vec<_>, Error<'a>>>()?,
),
result: match &ft.result {
Some(vt) => Some(self.elab_value(vt)?),
None => None,
},
})
}
Expand Down
8 changes: 1 addition & 7 deletions src/hyperlight_component_util/src/etypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,11 @@ pub struct Param<'a> {
pub ty: Value<'a>,
}

#[derive(Debug, Clone)]
pub enum Result<'a> {
Unnamed(Value<'a>),
Named(Vec<Param<'a>>),
}

/// functype_e in the specification
#[derive(Debug, Clone)]
pub struct Func<'a> {
pub params: Vec<Param<'a>>,
pub result: Result<'a>,
pub result: Option<Value<'a>>,
}

/// In the spec, this does not exist, but a validation rule ensures an
Expand Down
16 changes: 7 additions & 9 deletions src/hyperlight_component_util/src/hl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use proc_macro2::{Ident, TokenStream};
use quote::{format_ident, quote};

use crate::emit::{State, kebab_to_cons, kebab_to_var};
use crate::etypes::{self, Defined, Handleable, TypeBound, Tyvar, Value};
use crate::etypes::{Defined, Handleable, TypeBound, Tyvar, Value};
use crate::rtypes;

/// Construct a string that can be used "on the wire" to identify a
Expand Down Expand Up @@ -653,14 +653,13 @@ pub fn emit_hl_unmarshal_param(s: &mut State, id: Ident, pt: &Value) -> TokenStr
///
/// Precondition: the result type must only be a named result if there
/// are no names in it (i.e. a unit type)
pub fn emit_hl_unmarshal_result(s: &mut State, id: Ident, rt: &etypes::Result) -> TokenStream {
pub fn emit_hl_unmarshal_result(s: &mut State, id: Ident, rt: &Option<Value<'_>>) -> TokenStream {
match rt {
etypes::Result::Named(rs) if rs.is_empty() => quote! { () },
etypes::Result::Unnamed(vt) => {
Some(vt) => {
let toks = emit_hl_unmarshal_value(s, id, vt);
quote! { { #toks }.0 }
}
_ => panic!("named results not supported"),
None => quote! { () },
}
}

Expand All @@ -678,13 +677,12 @@ pub fn emit_hl_marshal_param(s: &mut State, id: Ident, pt: &Value) -> TokenStrea
///
/// Precondition: the result type must only be a named result if there
/// are no names in it (a unit type)
pub fn emit_hl_marshal_result(s: &mut State, id: Ident, rt: &etypes::Result) -> TokenStream {
pub fn emit_hl_marshal_result(s: &mut State, id: Ident, rt: &Option<Value<'_>>) -> TokenStream {
match rt {
etypes::Result::Named(rs) if rs.is_empty() => quote! { ::alloc::vec::Vec::new() },
etypes::Result::Unnamed(vt) => {
None => quote! { ::alloc::vec::Vec::new() },
Some(vt) => {
let toks = emit_hl_marshal_value(s, id, vt);
quote! { { #toks } }
}
_ => panic!("named results not supported"),
}
}
9 changes: 4 additions & 5 deletions src/hyperlight_component_util/src/rtypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::emit::{
};
use crate::etypes::{
Component, Defined, ExternDecl, ExternDesc, Func, Handleable, ImportExport, Instance, Param,
Result, TypeBound, Tyvar, Value,
TypeBound, Tyvar, Value,
};

/// When referring to an instance or resource trait, emit a token
Expand Down Expand Up @@ -521,11 +521,10 @@ pub fn emit_func_param(s: &mut State, p: &Param) -> TokenStream {
///
/// Precondition: the result type must only be a named result if there
/// are no names in it (i.e. a unit type)
pub fn emit_func_result(s: &mut State, r: &Result) -> TokenStream {
pub fn emit_func_result(s: &mut State, r: &Option<Value<'_>>) -> TokenStream {
match r {
Result::Unnamed(vt) => emit_value(s, vt),
Result::Named(rs) if rs.is_empty() => quote! { () },
_ => panic!("multiple named function results are not currently supported"),
Some(vt) => emit_value(s, vt),
None => quote! { () },
}
}

Expand Down
9 changes: 3 additions & 6 deletions src/hyperlight_component_util/src/substitute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,10 @@ where
pts.iter().map(|pt| self.param(pt)).collect()
}

fn result(
&self,
rt: &crate::etypes::Result<'a>,
) -> Result<crate::etypes::Result<'a>, Self::Error> {
fn result(&self, rt: &Option<Value<'a>>) -> Result<Option<Value<'a>>, Self::Error> {
Ok(match rt {
crate::etypes::Result::Unnamed(vt) => crate::etypes::Result::Unnamed(self.value(vt)?),
crate::etypes::Result::Named(pts) => crate::etypes::Result::Named(self.params(pts)?),
Some(vt) => Some(self.value(vt)?),
None => None,
})
}

Expand Down
6 changes: 2 additions & 4 deletions src/hyperlight_component_util/src/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,8 @@ impl<'p, 'a> Ctx<'p, 'a> {
.iter()
.try_for_each(|fp: &'r Param<'a>| self.wf_value(param_pos, &fp.ty))?;
match &ft.result {
crate::etypes::Result::Unnamed(vt) => self.wf_value(result_pos, vt),
crate::etypes::Result::Named(ps) => ps
.iter()
.try_for_each(|fp: &'r Param<'a>| self.wf_value(result_pos, &fp.ty)),
Some(vt) => self.wf_value(result_pos, vt),
None => Ok(()),
}
}
fn wf_type_bound<'r>(
Expand Down
8 changes: 4 additions & 4 deletions src/tests/rust_guests/witguest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading