[webkit-changes] [WebKit/WebKit] 40f962: TZone: Implement TZone Allocation on JavaScriptCor...

Michael Saboff noreply at github.com
Tue Feb 13 20:55:34 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 40f96223908c9f08584300adf79bc50a855116cc
      https://github.com/WebKit/WebKit/commit/40f96223908c9f08584300adf79bc50a855116cc
  Author: Michael Saboff <msaboff at apple.com>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    M Source/JavaScriptCore/API/tests/testapi.c
    M Source/JavaScriptCore/API/tests/testapi.cpp
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/assembler/testmasm.cpp
    M Source/JavaScriptCore/b3/air/testair.cpp
    M Source/JavaScriptCore/b3/testb3.h
    M Source/JavaScriptCore/b3/testb3_1.cpp
    M Source/JavaScriptCore/dfg/testdfg.cpp
    M Source/JavaScriptCore/jit/JITOpaqueByproducts.h
    M Source/JavaScriptCore/jsc.cpp
    A Source/JavaScriptCore/runtime/RegisterTZoneTypes.cpp
    A Source/JavaScriptCore/runtime/RegisterTZoneTypes.h
    M Source/JavaScriptCore/wasm/WasmCallee.h
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/CMakeLists.txt
    M Source/WTF/wtf/PlatformUse.h
    M Source/WTF/wtf/TZoneMalloc.h
    A Source/WTF/wtf/TZoneMallocInitialization.h
    M Source/WTF/wtf/TZoneMallocInlines.h
    M Source/bmalloc/CMakeLists.txt
    M Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
    M Source/bmalloc/bmalloc/BPlatform.h
    M Source/bmalloc/bmalloc/Map.h
    M Source/bmalloc/bmalloc/TZoneHeap.cpp
    M Source/bmalloc/bmalloc/TZoneHeap.h
    M Source/bmalloc/bmalloc/TZoneHeapInlines.h
    A Source/bmalloc/bmalloc/TZoneHeapManager.cpp
    A Source/bmalloc/bmalloc/TZoneHeapManager.h
    M Tools/DumpRenderTree/mac/DumpRenderTree.mm

  Log Message:
  -----------
  TZone: Implement TZone Allocation on JavaScriptCore Types
https://bugs.webkit.org/show_bug.cgi?id=268673
rdar://122213822

Reviewed by Keith Miller.

This patch implements TZone selection in bmalloc through the newly added TZoneHeapManager class.
The macro that defines a TZone allocated type puts the type name, type size and type aligment in a static bmalloc_type.
That static object is now placed in a newly added __DATA_CONST$__tzone_descs section.  At startup time, each dylib / framework
will register their types by passing this new section's start and end location to the TZoneHeapManager::registerTZoneTypes() method.
When allocating a type for the first time, TZoneHeapManager will allocate if needed for all buckets for the same size and alignment.
Then the manager will compute which of those bucket to use the current type.  This is computed by a process start up seed and the
size and type.

The JavaScript types have been annotated and all JavaScript tests run.  DumpRenderTree has been modified as well.

This patch has TZone allocation turned off via BUSE_TZONE in bmalloc/BPlatform.h and USE_TZONE_MALLOC in wtc/PlatformUse.h
The BUSE_TZONE macro was added to work around a linker bug where unused exported functions end up being eliminated.

* Source/JavaScriptCore/API/tests/testapi.c:
(main):
* Source/JavaScriptCore/API/tests/testapi.cpp:
(WTFTZoneInit):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/assembler/testmasm.cpp:
(main):
* Source/JavaScriptCore/b3/air/testair.cpp:
(main):
* Source/JavaScriptCore/b3/testb3.h:
* Source/JavaScriptCore/b3/testb3_1.cpp:
(main):
* Source/JavaScriptCore/dfg/testdfg.cpp:
(main):
* Source/JavaScriptCore/jit/JITOpaqueByproducts.h:
* Source/JavaScriptCore/jsc.cpp:
(main):
(jscmain):
* Source/JavaScriptCore/runtime/RegisterTZoneTypes.cpp: Added.
(JSC::registerTZoneTypes):
* Source/JavaScriptCore/runtime/RegisterTZoneTypes.h: Added.
* Source/JavaScriptCore/wasm/WasmCallee.h:
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/PlatformUse.h:
* Source/WTF/wtf/TZoneMalloc.h:
* Source/WTF/wtf/TZoneMallocInitialization.h: Copied from Source/WTF/wtf/TZoneMalloc.h.
* Source/WTF/wtf/TZoneMallocInlines.h:
* Source/bmalloc/CMakeLists.txt:
* Source/bmalloc/bmalloc.xcodeproj/project.pbxproj:
* Source/bmalloc/bmalloc/BPlatform.h:
* Source/bmalloc/bmalloc/Map.h:
(bmalloc::Map::contains):
* Source/bmalloc/bmalloc/TZoneHeap.cpp:
* Source/bmalloc/bmalloc/TZoneHeap.h:
(bmalloc::api::roundUpToMulipleOf8):
(bmalloc::api::TZoneHeap::provideHeap):
* Source/bmalloc/bmalloc/TZoneHeapInlines.h:
* Source/bmalloc/bmalloc/TZoneHeapManager.cpp: Added.
(bmalloc::api::TZoneHeapManager::init):
(bmalloc::api::TZoneHeapManager::initTypenameTemplate):
(bmalloc::api::TZoneHeapManager::registerTZoneTypes):
(bmalloc::api::nameForType):
(bmalloc::api::nameForTypeUpdateIndex):
(bmalloc::api::TZoneHeapManager::closeRegistration):
(bmalloc::api::TZoneHeapManager::ensureInstance):
(bmalloc::api::TZoneHeapManager::populateBucketsForSizeClass):
(bmalloc::api::TZoneHeapManager::heapRefForTZoneType):
* Source/bmalloc/bmalloc/TZoneHeapManager.h: Added.
(bmalloc::api::TZoneHeapManager::SizeAndAlign::SizeAndAlign):
(bmalloc::api::TZoneHeapManager::SizeAndAlign::size const):
(bmalloc::api::TZoneHeapManager::SizeAndAlign::alignment const):
(bmalloc::api::TZoneHeapManager::SizeAndAlign::key const):
(bmalloc::api::TZoneHeapManager::SizeAndAlign::hash):
(bmalloc::api::TZoneHeapManager::SizeAndAlign::operator== const):
(bmalloc::api::TZoneHeapManager::SizeAndAlign::operator bool const):
(bmalloc::api::TZoneHeapManager::TZoneHeapManager):
(bmalloc::api::TZoneHeapManager::getInstance):
(bmalloc::api::TZoneHeapManager::mutex):
(bmalloc::api::TZoneHeapManager::bucketCountForTypeCount):
(bmalloc::api::TZoneHeapManager::tzoneBucketForKey):
* Tools/DumpRenderTree/mac/DumpRenderTree.mm:
(DumpRenderTreeMain):

Canonical link: https://commits.webkit.org/274606@main




More information about the webkit-changes mailing list