Skip to content

Remove MallocPtr. #46668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ast-hugger
Copy link
Contributor

@ast-hugger ast-hugger commented Jun 12, 2025

8928eb7

Remove MallocPtr.
https://bugs.webkit.org/show_bug.cgi?id=294022
rdar://152575154

Reviewed by NOBODY (OOPS!).

This patch changes `MallocPtr` to require the parameter type `T` to be trivially destructible.

The usage of `MallocPtr` in `WasmTable` which was responsible for a callee leak is now
incompatible with that requirement. `WasmTable` is changed to use `std::unique_ptr`
with a custom deleter that correctly destroys the table contents.

Additionally, `VM` is changed to use a `FixedVector` instead of a `MallocPtr` to allocate
the exception fuzzing buffer.

* Source/JavaScriptCore/bytecode/ExpressionInfo.h:
* Source/JavaScriptCore/runtime/CachedTypes.cpp:
* Source/JavaScriptCore/runtime/VM.h:
(JSC::VM::exceptionFuzzingBuffer):
* Source/JavaScriptCore/wasm/WasmTable.cpp:
(JSC::Wasm::Table::StorageDeleter<T>::operator):
(JSC::Wasm::reallocate):
(JSC::Wasm::Table::grow):
(JSC::Wasm::ExternOrAnyRefTable::ExternOrAnyRefTable):
(JSC::Wasm::FuncRefTable::FuncRefTable):
(JSC::Wasm::FuncRefTable::~FuncRefTable): Deleted.
* Source/JavaScriptCore/wasm/WasmTable.h:
* Source/WTF/wtf/MallocPtr.h:

8928eb7

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ❌ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ❌ 🧪 wpe-wk2 ❌ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ❌ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ❌ 🧪 api-gtk
✅ 🧪 vision-wk2 ⏳ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ❌ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@ast-hugger ast-hugger requested a review from a team as a code owner June 12, 2025 18:36
@ast-hugger ast-hugger self-assigned this Jun 12, 2025
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 12, 2025
@ast-hugger ast-hugger removed the merging-blocked Applied to prevent a change from being merged label Jun 12, 2025
@ast-hugger ast-hugger force-pushed the eng/Remove-MallocPtr branch from 7410798 to 6678b99 Compare June 12, 2025 23:33
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 13, 2025
@ast-hugger ast-hugger removed the merging-blocked Applied to prevent a change from being merged label Jun 27, 2025
@ast-hugger ast-hugger force-pushed the eng/Remove-MallocPtr branch from 6678b99 to bc85f99 Compare June 27, 2025 03:47
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 27, 2025
@ast-hugger ast-hugger removed the merging-blocked Applied to prevent a change from being merged label Jun 27, 2025
@ast-hugger ast-hugger force-pushed the eng/Remove-MallocPtr branch from bc85f99 to b891220 Compare June 27, 2025 16:56
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 27, 2025
@ast-hugger ast-hugger removed the merging-blocked Applied to prevent a change from being merged label Jun 30, 2025
@ast-hugger ast-hugger force-pushed the eng/Remove-MallocPtr branch from b891220 to b738ca1 Compare June 30, 2025 17:53
@ast-hugger ast-hugger force-pushed the eng/Remove-MallocPtr branch from b738ca1 to 2805260 Compare June 30, 2025 18:04
@ast-hugger ast-hugger force-pushed the eng/Remove-MallocPtr branch from 2805260 to 3d68555 Compare June 30, 2025 18:52
https://bugs.webkit.org/show_bug.cgi?id=294022
rdar://152575154

Reviewed by NOBODY (OOPS!).

This patch changes `MallocPtr` to require the parameter type `T` to be trivially destructible.

The usage of `MallocPtr` in `WasmTable` which was responsible for a callee leak is now
incompatible with that requirement. `WasmTable` is changed to use `std::unique_ptr`
with a custom deleter that correctly destroys the table contents.

Additionally, `VM` is changed to use a `FixedVector` instead of a `MallocPtr` to allocate
the exception fuzzing buffer.

* Source/JavaScriptCore/bytecode/ExpressionInfo.h:
* Source/JavaScriptCore/runtime/CachedTypes.cpp:
* Source/JavaScriptCore/runtime/VM.h:
(JSC::VM::exceptionFuzzingBuffer):
* Source/JavaScriptCore/wasm/WasmTable.cpp:
(JSC::Wasm::Table::StorageDeleter<T>::operator):
(JSC::Wasm::reallocate):
(JSC::Wasm::Table::grow):
(JSC::Wasm::ExternOrAnyRefTable::ExternOrAnyRefTable):
(JSC::Wasm::FuncRefTable::FuncRefTable):
(JSC::Wasm::FuncRefTable::~FuncRefTable): Deleted.
* Source/JavaScriptCore/wasm/WasmTable.h:
* Source/WTF/wtf/MallocPtr.h:
@ast-hugger ast-hugger force-pushed the eng/Remove-MallocPtr branch from 3d68555 to 8928eb7 Compare June 30, 2025 18:57
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merging-blocked Applied to prevent a change from being merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants