Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/cranelift/src/func_environ/gc/enabled/drc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ fn emit_gc_raw_alloc(
.ins()
.iconst(ir::types::I32, i64::from(kind.as_u32()));

let ty = builder.ins().iconst(ir::types::I32, i64::from(ty.as_u32()));
let ty = func_env.module_interned_to_shared_ty(&mut builder.cursor(), ty);

assert!(align.is_power_of_two());
let align = builder.ins().iconst(ir::types::I32, i64::from(align));
Expand Down
2 changes: 1 addition & 1 deletion crates/environ/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ macro_rules! foreach_builtin_function {
gc_alloc_raw(
vmctx: vmctx,
kind: u32,
module_interned_type_index: u32,
shared_type_index: u32,
size: u32,
align: u32
) -> u32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc b26e69fbaf46deb79652859039538e422818fd40b9afff63faa7aacbddecfd3d # shrinks to (capacity, ops) = (219544665809630458, [(10, Alloc(Layout { size: 193045289231815352, align: 8 (1 << 3) })), (10, Dealloc(Layout { size: 193045289231815352, align: 8 (1 << 3) }))])
cc 174fe731edb88dd41ae77aeb8ddc0a94e09f8d8ad0849709c440c8995e639bbd # shrinks to (initial_capacity, ops) = (558656369836710805, [Alloc(292159696945657979, Layout { size: 339386803970957424, align: 2 (1 << 1) }), Dealloc(292159696945657979, Layout { size: 339386803970957424, align: 2 (1 << 1) }), AddCapacity(5898306987443335331)])
7 changes: 7 additions & 0 deletions crates/wasmtime/src/runtime/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,13 @@ impl StoreOpaque {
.expect("attempted to access the store's GC heap before it has been allocated")
}

/// Returns a mutable reference to the GC store if it has been allocated.
#[inline]
#[cfg(feature = "gc-drc")]
pub(crate) fn try_gc_store_mut(&mut self) -> Option<&mut GcStore> {
self.gc_store.as_mut()
}

#[inline]
pub(crate) fn gc_roots(&self) -> &RootSet {
&self.gc_roots
Expand Down
1 change: 1 addition & 0 deletions crates/wasmtime/src/runtime/store/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl StoreOpaque {
bytes_needed: Option<u64>,
asyncness: Asyncness,
) {
log::trace!("collect_and_maybe_grow_gc_heap(bytes_needed = {bytes_needed:#x?})");
self.do_gc(asyncness).await;
if let Some(n) = bytes_needed
// The gc_zeal's allocation counter will pass `bytes_needed == 0` to
Expand Down
6 changes: 5 additions & 1 deletion crates/wasmtime/src/runtime/vm/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ impl GcStore {
pub async fn gc(&mut self, asyncness: Asyncness, roots: GcRootsIter<'_>) {
let collection = self.gc_heap.gc(roots, &mut self.host_data_table);
collect_async(collection, asyncness).await;
self.last_post_gc_allocated_bytes = Some(self.gc_heap.allocated_bytes());
self.last_post_gc_allocated_bytes = Some({
let size = self.gc_heap.allocated_bytes();
log::trace!("After collection, GC heap size = {size} bytes");
size
});
}

/// Get the kind of the given GC reference.
Expand Down
Loading
Loading