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/
| 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 * |
| 142 | cabi_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) { |