Skip to content

Commit 86b1f90

Browse files
fix: remove log during realloc (#273)
1 parent a144134 commit 86b1f90

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

embedding/embedding.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ cabi_realloc_adapter(void *ptr, size_t orig_size, size_t org_align,
132132
}
133133

134134
// This MUST override the StarlingMonkey core cabi_realloc export
135+
//
136+
// NOTE: You *should* avoid external host calls during realloc
137+
// (ex. using the LOG macro to log a message), as this is a condition
138+
// under which the component may be marked to prevent leaving (doing a new host call).
139+
//
140+
// see: https://github.com/bytecodealliance/wasmtime/blob/aec935f2e746d71934c8a131be15bbbb4392138c/crates/wasmtime/src/runtime/component/func/host.rs#L741
135141
__attribute__((export_name("cabi_realloc"))) void *
136142
cabi_realloc(void *ptr, size_t orig_size, size_t org_align, size_t new_size) {
137143
void *ret = JS_realloc(Runtime.cx, ptr, orig_size, new_size);
@@ -140,8 +146,6 @@ cabi_realloc(void *ptr, size_t orig_size, size_t org_align, size_t new_size) {
140146
if (!ret) {
141147
Runtime.engine->abort("(cabi_realloc) Unable to realloc");
142148
}
143-
LOG("(cabi_realloc) [%d %zu %zu] %d\n", (uint32_t)ptr, orig_size, new_size,
144-
(uint32_t)ret);
145149
return ret;
146150
}
147151

0 commit comments

Comments
 (0)