fix(v8): align internal::Isolate storage to the API pointer size#226
Merged
toyobayashi merged 1 commit intoJul 17, 2026
Merged
Conversation
v8::internal::Isolate stored its data as plain char[1024] (alignof 1), while Internals::GetRootSlot reads it through internal::Address*. The static instance in Isolate::GetCurrent() therefore only happened to be 8-aligned on wasm64; the enlarged v8_hello_world test binding shifted the data segment so it landed on a 4-aligned address, and the first ReturnValue::Get() root load trapped under SAFE_HEAP=1 with "Aborted(alignment fault)". Declare the buffer alignas(kApiSystemPointerSize) so correctness no longer depends on surrounding layout. Verified: reproduced the exact CI stack locally (emsdk 6.0.2, MEMORY64=1 Debug); after the fix v8_hello_world passes on both wasm64 and wasm32 emscripten builds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T34fMrYCf2V13Mg8BKmnda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A one-line alignment fix, split out of the original branch so it can be reviewed on its own.
v8::internal::Isolatestored its data as a plainchar[1024](alignof1), whileInternals::GetRootSlotreads it throughinternal::Address*. The static instance inIsolate::GetCurrent()therefore only happened to be 8-aligned on wasm64; the enlargedv8_hello_worldtest binding shifted the data segment so it landed on a 4-aligned address, and the firstReturnValue::Get()root load trapped underSAFE_HEAP=1withAborted(alignment fault).Declaring the buffer
alignas(kApiSystemPointerSize)makes correctness no longer depend on surrounding layout.Verified: reproduced the exact CI stack locally (emsdk 6.0.2,
MEMORY64=1Debug); after the fixv8_hello_worldpasses on both wasm64 and wasm32 emscripten builds.