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

Method init

crates/wasmtime/src/runtime/type_registry.rs:559–580  ·  view source on GitHub ↗

Initialize a `Arc ` (as created by `RecGroupEntry::new_inner`) and wrap it into a `RecGroupEntry`.

(
        mut inner: Arc<RecGroupEntryInner>,
        key: WasmRecGroup,
        shared_types: Box<[VMSharedTypeIndex]>,
    )

Source from the content-addressed store, hash-verified

557 /// Initialize a `Arc<RecGroupEntryInner>` (as created by
558 /// `RecGroupEntry::new_inner`) and wrap it into a `RecGroupEntry`.
559 fn init(
560 mut inner: Arc<RecGroupEntryInner>,
561 key: WasmRecGroup,
562 shared_types: Box<[VMSharedTypeIndex]>,
563 ) -> Self {
564 debug_assert!(key.is_canonicalized_for_hash_consing());
565
566 let RecGroupEntryInner {
567 hash_consing_key,
568 shared_type_indices,
569 registrations: _,
570 unregistered: _,
571 } = Arc::get_mut(&mut inner).expect("must have the only handle to this inner entry");
572
573 debug_assert!(shared_type_indices.is_empty());
574 *shared_type_indices = shared_types;
575
576 debug_assert!(hash_consing_key.types.is_empty());
577 *hash_consing_key = key;
578
579 RecGroupEntry(inner)
580 }
581
582 /// Increment the registration count.
583 fn incref(&self, why: &str) {

Callers 3

logged_filetestsFunction · 0.45
debugMethod · 0.45
init_loggingMethod · 0.45

Calls 3

get_mutFunction · 0.85
RecGroupEntryClass · 0.85
expectMethod · 0.45

Tested by 1

logged_filetestsFunction · 0.36