generate elem refcount function and pass it into decref lowlevel

This commit is contained in:
Brendan Hansknecht 2024-07-10 20:45:15 -07:00
parent 516afaff41
commit ba9b15f7d6
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
3 changed files with 38 additions and 11 deletions

View file

@ -2102,6 +2102,17 @@ impl<'a, 'r> WasmBackend<'a, 'r> {
self.register_helper_proc(spec_sym, spec_layout, ProcSource::Helper);
}
self.get_existing_refcount_fn_index(proc_symbol, layout, op)
}
/// return a pointer (table index) to a refcount helper procedure.
/// This allows it to be indirectly called from Zig code
pub fn get_existing_refcount_fn_index(
&mut self,
proc_symbol: Symbol,
layout: InLayout<'a>,
op: HelperOp,
) -> u32 {
let layout_repr = if op.is_indirect() {
LayoutRepr::Ptr(layout)
} else {