<?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 externref.rs</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>cc8d04f4 - Remove need for explicit `Config::async_support` knob  (#12371)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#cc8d04f4</link>
        <description>Remove need for explicit `Config::async_support` knob  (#12371)* Refactor component model host function definitionsPush the `async`-ness down one layer.* Remove need for explicit `Config::async_support` knobThis commit is an attempt to step towards reconciling &quot;old async&quot; and&quot;new async&quot; in Wasmtime. The old async style is the original asyncsupport in Wasmtime with `call_async`, `func_wrap_async`, etc, where themain property is that the store is &quot;locked&quot; during an async operation.Put another way, a store can only execute at most one async operation ata time. This is in contrast to &quot;new async&quot; support in Wasmtime with thecomponent-model-async (WASIp3) support, where stores can have more thanone async operation in flight at once.This commit does not fully reconcile these differences, but it doesremove one hurdle along the way: `Config::async_support`. Since thebeginning of Wasmtime this configuration knob has existed to explicitlydemarcate a config/engine/store as &quot;this thing requires `async` stuffinternally.&quot; This has started to make less and less sense over timewhere the line between sync and async has become more murky with WASIp3where the two worlds comingle. The goal of this commit is to deprecate`Config::async_support` and make the function not actually do anything.In isolation this can&apos;t simply be done, however, because there are manyload-bearing aspects of Wasmtime that rely on this `async_support` knob.For example once epochs + yielding are enabled it&apos;s required that allWasm is executed on a fiber lest it hit an epoch and not know how toyield. That means that this commit is not a simple removal of`async_support` but instead a refactoring/rearchitecting of how async isused internally within Wasmtime. The high-level ideas within Wasmtimenow are:* A `Store` has a &quot;requires async&quot; boolean stored within it.* All configuration options which end up requiring async, such as  yielding with epochs, turn this boolean on.* Creation of host functions which use async  (e.g. `func_wrap_{async,concurrent}`) will also turn this option on.* Synchronous API entrypoints into Wasmtime ensure that this boolean is  disabled.* Asynchronous APIs are usable at any time.This means that the concept of an async store vs a sync store is nowgone. All stores are equally capable of executing sync/async, and thechange now is that dynamically some stores will require that async isused with certain configuration. Additionally all panicking conditionsaround `async_support` have been converted to errors instead. Allrelevant APIs already returned an error and things are murky enough nowthat it&apos;s not necessarily trivial to get this right at the embedderlevel. In the interest of avoiding panics all detected async mismatchesare now first-class `wasmtime::Error` values.The end result of this commit is that `Config::async_support` is adeprecated `#[doc(hidden)]` function that does nothing. While manyinternal changes happened as well as having new tests for all this sortof behavior this is not expected to have a great impact on externalconsumers. In general a deletion of `async_support(true)` is in theoryall that&apos;s required. This is intended to make it easier to think aboutasync/sync/etc in the future with WASIp3 and eventually reconcile`func_wrap_async` and `func_wrap_concurrent` for example. That&apos;s leftfor future refactorings however.prtest:full* Review comments* Fix CI failures

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Fri, 23 Jan 2026 02:46:45 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>90ac295e - Update Wasmtime to the 2024 Rust Edition (#10806)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#90ac295e</link>
        <description>Update Wasmtime to the 2024 Rust Edition (#10806)* Update Wasmtime to the 2024 Rust EditionNow that our MSRV supports the 2024 edition it&apos;s possible to make thisswitch. This commit moves Wasmtime to the 2024 Edition to keepup-to-date with Rust idioms and access many of the edition featuresexclusive to the 2024 edition.prtest:full* Reformat with the 2024 edition

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Mon, 19 May 2025 16:40:55 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>c22b3cb9 - Reuse Wasm linear memories code for GC heaps (#10503)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#c22b3cb9</link>
        <description>Reuse Wasm linear memories code for GC heaps (#10503)* Reuse code for Wasm linear memories for GC heapsInstead of bespoke code paths and structures for Wasm GC, this commit makes itso that we now reuse VM structures like `VMMemoryDefinition` and bounds-checkinglogic. Notably, we also reuse all the associated bounds-checking optimizationsand, when possible, virtual-memory techniques to completely elide them.Furthermore, this commit adds support for growing GC heaps, reusing themachinery for growing memories, and makes it so that GC heaps always start outempty. This allows us to properly delay allocating the GC heap&apos;s storage until aGC object is actually allocated.Fixes #9350* fix c api compilation* use assert_contains* remove no-longer-necessary extra memory config from limiter tests* Helper for retry-after-maybe-async-gc in libcalls* Clean up some comments* fix wasmtime-fuzzing and no-gc compilation* fix examples* fix no-gc+compiler build* fix build without pooling allocator* fix +cranelift +gc-drc -gc-null builds* fix table hash key stability test* fix oracle usage of `ExternRef::new`* fix +gc -gc-null -gc-drc build* fix wasmtime-fuzzing* make `StorePtr` wrap a `NonNull`* Fix some doc tests* Remove some unnecessary retry helpers now that `FooRef::new` will auto-gc* fix things after rebase* Reorganize collection/growth methods for GC heap* rename BoundsCheck variants* fix cfg&apos;ing of gc only code* Fix doc tests* fix one more gc cfg* disable GC heap OOM test on non-64-bit targets

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Fri, 11 Apr 2025 21:15:55 +0000</pubDate>
        <dc:creator>Nick Fitzgerald &lt;fitzgen@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>12c20b22 - Implement the Wasm GC instructions for converting between `anyref` and `externref` (#9435)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#12c20b22</link>
        <description>Implement the Wasm GC instructions for converting between `anyref` and `externref` (#9435)* Implement the Wasm GC instructions for converting between `anyref` and `externref`This commit implements two instructions:1. `any.convert_extern`2. `extern.convert_any`These instructions are used to convert between `anyref` and `externref`values. The `any.convert_extern` instruction takes an `anyref` value andconverts it to an `externref` value. The `extern.convert_any` instruction takesan `externref` value and converts it to an `anyref` value.Rather than implementing wrapper objects -- for example an `structAnyOfExtern(ExternRef)` type that is a subtype of `AnyRef` -- we instead reusethe same representation converted references as their unconverted reference. Forexample, `(any.convert_extern my_externref)` is identical to the original`my_externref` value. This means that we don&apos;t actually emit any clifinstructions to implement these Wasm instructions; they are no-ops!Wasm code remains none-the-wiser because it cannot directly test for thedifference between, for example, a `my_anyref` and the result of`(extern.convert_any my_anyref)` because they are in two different typehierarchies, so any direct `ref.test` would be invalid. The Wasm code would haveto convert one into the other&apos;s type hierarchy, at which point it doesn&apos;t knowwhether wrapping/unwrapping took place.We did need some changes at the host API and host API implementation levels,however:* We needed to relax the requirement that a `wasmtime::AnyRef` only wraps a  `VMGcRef` that points to an object that is a subtype of `anyref` and similar for  `wasmtime::ExternRef`.* We needed to make the `wasmtime::ExternRef::data[_mut]` methods return an  option of their associated host data, since any `externref` resulting from  `(extern.convert_any ...)` does not have any associated host data. (This change  would have been required either way, even if we used wrapper objects.)* fix tests* fix wasmtime-environ tests

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Thu, 10 Oct 2024 14:41:22 +0000</pubDate>
        <dc:creator>Nick Fitzgerald &lt;fitzgen@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>a0442ea0 - Enforce `uninlined_format_args` for the workspace (#9065)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#a0442ea0</link>
        <description>Enforce `uninlined_format_args` for the workspace (#9065)* Enforce `uninlined_format_args` for the workspace* fix: failing `Monolith Checks` job* fix: formatting

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Mon, 05 Aug 2024 09:59:59 +0000</pubDate>
        <dc:creator>Hamir Mahal &lt;hamirmahal@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>0fa13013 - Add `GcRuntime` and `GcCompiler` traits; `i31ref` support (#8196)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#0fa13013</link>
        <description>Add `GcRuntime` and `GcCompiler` traits; `i31ref` support (#8196)\### The `GcRuntime` and `GcCompiler` TraitsThis commit factors out the details of the garbage collector away from the restof the runtime and the compiler. It does this by introducing two new traits,very similar to a subset of [those proposed in the Wasm GC RFC], although notall equivalent functionality has been added yet because Wasmtime doesn&apos;tsupport, for example, GC structs yet:[those proposed in the Wasm GC RFC]: https://github.com/bytecodealliance/rfcs/blob/main/accepted/wasm-gc.md#defining-the-pluggable-gc-interface1. The `GcRuntime` trait: This trait defines how to create new GC heaps, run   collections within them, and execute the various GC barriers the collector   requires.   Rather than monomorphize all of Wasmtime on this trait, we use it   as a dynamic trait object. This does imply some virtual call overhead and   missing some inlining (and resulting post-inlining) optimization   opportunities. However, it is *much* less disruptive to the existing embedder   API, results in a cleaner embedder API anyways, and we don&apos;t believe that VM   runtime/embedder code is on the hot path for working with the GC at this time   anyways (that would be the actual Wasm code, which has inlined GC barriers   and direct calls and all of that). In the future, once we have optimized   enough of the GC that such code is ever hot, we have options we can   investigate at that time to avoid these dynamic virtual calls, like only   enabling one single collector at build time and then creating a static type   alias like `type TheOneGcImpl = ...;` based on the compile time   configuration, and using this type alias in the runtime rather than a dynamic   trait object.   The `GcRuntime` trait additionally defines a method to reset a GC heap, for   use by the pooling allocator. This allows reuse of GC heaps across different   stores. This integration is very rudimentary at the moment, and is missing   all kinds of configuration knobs that we should have before deploying Wasm GC   in production. This commit is large enough as it is already! Ideally, in the   future, I&apos;d like to make it so that GC heaps receive their memory region,   rather than allocate/reserve it themselves, and let each slot in the pooling   allocator&apos;s memory pool be *either* a linear memory or a GC heap. This would   unask various capacity planning questions such as &quot;what percent of memory   capacity should we dedicate to linear memories vs GC heaps?&quot;. It also seems   like basically all the same configuration knobs we have for linear memories   apply equally to GC heaps (see also the &quot;Indexed Heaps&quot; section below).2. The `GcCompiler` trait: This trait defines how to emit CLIF that implements   GC barriers for various operations on GC-managed references. The Rust code   calls into this trait dynamically via a trait object, but since it is   customizing the CLIF that is generated for Wasm code, the Wasm code itself is   not making dynamic, indirect calls for GC barriers. The `GcCompiler`   implementation can inline the parts of GC barrier that it believes should be   inline, and leave out-of-line calls to rare slow paths.All that said, there is still only a single implementation of each of thesetraits: the existing deferred reference-counting (DRC) collector. So there is abunch of code motion in this commit as the DRC collector was further isolatedfrom the rest of the runtime and moved to its own submodule. That said, this wasnot *purely* code motion (see &quot;Indexed Heaps&quot; below) so it is worth not simplyskipping over the DRC collector&apos;s code in review.\### Indexed HeapsThis commit does bake in a couple assumptions that must be shared across allcollector implementations, such as a shared `VMGcHeader` that all objectsallocated within a GC heap must begin with, but the most notable andfar-reaching of these assumptions is that all collectors will use &quot;indexedheaps&quot;.What we are calling indexed heaps are basically the three following invariants:1. All GC heaps will be a single contiguous region of memory, and all GC objects   will be allocated within this region of memory. The collector may ask the   system allocator for additional memory, e.g. to maintain its free lists, but   GC objects themselves will never be allocated via `malloc`.2. A pointer to a GC-managed object (i.e. a `VMGcRef`) is a 32-bit offset into   the GC heap&apos;s contiguous region of memory. We never hold raw pointers to GC   objects (although, of course, we have to compute them and use them   temporarily when actually accessing objects). This means that deref&apos;ing GC   pointers is equivalent to deref&apos;ing linear memory pointers: we need to add a   base and we also check that the GC pointer/index is within the bounds of the   GC heap. Furthermore, compressing 64-bit pointers into 32 bits is a fairly   common technique among high-performance GC   implementations[^compressed-oops][^v8-ptr-compression] so we are in good   company.3. Anything stored inside the GC heap is untrusted. Even each GC reference that   is an element of an `(array (ref any))` is untrusted, and bounds checked on   access. This means that, for example, we do not store the raw pointer to an   `externref`&apos;s host object inside the GC heap. Instead an `externref` now   stores an ID that can be used to index into a side table in the store that   holds the actual `Box&lt;dyn Any&gt;` host object, and accessing that side table is   always checked.[^compressed-oops]: See [&quot;Compressed OOPs&quot; in    OpenJDK.](https://wiki.openjdk.org/display/HotSpot/CompressedOops)[^v8-ptr-compression]: See [V8&apos;s pointer    compression](https://v8.dev/blog/pointer-compression).The good news with regards to all the bounds checking that this scheme impliesis that we can use all the same virtual memory tricks that linear memories useto omit explicit bounds checks. Additionally, (2) means that the sizes of GCobjects is that much smaller (and therefore that much more cache friendly)because they are only holding onto 32-bit, rather than 64-bit, references toother GC objects. (We can, in the future, support GC heaps up to 16GiB in sizewithout losing 32-bit GC pointers by taking advantage of `VMGcHeader` alignmentand storing aligned indices rather than byte indices, while still leaving thebottom bit available for tagging as an `i31ref` discriminant. Should we everneed to support even larger GC heap capacities, we could go to full 64-bitreferences, but we would need explicit bounds checks.)The biggest benefit of indexed heaps is that, because we are (explicitly orimplicitly) bounds checking GC heap accesses, and because we are not otherwisetrusting any data from inside the GC heap, we greatly reduce how badly thingscan go wrong in the face of collector bugs and GC heap corruption. We areessentially sandboxing the GC heap region, the same way that linear memory is asandbox. GC bugs could lead to the guest program accessing the wrong GC object,or getting garbage data from within the GC heap. But only garbage data fromwithin the GC heap, never outside it. The worse that could happen would be if wedecided not to zero out GC heaps between reuse across stores (which is a validtrade off to make, since zeroing a GC heap is a defense-in-depth techniquesimilar to zeroing a Wasm stack and not semantically visible in the absence ofGC bugs) and then a GC bug would allow the current Wasm guest to read old GCdata from the old Wasm guest that previously used this GC heap. But again, itcould never access host data.Taken altogether, this allows for collector implementations that are nearly freefrom `unsafe` code, and unsafety can otherwise be targeted and limited in scope,such as interactions with JIT code. Most importantly, we do not have to maintaincritical invariants across the whole system -- invariants which can&apos;t be nicelyencapsulated or abstracted -- to preserve memory safety. Such holisticinvariants that refuse encapsulation are otherwise generally a huge safetyproblem with GC implementations.\### `VMGcRef` is *NOT* `Clone` or `Copy` Anymore`VMGcRef` used to be `Clone` and `Copy`. It is not anymore. The motivation herewas to be sure that I was actually calling GC barriers at all the correctplaces. I couldn&apos;t be sure before. Now, you can still explicitly copy a raw GCreference without running GC barriers if you need to and understand why that&apos;sokay (aka you are implementing the collector), but that is something you have toopt into explicitly by calling `unchecked_copy`. The default now is that youcan&apos;t just copy the reference, and instead call an explicit `clone` method (not*the* `Clone` trait, because we need to pass in the GC heap context to run theGC barriers) and it is hard to forget to do that accidentally. This resulted ina pretty big amount of churn, but I am wayyyyyy more confident that the correctGC barriers are called at the correct times now than I was before.\### `i31ref`I started this commit by trying to add `i31ref` support. And it grew into thewhole traits interface because I found that I needed to abstract GC barriersinto helpers anyways to avoid running them for `i31ref`s, so I figured that Imight as well add the whole traits interface. In comparison, `i31ref` support ismuch easier and smaller than that other part! But it was also difficult to pullapart from this commit, sorry about that!---------------------Overall, I know this is a very large commit. I am super happy to have somesynchronous meetings to walk through this all, give an overview of thearchitecture, answer questions directly, etc... to make review easier!prtest:full

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Thu, 04 Apr 2024 00:24:50 +0000</pubDate>
        <dc:creator>Nick Fitzgerald &lt;fitzgen@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>bd2ea901 - Define garbage collection rooting APIs (#8011)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#bd2ea901</link>
        <description>Define garbage collection rooting APIs (#8011)* Define garbage collection rooting APIsRooting prevents GC objects from being collected while they are actively beingused.We have a few sometimes-conflicting goals with our GC rooting APIs:1. Safety: It should never be possible to get a use-after-free bug because the   user misused the rooting APIs, the collector &quot;mistakenly&quot; determined an   object was unreachable and collected it, and then the user tried to access   the object. This is our highest priority.2. Moving GC: Our rooting APIs should moving collectors (such as generational   and compacting collectors) where an object might get relocated after a   collection and we need to update the GC root&apos;s pointer to the moved   object. This means we either need cooperation and internal mutability from   individual GC roots as well as the ability to enumerate all GC roots on the   native Rust stack, or we need a level of indirection.3. Performance: Our rooting APIs should generally be as low-overhead as   possible. They definitely shouldn&apos;t require synchronization and locking to   create, access, and drop GC roots.4. Ergonomics: Our rooting APIs should be, if not a pleasure, then at least not   a burden for users. Additionally, the API&apos;s types should be `Sync` and `Send`   so that they work well with async Rust.For example, goals (3) and (4) are in conflict when we think about how tosupport (2). Ideally, for ergonomics, a root would automatically unroot itselfwhen dropped. But in the general case that requires holding a reference to thestore&apos;s root set, and that root set needs to be held simultaneously by all GCroots, and they each need to mutate the set to unroot themselves. That implies`Rc&lt;RefCell&lt;...&gt;&gt;` or `Arc&lt;Mutex&lt;...&gt;&gt;`! The former makes the store and GC roottypes not `Send` and not `Sync`. The latter imposes synchronization and lockingoverhead. So we instead make GC roots indirect and require passing in a storecontext explicitly to unroot in the general case. This trades worse ergonomicsfor better performance and support for moving GC and async Rust.Okay, with that out of the way, this module provides two flavors of rootingAPI. One for the common, scoped lifetime case, and another for the rare casewhere we really need a GC root with an arbitrary, non-LIFO/non-scoped lifetime:1. `RootScope` and `Rooted&lt;T&gt;`: These are used for temporarily rooting GC   objects for the duration of a scope. Upon exiting the scope, they are   automatically unrooted. The internal implementation takes advantage of the   LIFO property inherent in scopes, making creating and dropping `Rooted&lt;T&gt;`s   and `RootScope`s super fast and roughly equivalent to bump allocation.   This type is vaguely similar to V8&apos;s [`HandleScope`].   [`HandleScope`]: https://v8.github.io/api/head/classv8_1_1HandleScope.html   Note that `Rooted&lt;T&gt;` can&apos;t be statically tied to its context scope via a   lifetime parameter, unfortunately, as that would allow the creation and use   of only one `Rooted&lt;T&gt;` at a time, since the `Rooted&lt;T&gt;` would take a borrow   of the whole context.   This supports the common use case for rooting and provides good ergonomics.2. `ManuallyRooted&lt;T&gt;`: This is the fully general rooting API used for holding   onto non-LIFO GC roots with arbitrary lifetimes. However, users must manually   unroot them. Failure to manually unroot a `ManuallyRooted&lt;T&gt;` before it is   dropped will result in the GC object (and everything it transitively   references) leaking for the duration of the `Store`&apos;s lifetime.   This type is roughly similar to SpiderMonkey&apos;s [`PersistentRooted&lt;T&gt;`],   although they avoid the manual-unrooting with internal mutation and shared   references. (Our constraints mean we can&apos;t do those things, as mentioned   explained above.)   [`PersistentRooted&lt;T&gt;`]: http://devdoc.net/web/developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS::PersistentRooted.htmlAt the end of the day, both `Rooted&lt;T&gt;` and `ManuallyRooted&lt;T&gt;` are just taggedindices into the store&apos;s `RootSet`. This indirection allows working with Rust&apos;sborrowing discipline (we use `&amp;mut Store` to represent mutable access to the GCheap) while still allowing rooted references to be moved around without tying upthe whole store in borrows. Additionally, and crucially, this indirection allowsus to update the *actual* GC pointers in the `RootSet` and support moving GCs(again, as mentioned above).* Reorganize GC-related submodules in `wasmtime-runtime`* Reorganize GC-related submodules in `wasmtime`* Use `Into&lt;StoreContext[Mut]&lt;&apos;a, T&gt;` for `Externref::data[_mut]` methods* Run rooting tests under MIRI* Make `into_abi` take an `AutoAssertNoGc`* Don&apos;t use atomics to update externref ref counts anymore* Try to make lifetimes/safety more-obviously correctRemove some transmute methods, assert that `VMExternRef`s are the only valid`VMGcRef`, etc.* Update extenref constructor examples* Make `GcRefImpl::transmute_ref` a non-default trait method* Make inline fast paths for GC LIFO scopes* Make `RootSet::unroot_gc_ref` an `unsafe` function* Move Hash and Eq for Rooted, move to impl methods* Remove type parameter from `AutoAssertNoGc`Just wrap a `&amp;mut StoreOpaque` directly.* Make a bunch of internal `ExternRef` methods that deal with raw `VMGcRef`s take `AutoAssertNoGc` instead of `StoreOpaque`* Fix compile after rebase* rustfmt* revert unrelated egraph changes* Fix non-gc build* Mark `AutoAssertNoGc` methods inline* review feedback* Temporarily remove externref support from the C APIUntil we can add proper GC rooting.* Remove doxygen reference to temp deleted function* Remove need to `allow(private_interfaces)`* Fix call benchmark compilation

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Wed, 06 Mar 2024 00:40:02 +0000</pubDate>
        <dc:creator>Nick Fitzgerald &lt;fitzgen@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>9ce3ffe1 - Update some CI dependencies (#7983)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#9ce3ffe1</link>
        <description>Update some CI dependencies (#7983)* Update some CI dependencies* Update to the latest nightly toolchain* Update mdbook* Update QEMU for cross-compiled testing* Update `cargo nextest` for usage with MIRIprtest:full* Remove lots of unnecessary imports* Downgrade qemu as 8.2.1 seems to segfault* Remove more imports* Remove unused winch trait method* Fix warnings about unused trait methods* More unused imports* More unused imports

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Thu, 22 Feb 2024 23:54:03 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>ff93bce0 - Wasmtime: Finish support for the typed function references proposal (#7943)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#ff93bce0</link>
        <description>Wasmtime: Finish support for the typed function references proposal (#7943)* Wasmtime: Finish support for the typed function references proposalWhile we supported the function references proposal inside Wasm, we didn&apos;tsupport it on the &quot;outside&quot; in the Wasmtime embedder APIs. So much of the workhere is exposing typed function references, and their type system updates, inthe embedder API. These changes include:* `ValType::FuncRef` and `ValType::ExternRef` are gone, replaced with the  introduction of the `RefType` and `HeapType` types and a  `ValType::Ref(RefType)` variant.* `ValType` and `FuncType` no longer implement `Eq` and `PartialEq`. Instead  there are `ValType::matches` and `FuncType::matches` methods which check  directional subtyping. I also added `ValType::eq` and `FuncType::eq` static  methods for the rare case where someone needs to check precise equality, but  that is almost never actually the case, 99.99% of the time you want to check  subtyping.* There are also public `Val::matches_ty` predicates for checking if a value is  an instance of a type, as well as internal helpers like  `Val::ensure_matches_ty` that return a formatted error if the value does not  match the given type. These helpers are used throughout Wasmtime internals  now.* There is now a dedicated `wasmtime::Ref` type that represents reference  values. Table operations have been updated to take and return `Ref`s rather  than `Val`s.Furthermore, this commit also includes type registry changes to correctly managelifetimes of types that reference other types. This wasn&apos;t previously an issuebecause the only thing that could reference types that reference other types wasa Wasm module that added all the types that could reference each other at thesame time and removed them all at the same time. But now that the previouslydiscussed work to expose these things in the embedder API is done, type lifetimemanagement in the registry becomes a little trickier because the embedder mightgrab a reference to a type that references another type, and then unload theWasm module that originally defined that type, but then the user should still beable use that type and the other types it transtively references. Before, wewere refcounting individual registry entries. Now, we still are refcountingindividual entries, but now we are also accounting for type-to-type referencesand adding a new type to the registry will increment the refcounts of each ofthe types that it references, and removing a type from the registry willdecrement the refcounts of each of the types it references, and then recursively(logically, not literally) remove any types whose refcount has now reached zero.Additionally, this PR adds support for subtyping to `Func::typed`- and`Func::wrap`-style APIs. For result types, you can always use a supertype of theWebAssembly function&apos;s actual declared return type in `Func::typed`. And forparam types, you can always use a subtype of the Wasm function&apos;s actual declaredparam type. Doing these things essentially erases information but is alwayscorrect. But additionally, for functions which take a reference to a concretetype as a parameter, you can also use the concrete type&apos;s supertype. Consider aWebAssembly function that takes a reference to a function with a concrete type:`(ref null &lt;func type index&gt;)`. In this scenario, there is no static`wasmtime::Foo` Rust type that corresponds to that particular Wasm-definedconcrete reference type because Wasm modules are loaded dynamically atruntime. You *could* do `f.typed::&lt;Option&lt;NoFunc&gt;, ()&gt;()`, and while that iscorrectly typed and valid, it is often overly restrictive. The only value youcould call the resulting typed function with is the null function reference, butwe&apos;d like to call it with non-null function references that happen to be of thecorrect type. Therefore, `f.typed&lt;Option&lt;Func&gt;, ()&gt;()` is also allowed in thiscase, even though `Option&lt;Func&gt;` represents `(ref null func)` which is thesupertype, not subtype, of `(ref null &lt;func type index&gt;)`. This does imply someminimal dynamic type checks in this case, but it is supported for betterergonomics, to enable passing non-null references into the function.We can investigate whether it is possible to use generic type parameters andcombinators to define Rust types that precisely match concrete reference typesin future, follow-up pull requests. But for now, we&apos;ve made things usable, atleast.Finally, this also takes the first baby step towards adding support for the WasmGC proposal. Right now the only thing that is supported is `nofunc` references,and this was mainly to make testing function reference subtyping easier. Butthat does mean that supporting `nofunc` references entailed also adding a`wasmtime::NoFunc` type as well as the `Config::wasm_gc(enabled)` knob. So weofficially have an in-progress implementation of Wasm GC in Wasmtime after thisPR lands!Fixes https://github.com/bytecodealliance/wasmtime/issues/6455* Fix WAT in test to be valid* Check that dependent features are enabled for function-references and GC* Remove unnecessary engine parameters from a few methodsEver since `FuncType`&apos;s internal `RegisteredType` holds onto its own `Engine`,we don&apos;t need these anymore.Still useful to keep the `Engine` parameter around for the `ensure_matches`methods because that can be used to check correct store/engine usage forembedders.* Add missing dependent feature enabling for some tests* Remove copy-paste bit from test* match self to show it is uninhabited* Add a missing `is_v128` method* Short circuit a few func type comparisons* Turn comment into part of doc comment* Add test for `Global::new` and subtyping* Add tests for embedder API, tables, and subtyping* Add an embedder API test for setting globals and subtyping* Construct realloc&apos;s type from its index, rather than from scratch* Help LLVM better optimize our dynamic type checks in `TypedFunc::call_raw`* Fix call benchmark compilation* Change `WasmParams::into_abi` to take the whole func type instead of iter of params* Fix doc linksprtest:full* Fix size assertion on s390x

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Tue, 20 Feb 2024 20:33:28 +0000</pubDate>
        <dc:creator>Nick Fitzgerald &lt;fitzgen@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>b0939f66 - Remove explicit `S` type parameters (#5275)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#b0939f66</link>
        <description>Remove explicit `S` type parameters (#5275)* Remove explicit `S` type parametersThis commit removes the explicit `S` type parameter on `Func::typed` and`Instance::get_typed_func`. Historical versions of Rust required thatthis be a type parameter but recent rustcs support a mixture of explicittype parameters and `impl Trait`. This removes, at callsites, asuperfluous `, _` argument which otherwise never needs specification.* Fix mdbook examples

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Wed, 16 Nov 2022 05:04:26 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>7a1b7cdf - Implement RFC 11: Redesigning Wasmtime&apos;s APIs (#2897)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#7a1b7cdf</link>
        <description>Implement RFC 11: Redesigning Wasmtime&apos;s APIs (#2897)Implement Wasmtime&apos;s new API as designed by RFC 11. This is quite a large commit which has had lots of discussion externally, so for more information it&apos;s best to read the RFC thread and the PR thread.

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Thu, 03 Jun 2021 14:10:53 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>2697a18d - Redo the statically typed `Func` API (#2719)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#2697a18d</link>
        <description>Redo the statically typed `Func` API (#2719)* Redo the statically typed `Func` APIThis commit reimplements the `Func` API with respect to statically typeddispatch. Previously `Func` had a `getN` and `getN_async` family ofmethods which were implemented for 0 to 16 parameters. The return valueof these functions was an `impl Fn(..)` closure with the appropriateparameters and return values.There are a number of downsides with this approach that have becomeapparent over time:* The addition of `*_async` doubled the API surface area (which is quite  large here due to one-method-per-number-of-parameters).* The [documentation of `Func`][old-docs] are quite verbose and feel  &quot;polluted&quot; with all these getters, making it harder to understand the  other methods that can be used to interact with a `Func`.* These methods unconditionally pay the cost of returning an owned `impl  Fn` with a `&apos;static` lifetime. While cheap, this is still paying the  cost for cloning the `Store` effectively and moving data into the  closed-over environment.* Storage of the return value into a struct, for example, always  requires `Box`-ing the returned closure since it otherwise cannot be  named.* Recently I had the desire to implement an &quot;unchecked&quot; path for  invoking wasm where you unsafely assert the type signature of a wasm  function. Doing this with today&apos;s scheme would require doubling  (again) the API surface area for both async and synchronous calls,  further polluting the documentation.The main benefit of the previous scheme is that by returning a `impl Fn`it was quite easy and ergonomic to actually invoke the function. Inpractice, though, examples would often have something akin to`.get0::&lt;()&gt;()?()?` which is a lot of things to interpret all at once.Note that `get0` means &quot;0 parameters&quot; yet a type parameter is passed.There&apos;s also a double function invocation which looks like a lot ofcharacters all lined up in a row.Overall, I think that the previous design is starting to show too manycracks and deserves a rewrite. This commit is that rewrite.The new design in this commit is to delete the `getN{,_async}` family offunctions and instead have a new API:    impl Func {        fn typed&lt;P, R&gt;(&amp;self) -&gt; Result&lt;&amp;Typed&lt;P, R&gt;&gt;;    }    impl Typed&lt;P, R&gt; {        fn call(&amp;self, params: P) -&gt; Result&lt;R, Trap&gt;;        async fn call_async(&amp;self, params: P) -&gt; Result&lt;R, Trap&gt;;    }This should entirely replace the current scheme, albeit by slightlylosing ergonomics use cases. The idea behind the API is that theexistence of `Typed&lt;P, R&gt;` is a &quot;proof&quot; that the underlying functiontakes `P` and returns `R`. The `Func::typed` method peforms a runtimetype-check to ensure that types all match up, and if successful you geta `Typed` value. Otherwise an error is returned.Once you have a `Typed` then, like `Func`, you can either `call` or`call_async`. The difference with a `Typed`, however, is that theparams/results are statically known and hence these calls can be muchmore efficient.This is a much smaller API surface area from before and should greatlysimplify the `Func` documentation. There&apos;s still a problem where`Func::wrapN_async` produces a lot of functions to document, but that&apos;snow the sole offender. It&apos;s a nice benefit that thestatically-typed-async verisons are now expressed with an `async`function rather than a function-returning-a-future which makes it bothmore efficient and easier to understand.The type `P` and `R` are intended to either be bare types (e.g. `i32`)or tuples of any length (including 0). At this time `R` is only allowedto be `()` or a bare `i32`-style type because multi-value is notsupported with a native ABI (yet). The `P`, however, can be any size oftuples of parameters. This is also where some ergonomics are lostbecause instead of `f(1, 2)` you now have to write `f.call((1, 2))`(note the double-parens). Similarly `f()` becomes `f.call(())`.Overall I feel that this is a better tradeoff than before. While notuniversally better due to the loss in ergonomics I feel that this designis much more flexible in terms of what you can do with the return valueand also understanding the API surface area (just less to take in).[old-docs]: https://docs.rs/wasmtime/0.24.0/wasmtime/struct.Func.html#method.get0* Rename Typed to TypedFunc* Implement multi-value returns through `Func::typed`* Fix examples in docs* Fix some more errors* More test fixes* Rebasing and adding `get_typed_func`* Updating tests* Fix typo* More doc tweaks* Tweak visibility on `Func::invoke`* Fix tests again

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Thu, 11 Mar 2021 20:43:34 +0000</pubDate>
        <dc:creator>Alex Crichton &lt;alex@alexcrichton.com&gt;</dc:creator>
    </item>
<item>
        <title>54c07d8f - Implement shared host functions. (#2625)</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#54c07d8f</link>
        <description>Implement shared host functions. (#2625)* Implement defining host functions at the Config level.This commit introduces defining host functions at the `Config` rather than with`Func` tied to a `Store`.The intention here is to enable a host to define all of the functions oncewith a `Config` and then use a `Linker` (or directly with`Store::get_host_func`) to use the functions when instantiating a module.This should help improve the performance of use cases where a `Store` isshort-lived and redefining the functions at every module instantiation is anoticeable performance hit.This commit adds `add_to_config` to the code generation for Wasmtime&apos;s `Wasi`type.The new method adds the WASI functions to the given config as host functions.This commit adds context functions to `Store`: `get` to get a context of aparticular type and `set` to set the context on the store.For safety, `set` cannot replace an existing context value of the same type.`Wasi::set_context` was added to set the WASI context for a `Store` when using`Wasi::add_to_config`.* Add `Config::define_host_func_async`.* Make config &quot;async&quot; rather than store.This commit moves the concept of &quot;async-ness&quot; to `Config` rather than `Store`.Note: this is a breaking API change for anyone that&apos;s already adopted the newasync support in Wasmtime.Now `Config::new_async` is used to create an &quot;async&quot; config and any `Store`associated with that config is inherently &quot;async&quot;.This is needed for async shared host functions to have some sanity check during theirexecution (async host functions, like &quot;async&quot; `Func`, need to be called withthe &quot;async&quot; variants).* Update async function tests to smoke async shared host functions.This commit updates the async function tests to also smoke the shared hostfunctions, plus `Func::wrap0_async`.This also changes the &quot;wrap async&quot; method names on `Config` to`wrap$N_host_func_async` to slightly better match what is on `Func`.* Move the instance allocator into `Engine`.This commit moves the instantiated instance allocator from `Config` into`Engine`.This makes certain settings in `Config` no longer order-dependent, which is how`Config` should ideally be.This also removes the confusing concept of the &quot;default&quot; instance allocator,instead opting to construct the on-demand instance allocator when needed.This does alter the semantics of the instance allocator as now each `Engine`gets its own instance allocator rather than sharing a single one between allengines created from a configuration.* Make `Engine::new` return `Result`.This is a breaking API change for anyone using `Engine::new`.As creating the pooling instance allocator may fail (likely cause is not enoughmemory for the provided limits), instead of panicking when creating an`Engine`, `Engine::new` now returns a `Result`.* Remove `Config::new_async`.This commit removes `Config::new_async` in favor of treating &quot;async support&quot; asany other setting on `Config`.The setting is `Config::async_support`.* Remove order dependency when defining async host functions in `Config`.This commit removes the order dependency where async support must be enabled onthe `Config` prior to defining async host functions.The check is now delayed to when an `Engine` is created from the config.* Update WASI example to use shared `Wasi::add_to_config`.This commit updates the WASI example to use `Wasi::add_to_config`.As only a single store and instance are used in the example, it has no semanticdifference from the previous example, but the intention is to steer userstowards defining WASI on the config and only using `Wasi::add_to_linker` whenmore explicit scoping of the WASI context is required.

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Thu, 11 Mar 2021 16:14:03 +0000</pubDate>
        <dc:creator>Peter Huene &lt;peter@huene.dev&gt;</dc:creator>
    </item>
<item>
        <title>17b99cc9 - examples: Add a GC call to the externref Rust example</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#17b99cc9</link>
        <description>examples: Add a GC call to the externref Rust example

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Tue, 21 Jul 2020 16:42:15 +0000</pubDate>
        <dc:creator>Nick Fitzgerald &lt;fitzgen@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>4a349ee2 - wasmtime: Add `externref` Rust example</title>
        <link>http://172.16.0.5:8080/history/wasmtime-44.0.1/examples/externref.rs#4a349ee2</link>
        <description>wasmtime: Add `externref` Rust example

            List of files:
            /wasmtime-44.0.1/examples/externref.rs</description>
        <pubDate>Wed, 08 Jul 2020 22:27:01 +0000</pubDate>
        <dc:creator>Nick Fitzgerald &lt;fitzgen@gmail.com&gt;</dc:creator>
    </item>
</channel>
</rss>
