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

Method new_stack

tests/all/stack_creator.rs:101–113  ·  view source on GitHub ↗
(&self, size: usize, zeroed: bool)

Source from the content-addressed store, hash-verified

99}
100unsafe impl StackCreator for CustomStackCreator {
101 fn new_stack(&self, size: usize, zeroed: bool) -> Result<Box<dyn StackMemory>> {
102 if zeroed {
103 bail!("CustomStackCreator does not support stack zeroing");
104 }
105 if size != self.size {
106 bail!("must use the size we allocated for this stack memory creator");
107 }
108 let page_size = rustix::param::page_size();
109 // skip over the page size
110 let base_ptr = unsafe { self.memory.as_ptr().add(page_size) };
111 let base = NonNull::new(base_ptr).context("unable to compute stack base")?;
112 Ok(Box::new(CustomStack::new(base, self.size)))
113 }
114}
115
116fn config() -> (Store<()>, Arc<CustomStackCreator>) {

Callers

nothing calls this directly

Calls 5

OkFunction · 0.85
newFunction · 0.50
addMethod · 0.45
as_ptrMethod · 0.45
contextMethod · 0.45

Tested by

no test coverage detected