Add an allocator for external strings#6307
Conversation
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds an ExternalStringAllocator abstraction for V8 external string resources, replacing direct new/delete with a configurable allocator threaded through IsolateBase.
Issues found (highest severity first):
- [HIGH] Compile breakage — The primary
Isolateconstructor (withIsolateGroup) now requires anexternalStringAllocatorparameter, but existing callers inworkerd-api.c++,setup-test.c++,modules-new-test.c++, andmultiple-typewrappers-test.c++were not updated. - [MEDIUM] Silent failure from
allocatereturningnullptr—createExternreturns an emptyMaybeLocalwhen allocation fails, but the callers (newExternalOneByteString,newExternalTwoByteString) pass the result throughcheck()which throwsJsExceptionThrownwithout an actual JS exception pending. - [LOW] Allocator interface lacks alignment contract —
allocate(size_t)doesn't specify alignment requirements.ExternStringcontains a vtable pointer andkj::ArrayPtr, requiring at least pointer alignment. Custom allocators could violate this.
This review was generated by an AI assistant and may contain inaccuracies.
|
I'm Bonk, and I've done a quick review of your PR. This PR adds an I posted a batch review on PR #6307 with 3 inline comments covering:
|
|
The generated output of |
erikcorry
left a comment
There was a problem hiding this comment.
Probably needs a test with an allocator that says no, to ensure the exception throwing works.
7a9405e to
79679cc
Compare
No description provided.