MCPcopy Create free account
hub / github.com/bytecodealliance/ComponentizeJS / cabi_realloc

Function cabi_realloc

embedding/embedding.cpp:141–148  ·  view source on GitHub ↗

This MUST override the StarlingMonkey core cabi_realloc export NOTE: You *should* avoid external host calls during realloc (ex. using the LOG macro to log a message), as this is a condition under which the component may be marked to prevent leaving (doing a new host call). see: https://github.com/bytecodealliance/wasmtime/blob/aec935f2e746d71934c8a131be15bbbb4392138c/crates/wasmtime/src/runtime/

Source from the content-addressed store, hash-verified

139//
140// see: https://github.com/bytecodealliance/wasmtime/blob/aec935f2e746d71934c8a131be15bbbb4392138c/crates/wasmtime/src/runtime/component/func/host.rs#L741
141__attribute__((export_name("cabi_realloc"))) void *
142cabi_realloc(void *ptr, size_t orig_size, size_t org_align, size_t new_size) {
143 void *ret = JS_realloc(Runtime.cx, ptr, orig_size, new_size);
144 if (!ret) {
145 Runtime.engine->abort("(cabi_realloc) Unable to realloc");
146 }
147 return ret;
148}
149
150__attribute__((export_name("call"))) uint32_t call(uint32_t fn_idx,
151 void *argptr) {

Callers 2

callFunction · 0.85
ReallocFnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected