<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in wasmtime-platform.c</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>3c46362e - Refactor `sync_nostd.rs` silghtly (#11875)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c#3c46362e</link>
        <description>Refactor `sync_nostd.rs` silghtly (#11875)* Refactor `sync_nostd.rs` silghtlyModel the `#[cfg(has_custom_sync)]` distinction with modules rather than`#[cfg]` throughout the code. No fundamental change to theimplementations here, just shuffling things around.Also refactor the `wasmtime-platform.c` file to deduplicate the lazyinit of pthread primitives notably for the rwlock implementation.* Fix unused import

            List of files:
            /wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c</description>
        <pubDate>Thu, 16 Oct 2025 21:52:12 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>0dd73cc7 - feat(no_std): Add custom sync primitives support via C API (#11836)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c#0dd73cc7</link>
        <description>feat(no_std): Add custom sync primitives support via C API (#11836)* Add custom-sync-primitives feature for no_std environmentsThis adds a new `custom-sync-primitives` feature that allows embeddersto provide their own synchronization primitives through a C API. Thisis particularly useful for kernel and embedded environments that needcustom lock implementations.The implementation follows the existing pattern of `custom-virtual-memory`and `custom-native-signals`, providing host-provided implementations ofOnceLock and RwLock through callback functions defined in the C API.* assume no_std in has_custom_sync flag* updating panic on contention error messages in sync_nostd.rs* inlining free in drop in custom/sync.rs* simplifying custom/sync.rs to delegate lazy initialization to the embedder* Consolidate no_std sync implementations and add RwLock-specific C API* Minor cleanup* adding custom_sync support to min-platform example* adding multithreaded TLS using pthread to min-platform example* addressing PR comments:Remove *_new files from capi sync api.Implement Drop-based lock releasingUpdate documentation + minor changes* fixes min-platform example for sync primitivesUse heap allocation to avoid deadlock in the implementation with no heap allocation.Use compare-and-swap for lazy initialization of rw lock for thread safety.* upgrade cbindgen in CI to 0.29* undo accidental edits to cbindgen generated header file

            List of files:
            /wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c</description>
        <pubDate>Thu, 16 Oct 2025 19:01:41 +0000</pubDate>
        <dc:creator>Salman Saghafi &lt;salmans@users.noreply.github.com&gt;</dc:creator>
    </item>
<item>
        <title>192f2fcd - Replace setjmp/longjmp usage in Wasmtime (#11592)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c#192f2fcd</link>
        <description>Replace setjmp/longjmp usage in Wasmtime (#11592)Since Wasmtime&apos;s inception it&apos;s used the `setjmp` and `longjmp`functions in C to implement handling of traps. While this solution waseasy to implement, relatively portable, and performant enough, there area number of downsides that have evolved over time to make this anunattractive approach in the long run:* Using `setjmp` fundamentally requires using C because Rust does not  understand a function that returns twice. It&apos;s fundamentally unsound  to invoke `setjmp` in Rust meaning that Wasmtime has forever needed a  C compiler configured and set up to build. This notably means that  `cargo check` cannot check other targets easily.* Using `longjmp` means that Rust function frames are unwound on the  stack without running destructors. This is a dangerous operation of  which we get no protection from the compiler about. Both frames  entering wasm and frames exiting wasm are all skipped. Absolutely  minimizing this has been beneficial for portability to platforms such  as Pulley.* Currently the no_std implementation of Wasmtime requires embedders to  provide `wasmtime_{setjmp,longjmp}` which is a thorn in the side of  what is otherwise a mostly entirely independent implementation of  Wasmtime.* There is a performance floor to using `setjmp` and `longjmp`. Calling  `setjmp` requires using C but Wasmtime is otherwise written in Rust  meaning that there&apos;s a Rust-&gt;C-&gt;Rust-&gt;Wasm boundary which  fundamentally can&apos;t be inlined without cross-language LTO which is  difficult to configure.* With the implementation of the WebAssembly exceptions proposal  Wasmtime now has two means of unwinding the stack. Ideally Wasmtime  would only have one, and the more general one is the method of  exceptions.* Jumping out of a signal handler on Unix is tricky business. While  we&apos;ve made it work it&apos;s generally most robust of the signal handler  simply returns which it now does.With all of that in mind the purpose of this commit is to replace thesetjmp/longjmp mechanism of handling traps with the recently implementedsupport for exceptions in Cranelift. That is intended to resolve all ofthe above points in one swoop.One point in particular though that&apos;s nice about setjmp/longjmp is thatunwinding the stack on a trap is an O(1) operation. For situations suchas stack overflow that&apos;s a particularly nice property to have as we canguarantee embedders that traps are a constant time (albeit somewhatexpensive with signals) operation. Exceptions naively require unwindingthe entire stack, and although frame pointers mean we&apos;re just traversinga linked list I wanted to preserve the O(1) property here nonetheless.To achieve this a solution is implemented where the array-to-wasm(host-to-wasm) trampolines setup state in `VMStoreContext` so looking upthe current trap handler frame is an O(1) operation. Namely the sp/fp/pcvalues for a `Handler` are stored inline.Implementing this feature required supportingrelocations-to-offsets-in-functions which was not previously supportedby Wasmtime. This required Cranelift refactorings such as #11570, #11585,and #11576. This then additionally required some more refactoring inthis commit which was difficult to split out as it otherwise wouldn&apos;t betested.Apart from the relocation-related business much of this change is aboutupdating the platform signal handlers to use exceptions instead oflongjmp to return. For example on Unix this means updating the`ucontext_t` with register values that the handler specifies. Windowsinvolves updating similar contexts, and macOS mach ports ended up notneeding too many changes.In terms of overall performance the relevant benchmark from thisrepository, compared to before this commit, is:    sync/no-hook/core - host-to-wasm - typed - nop			    time:   [10.552 ns 10.561 ns 10.571 ns]			    change: [&#8722;7.5238% &#8722;7.4011% &#8722;7.2786%] (p = 0.00 &lt; 0.05)			    Performance has improved.Closes #3927cc #10923prtest:full

            List of files:
            /wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c</description>
        <pubDate>Mon, 08 Sep 2025 14:33:31 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>7f9049b9 - Replace `signals-based-traps` with auto-detection (#9941)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c#7f9049b9</link>
        <description>Replace `signals-based-traps` with auto-detection (#9941)* Replace `signals-based-traps` with auto-detectionThis commit refactors the platform support of the `wasmtime` crateitself to remove the previously added `signals-based-traps` feature infavor of auto-detecting whether it&apos;s there or not. The `build.rs`script for the `wasmtime` crate will now detect the target platform andauto-enable this feature as necessary.The `signals-based-traps` cargo feature is removed and split into twocustom `#[cfg]` directives that the build script sets:* `has_virtual_memory` - this is used to gate mmap implementations for  example. This is enabled on `unix || windows` and will be off for  `no_std` targets for example. This is split out of  &quot;signals-based-traps&quot; to better handle platforms like iOS which have  virtual memory but don&apos;t execute native code (removing the need for  native signals).* `has_native_signals` - gates signal handlers on Unix for example. This  is disabled on MIRI but otherwise enabled for `unix || windows`. This  is intended to in the future get disabled for iOS by default for  example since it&apos;s not necessary when using Pulley. This is  additionally off-by-default for `no_std` platforms.Two new crate features were added for `no_std` or &quot;custom&quot; platforms toopt-in to the `wasmtime-platform.h` C APIs for implementing virtualmemory and signals. These are used in the `min-platform` embedding example.This commit additionally updates some various documentation here andthere to be more up-to-date.* Update CI configuration* Fix compile warnings* Fix test on miri* Fix more tests on miri* Fix some warnings* Another round of miri/CI attempts/fixesprtest:full

            List of files:
            /wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c</description>
        <pubDate>Wed, 15 Jan 2025 01:15:14 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>66910067 - Update the host ABI of Wasmtime to return failure (#9675)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c#66910067</link>
        <description>Update the host ABI of Wasmtime to return failure (#9675)* Update the host ABI of Wasmtime to return failureThis commit updates the &quot;array call&quot; ABI of Wasmtime used to transitionfrom wasm to the host to explicitly return a `bool` indicating whetherthe call succeeded or not. Previously functions would implicitly unwindvia `longjmp` and thus no explicit checks were necessary. The burden ofunwinding is now placed on Cranelift-compiled code itself instead of thecaller.There are a few pieces of rationale for this change:* Primarily I was implementing initial integration of Pulley where the  host `setjmp` and `longjmp` cannot be used to maintain the Pulley  interpreter state. My initial plan for handling this was to handle  traps a bit differently in Pulley where having direct access to  whether a function trapped or not in the interpreter bytecode is  easier to deal with.* Additionally it&apos;s generally not safe to call `longjmp` from Rust as it  will not run on-stack destructors. This is ok today in the sense that  we shouldn&apos;t have these in Wasmtime, but directly returning to  compiled code improves our safety story here a bit where we just won&apos;t  have to deal with the problem of skipping destructors.* In the future I&apos;d like to move away from `setjmp` and `longjmp`  entirely in the host to a Cranelift-native solution. This change would  be required for such a migration anyway so it&apos;s my hope to make such a  Cranelift-based implementation easier in the future. This might be  necessary, for example, when implementing the `exception-handling`  proposal for Wasmtime.Functionally this commit does not remove all usages ofcall-`longjmp`-from-Rust. Notably all libcalls and builtins still usethis helper in the trampolines generated in Rust. I plan on goingthrough the libcalls and updating their ABIs and signatures to reflectthis in follow-up commits. As a result a few preexisting functions thatshould go away are marked `#[deprecated]` for internal use in thiscommit. I&apos;ll be cleaning that up as follow-ups. For now this commithandles the &quot;hard part&quot; of host functions by ensuring that the new`bool` return value is plumbed in all the locations correctly.prtest:full* Hack around Windows MinGW miscompile (?)* Run clang-format

            List of files:
            /wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c</description>
        <pubDate>Tue, 26 Nov 2024 22:27:47 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>d3132c9d - Add a `signals-based-traps` Cargo compile-time feature (#9614)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c#d3132c9d</link>
        <description>Add a `signals-based-traps` Cargo compile-time feature (#9614)* Gate signal handlers behind a new Cargo featureThis commit adds a new on-by-default Cargo feature to the `wasmtime`crate named `signals-based-traps`. This is modeled after the`Config::signals_based_traps` configuration at runtime and can be usedto statically disable the use of signal handlers in Wasmtime. Thisnotably reduces the number of platform dependencies that Wasmtime hasand provides a mode of avoiding relying on signals altogether.This introduces a new `MallocMemory` which is a linear memory backed bythe system allocator. This new type of memory is enabled when virtualmemory guards are disabled and signals-based-traps are disabled. Thismeans that this new type of memory will be candidate for fuzzing forexample.prtest:full* Fix rebase conflict* Refactor `MmapVec` documentation and representation* Remove no-longer-needed `Arc`* Document it may be backed by `Vec&lt;u8&gt;`

            List of files:
            /wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c</description>
        <pubDate>Tue, 19 Nov 2024 19:21:36 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>81a89169 - Add support for `#![no_std]` to the `wasmtime` crate (#8533)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c#81a89169</link>
        <description>Add support for `#![no_std]` to the `wasmtime` crate (#8533)* Always fall back to custom platform for WasmtimeThis commit updates Wasmtime&apos;s platform support to no longer require anopt-in `RUSTFLAGS` `--cfg` flag to be specified. With `no_std` becomingofficially supported this should provide a better onboarding experiencewhere the fallback custom platform is used. This will cause linkererrors if the symbols aren&apos;t implemented and searching/googling shouldlead back to our docs/repo (eventually, hopefully).* Change Wasmtime&apos;s TLS state to a single pointerThis commit updates the management of TLS to rely on just a singlepointer rather than a pair of a pointer and a `bool`. Additionallymanagement of the TLS state is pushed into platform-specific modules toenable different means of managing it, namely the &quot;custom&quot; platform nowhas a C function required to implement TLS state for Wasmtime.* Delay conversion to `Instant` in atomic intrinsicsThe `Duration` type is available in `no_std` but the `Instant` type isnot. The intention is to only support the `threads` proposal if `std` isactive but to assist with this split push the `Duration` further intoWasmtime to avoid using a type that can&apos;t be mentioned in `no_std`.* Gate more parts of Wasmtime on the `profiling` featureMove `serde_json` to an optional dependency and gate the guest profilerentirely on the `profiling` feature.* Refactor conversion to `anyhow::Error` in `wasmtime-environ`Have a dedicated trait for consuming `self` in addition to a`Result`-friendly trait.* Gate `gimli` in Wasmtime on `addr2line`Cut down the dependency list if `addr2line` isn&apos;t enabled since thenthe dependency is not used. While here additionally lift the versionrequirement for `addr2line` up to the workspace level.* Update `bindgen!` to have `no_std`-compatible outputPull most types from Wasmtime&apos;s `__internal` module as the source oftruth.* Use an `Option` for `gc_store` instead of `OnceCell`No need for synchronization here when mutability is already available inthe necessary contexts.* Enable embedder-defined host feature detection* Add `#![no_std]` support to the `wasmtime` crateThis commit enables compiling the `runtime`, `gc`, and `component-model`features of the `wasmtime` crate on targets that do not have `std`. Thistags the crate as `#![no_std]` and then updates everything internally toimport from `core` or `alloc` and adapt for the various idioms. Thisended up requiring some relatively extensive changes, but nothing tootoo bad in the grand scheme of things.* Require `std` for the perfmap profiling agentprtest:full* Fix build on wasm* Fix windows build* Remove unused import* Fix Windows/Unix build without `std` feature* Fix some doc links* Remove unused import* Fix build of wasi-common in isolation* Fix no_std build on macos* Re-fix build* Fix standalone build of wasmtime-cli-flags* Resolve a merge conflict* Review comments* Remove unused import

            List of files:
            /wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c</description>
        <pubDate>Sat, 04 May 2024 22:02:26 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>b81bb7a3 - Add a &quot;custom&quot; platform configuration for Wasmtime (#7995)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c#b81bb7a3</link>
        <description>Add a &quot;custom&quot; platform configuration for Wasmtime (#7995)* Add a &quot;custom&quot; platform configuration for WasmtimeThis commit leverages adds a new &quot;platform&quot; to Wasmtime to be supportedin the `crates/runtime/src/sys` folder. This joins preexisting platformssuch as Unix and Windows. The goal of this platform is to be an opt-inway to build Wasmtime for targets that don&apos;t have a predefined way torun.The new &quot;custom&quot; platform requires `--cfg wasmtime_custom_platform` tobe passed to the Rust compiler, for example by using `RUSTFLAGS`. Thisnew platform bottoms out in a C API that is intended to be small andLinux-like. The C API is effectively the interface to virtual memorythat Wasmtime requires. This C API is also available as a header file at`examples/min-platform/embedding/wasmtime-platform.h` (generated by`cbindgen`).The main purpose of this is to make it easier to experiment with portingWasmtime to new platforms. By decoupling a platform implementation fromWasmtime itself it should be possible to run these experimentsout-of-tree. An example of this I&apos;ve been working on is gettingWasmtime running on bare-metal with a custom kernel. This supportenables defining the platform interface of the custom kernel&apos;s syscallsoutside of Wasmtime.* Exclude wasmtime-platform.h from formatting* Include build-wasmtime-target-wasm32 in final job* Don&apos;t force any single toolchain* Add notes to no_std docs* Add rust-src to CI* Review comments* Change APIs to be fallible* Only compile the min-platform example on Linux* Fix compile of min-platform example* Fix another compile error in the example

            List of files:
            /wasmtime-44.0.1/examples/min-platform/embedding/wasmtime-platform.c</description>
        <pubDate>Wed, 28 Feb 2024 20:23:33 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
</channel>
</rss>
