diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-12-26 23:33:40 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-12-26 23:33:40 +0000 |
| commit | b1fee2d7ab305c286df073776449574293e58213 (patch) | |
| tree | 9439ab291270d702e63e3184d6d30307ff069e01 /runtime/src | |
| parent | c573d97ab07c813de227ac474c01a5379e7fb19b (diff) | |
Add custom implementation of memset for wasm64
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/gc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/src/gc.c b/runtime/src/gc.c index dc8c719b..26c1c204 100644 --- a/runtime/src/gc.c +++ b/runtime/src/gc.c @@ -87,11 +87,18 @@ void* shed__runtime__gc_alloc(size_t size, size_t children_offset, size_t childr object->children_offset = children_offset; object->children_count = children_count; +#ifdef __WASM64__ + for (size_t child_offset = 0; child_offset < sizeof(void*) * children_count; child_offset++) { + char* ptr = ((void*) object) + children_offset + child_offset; + *ptr = 0; + } +#else __builtin_memset( ((void*) object) + children_offset, 0, sizeof(void*) * children_count ); +#endif // TODO: is it possible to leave adding the root to the caller, and avoid // having to add so many roots? (Since some values will immediately become a |
