You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

wasm-encoder

Package Overview
Dependencies
Maintainers
0
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wasm-encoder - cargo Package Compare versions

Comparing version
0.238.1
to
0.239.0
+1
-1
.cargo_vcs_info.json
{
"git": {
"sha1": "544ac54d0d9d43bcfed2597af4293729dfb89854"
"sha1": "35f8671bce74190ef0b00ce36c399b053b490374"
},
"path_in_vcs": "crates/wasm-encoder"
}

@@ -155,3 +155,3 @@ # This file is automatically @generated by Cargo.

name = "wasm-encoder"
version = "0.238.1"
version = "0.239.0"
dependencies = [

@@ -167,5 +167,5 @@ "anyhow",

name = "wasmparser"
version = "0.238.1"
version = "0.239.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fa99c8328024423875ae4a55345cfde8f0371327fb2d0f33b0f52a06fc44408"
checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0"
dependencies = [

@@ -179,5 +179,5 @@ "bitflags",

name = "wasmprinter"
version = "0.238.1"
version = "0.239.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd2d53749ac5922bdc60ef3288adc7b45990fb079331d977b25dd7e83c75c810"
checksum = "b3981f3d51f39f24f5fc90f93049a90f08dbbca8deba602cd46bb8ca67a94718"
dependencies = [

@@ -184,0 +184,0 @@ "anyhow",

@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

name = "wasm-encoder"
version = "0.238.1"
version = "0.239.0"
authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]

@@ -54,3 +54,3 @@ build = "build.rs"

[dependencies.wasmparser]
version = "0.238.1"
version = "0.239.0"
features = [

@@ -70,3 +70,3 @@ "simd",

[dev-dependencies.wasmprinter]
version = "0.238.1"
version = "0.239.0"
default-features = false

@@ -73,0 +73,0 @@

@@ -400,2 +400,14 @@ use crate::component::*;

/// Declares a new `backpressure.inc` intrinsic.
pub fn backpressure_inc(&mut self) -> u32 {
self.canonical_functions().backpressure_inc();
inc(&mut self.core_funcs)
}
/// Declares a new `backpressure.dec` intrinsic.
pub fn backpressure_dec(&mut self) -> u32 {
self.canonical_functions().backpressure_dec();
inc(&mut self.core_funcs)
}
/// Declares a new `task.return` intrinsic.

@@ -429,5 +441,5 @@ pub fn task_return<O>(&mut self, ty: Option<ComponentValType>, options: O) -> u32

/// Declares a new `task.yield` intrinsic.
pub fn yield_(&mut self, async_: bool) -> u32 {
self.canonical_functions().yield_(async_);
/// Declares a new `thread.yield` intrinsic.
pub fn thread_yield(&mut self, cancellable: bool) -> u32 {
self.canonical_functions().thread_yield(cancellable);
inc(&mut self.core_funcs)

@@ -582,4 +594,5 @@ }

/// Declares a new `waitable-set.wait` intrinsic.
pub fn waitable_set_wait(&mut self, async_: bool, memory: u32) -> u32 {
self.canonical_functions().waitable_set_wait(async_, memory);
pub fn waitable_set_wait(&mut self, cancellable: bool, memory: u32) -> u32 {
self.canonical_functions()
.waitable_set_wait(cancellable, memory);
inc(&mut self.core_funcs)

@@ -589,4 +602,5 @@ }

/// Declares a new `waitable-set.poll` intrinsic.
pub fn waitable_set_poll(&mut self, async_: bool, memory: u32) -> u32 {
self.canonical_functions().waitable_set_poll(async_, memory);
pub fn waitable_set_poll(&mut self, cancellable: bool, memory: u32) -> u32 {
self.canonical_functions()
.waitable_set_poll(cancellable, memory);
inc(&mut self.core_funcs)

@@ -607,2 +621,39 @@ }

/// Declares a new `thread.index` intrinsic.
pub fn thread_index(&mut self) -> u32 {
self.canonical_functions().thread_index();
inc(&mut self.core_funcs)
}
/// Declares a new `thread.new_indirect` intrinsic.
pub fn thread_new_indirect(&mut self, func_ty_idx: u32, table_index: u32) -> u32 {
self.canonical_functions()
.thread_new_indirect(func_ty_idx, table_index);
inc(&mut self.core_funcs)
}
/// Declares a new `thread.switch-to` intrinsic.
pub fn thread_switch_to(&mut self, cancellable: bool) -> u32 {
self.canonical_functions().thread_switch_to(cancellable);
inc(&mut self.core_funcs)
}
/// Declares a new `thread.suspend` intrinsic.
pub fn thread_suspend(&mut self, cancellable: bool) -> u32 {
self.canonical_functions().thread_suspend(cancellable);
inc(&mut self.core_funcs)
}
/// Declares a new `thread.resume-later` intrinsic.
pub fn thread_resume_later(&mut self) -> u32 {
self.canonical_functions().thread_resume_later();
inc(&mut self.core_funcs)
}
/// Declares a new `thread.yield-to` intrinsic.
pub fn thread_yield_to(&mut self, cancellable: bool) -> u32 {
self.canonical_functions().thread_yield_to(cancellable);
inc(&mut self.core_funcs)
}
/// Adds a new custom section to this component.

@@ -609,0 +660,0 @@ pub fn custom_section(&mut self, section: &CustomSection<'_>) {

@@ -209,2 +209,18 @@ use crate::{ComponentSection, ComponentSectionId, ComponentValType, Encode, encode_section};

/// Defines a function which tells the host to increment the backpressure
/// counter.
pub fn backpressure_inc(&mut self) -> &mut Self {
self.bytes.push(0x24);
self.num_added += 1;
self
}
/// Defines a function which tells the host to decrement the backpressure
/// counter.
pub fn backpressure_dec(&mut self) -> &mut Self {
self.bytes.push(0x25);
self.num_added += 1;
self
}
/// Defines a function which returns a result to the caller of a lifted

@@ -253,6 +269,6 @@ /// export function. This allows the callee to continue executing after

///
/// If `async_` is true, the caller instance may be reentered.
pub fn yield_(&mut self, async_: bool) -> &mut Self {
/// If `cancellable` is true, the caller instance may be reentered.
pub fn thread_yield(&mut self, cancellable: bool) -> &mut Self {
self.bytes.push(0x0c);
self.bytes.push(if async_ { 1 } else { 0 });
self.bytes.push(if cancellable { 1 } else { 0 });
self.num_added += 1;

@@ -503,2 +519,55 @@ self

/// Declare a new `thread.index` intrinsic, used to get the index of the
/// current thread.
pub fn thread_index(&mut self) -> &mut Self {
self.bytes.push(0x26);
self.num_added += 1;
self
}
/// Declare a new `thread.new_indirect` intrinsic, used to create a new
/// thread by invoking a function indirectly through a `funcref` table.
pub fn thread_new_indirect(&mut self, ty_index: u32, table_index: u32) -> &mut Self {
self.bytes.push(0x27);
ty_index.encode(&mut self.bytes);
table_index.encode(&mut self.bytes);
self.num_added += 1;
self
}
/// Declare a new `thread.switch-to` intrinsic, used to switch execution to
/// another thread.
pub fn thread_switch_to(&mut self, cancellable: bool) -> &mut Self {
self.bytes.push(0x28);
self.bytes.push(if cancellable { 1 } else { 0 });
self.num_added += 1;
self
}
/// Declare a new `thread.suspend` intrinsic, used to suspend execution of
/// the current thread.
pub fn thread_suspend(&mut self, cancellable: bool) -> &mut Self {
self.bytes.push(0x29);
self.bytes.push(if cancellable { 1 } else { 0 });
self.num_added += 1;
self
}
/// Declare a new `thread.resume-later` intrinsic, used to resume execution
/// of the given thread.
pub fn thread_resume_later(&mut self) -> &mut Self {
self.bytes.push(0x2a);
self.num_added += 1;
self
}
/// Declare a new `thread.yield-to` intrinsic, used to yield execution to
/// a given thread.
pub fn thread_yield_to(&mut self, cancellable: bool) -> &mut Self {
self.bytes.push(0x2b);
self.bytes.push(if cancellable { 1 } else { 0 });
self.num_added += 1;
self
}
fn encode_options<O>(&mut self, options: O) -> &mut Self

@@ -505,0 +574,0 @@ where

@@ -982,2 +982,8 @@ use crate::reencode::{Error, Reencode, RoundtripReencoder};

}
wasmparser::CanonicalFunction::BackpressureInc => {
section.backpressure_inc();
}
wasmparser::CanonicalFunction::BackpressureDec => {
section.backpressure_dec();
}
wasmparser::CanonicalFunction::TaskReturn { result, options } => {

@@ -999,4 +1005,4 @@ let options = options

}
wasmparser::CanonicalFunction::Yield { async_ } => {
section.yield_(async_);
wasmparser::CanonicalFunction::ThreadYield { cancellable } => {
section.thread_yield(cancellable);
}

@@ -1087,7 +1093,13 @@ wasmparser::CanonicalFunction::SubtaskDrop => {

}
wasmparser::CanonicalFunction::WaitableSetWait { async_, memory } => {
section.waitable_set_wait(async_, reencoder.memory_index(memory)?);
wasmparser::CanonicalFunction::WaitableSetWait {
cancellable,
memory,
} => {
section.waitable_set_wait(cancellable, reencoder.memory_index(memory)?);
}
wasmparser::CanonicalFunction::WaitableSetPoll { async_, memory } => {
section.waitable_set_poll(async_, reencoder.memory_index(memory)?);
wasmparser::CanonicalFunction::WaitableSetPoll {
cancellable,
memory,
} => {
section.waitable_set_poll(cancellable, reencoder.memory_index(memory)?);
}

@@ -1100,2 +1112,25 @@ wasmparser::CanonicalFunction::WaitableSetDrop => {

}
wasmparser::CanonicalFunction::ThreadIndex => {
section.thread_index();
}
wasmparser::CanonicalFunction::ThreadNewIndirect {
func_ty_index,
table_index,
} => {
let func_ty = reencoder.type_index(func_ty_index)?;
let table_index = reencoder.table_index(table_index)?;
section.thread_new_indirect(func_ty, table_index);
}
wasmparser::CanonicalFunction::ThreadSwitchTo { cancellable } => {
section.thread_switch_to(cancellable);
}
wasmparser::CanonicalFunction::ThreadSuspend { cancellable } => {
section.thread_suspend(cancellable);
}
wasmparser::CanonicalFunction::ThreadResumeLater => {
section.thread_resume_later();
}
wasmparser::CanonicalFunction::ThreadYieldTo { cancellable } => {
section.thread_yield_to(cancellable);
}
}

@@ -1102,0 +1137,0 @@ Ok(())