MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / new_fixed

Method new_fixed

crates/wasmtime/src/runtime/gc/enabled/arrayref.rs:467–483  ·  view source on GitHub ↗

Synchronously allocate a new `array` containing the given elements. For example, `ArrayRef::new_fixed(ctx, pre, &[Val::I64(4), Val::I64(5), Val::I64(6)])` allocates the array `[4, 5, 6]`. This is similar to the `array.new_fixed` instruction. # Automatic Garbage Collection If the GC heap is at capacity, and there isn't room for allocating this new array, then this method will automatically trig

(
        mut store: impl AsContextMut,
        allocator: &ArrayRefPre,
        elems: &[Val],
    )

Source from the content-addressed store, hash-verified

465 /// Panics if the allocator or any of the `elems` values are not associated
466 /// with the given store.
467 pub fn new_fixed(
468 mut store: impl AsContextMut,
469 allocator: &ArrayRefPre,
470 elems: &[Val],
471 ) -> Result<Rooted<ArrayRef>> {
472 let (mut limiter, store) = store
473 .as_context_mut()
474 .0
475 .validate_sync_resource_limiter_and_store_opaque()?;
476 vm::assert_ready(Self::_new_fixed_async(
477 store,
478 limiter.as_mut(),
479 allocator,
480 elems,
481 Asyncness::No,
482 ))
483 }
484
485 /// Asynchronously allocate a new `array` containing the given elements.
486 ///

Callers

nothing calls this directly

Calls 4

assert_readyFunction · 0.50
as_context_mutMethod · 0.45
as_mutMethod · 0.45

Tested by

no test coverage detected