Skip to content

Commit

Permalink
Get WebKit MALLOC_HEAP_BREAKDOWN Configuration Building Again
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259786

Reviewed by Elliott Williams.

Get the Malloc Heap Breakdown build compiling again. Lots of header includes and exporting of symbols.
This really should not touch the system in any other way, but it does modify files across numerous components.

* Source/JavaScriptCore/assembler/LinkBuffer.cpp:
* Source/JavaScriptCore/assembler/LinkBuffer.h:
* Source/JavaScriptCore/bytecode/InstructionStream.cpp:
* Source/JavaScriptCore/runtime/StringReplaceCache.h:
* Source/JavaScriptCore/runtime/StringSplitCache.h:
* Source/WTF/wtf/BitVector.cpp:
* Source/WTF/wtf/DebugHeap.h:
* Source/WTF/wtf/FastMalloc.h:
* Source/WTF/wtf/MetaAllocator.cpp:
* Source/WTF/wtf/text/CString.h:
* Source/WTF/wtf/text/cf/StringImplCF.cpp:
* Source/WebCore/Modules/WebGPU/InternalAPI/WebGPUBindGroupLayout.h:
* Source/WebGPU/WGSL/AST/ASTBuilder.h:
* Source/WebKit/Shared/ShareableBitmap.cpp:
* Source/WebKit/Shared/ShareableBitmap.h:
* Source/WebKit/Shared/ShareableBitmapHandle.cpp:
* Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp:

Canonical link: https://commits.webkit.org/266981@main
  • Loading branch information
stwrt committed Aug 17, 2023
1 parent 2d299a2 commit 33b3831
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/assembler/LinkBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static std::once_flag flag;
return *threadSpecificBranchCompactionLinkBufferPtr;
}

DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(BranchCompactionLinkBuffer);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(BranchCompactionLinkBuffer, WTF_INTERNAL);
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(BranchCompactionLinkBuffer);

class BranchCompactionLinkBuffer {
Expand Down
1 change: 0 additions & 1 deletion Source/JavaScriptCore/assembler/LinkBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "MacroAssemblerCodeRef.h"
#include <wtf/DataLog.h>
#include <wtf/FastMalloc.h>
#include <wtf/Noncopyable.h>

namespace JSC {

Expand Down
2 changes: 2 additions & 0 deletions Source/JavaScriptCore/bytecode/InstructionStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "config.h"
#include "InstructionStream.h"

#include <wtf/NeverDestroyed.h>

namespace JSC {

DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(InstructionStream);
Expand Down
3 changes: 2 additions & 1 deletion Source/JavaScriptCore/runtime/StringReplaceCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@

namespace JSC {

DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(StringReplaceCache);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(StringReplaceCache, WTF_INTERNAL);

class JSImmutableButterfly;
class RegExp;

class StringReplaceCache {
WTF_MAKE_FAST_ALLOCATED;
WTF_MAKE_NONCOPYABLE(StringReplaceCache);

public:
static constexpr unsigned cacheSize = 64;

Expand Down
3 changes: 2 additions & 1 deletion Source/JavaScriptCore/runtime/StringSplitCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
#pragma once

#include <array>
#include <wtf/DebugHeap.h>

namespace JSC {

DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(StringSplitCache);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(StringSplitCache, WTF_INTERNAL);

class JSImmutableButterfly;

Expand Down
3 changes: 1 addition & 2 deletions Source/WTF/wtf/BitVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

namespace WTF {


DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(BitVector);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(BitVector, WTF_INTERNAL);
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(BitVector);

void BitVector::setSlow(const BitVector& other)
Expand Down
8 changes: 5 additions & 3 deletions Source/WTF/wtf/DebugHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

namespace WTF {

#define DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(Type) DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(Type, WTF_EXPORT_PRIVATE)

#if ENABLE(MALLOC_HEAP_BREAKDOWN)

class DebugHeap {
Expand All @@ -55,9 +57,9 @@ class DebugHeap {
#endif
};

#define DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(Type) \
#define DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(Type, Export) \
struct Type##Malloc { \
static WTF_EXPORT_PRIVATE WTF::DebugHeap& debugHeap(); \
static Export WTF::DebugHeap& debugHeap(); \
\
static void* malloc(size_t size) { return debugHeap().malloc(size); } \
\
Expand Down Expand Up @@ -88,7 +90,7 @@ class DebugHeap {

#else // ENABLE(MALLOC_HEAP_BREAKDOWN)

#define DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(Type) \
#define DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(Type, Export) \
using Type##Malloc = FastMalloc

#define DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(Type) \
Expand Down
2 changes: 0 additions & 2 deletions Source/WTF/wtf/FastMalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,10 @@ using __thisIsHereToForceASemicolonAfterThisMacro UNUSED_TYPE_ALIAS = int
public: \
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER_IMPL(classname) \
private: \
WTF_EXPORT_PRIVATE static WTF::DebugHeap& debugHeap(const char*); \
using __thisIsHereToForceASemicolonAfterThisMacro UNUSED_TYPE_ALIAS = int

#define WTF_MAKE_STRUCT_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(className) \
private: \
WTF_EXPORT_PRIVATE static WTF::DebugHeap& debugHeap(const char*); \
public: \
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER_IMPL(className) \
using __thisIsHereToForceASemicolonAfterThisMacro UNUSED_TYPE_ALIAS = int
Expand Down
2 changes: 1 addition & 1 deletion Source/WTF/wtf/MetaAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace WTF {

DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(MetaAllocatorHandle);

DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(MetaAllocatorFreeSpace);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(MetaAllocatorFreeSpace, WTF_INTERNAL);
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(MetaAllocatorFreeSpace);

MetaAllocator::~MetaAllocator()
Expand Down
1 change: 1 addition & 0 deletions Source/WTF/wtf/text/CString.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#pragma once

#include <span>
#include <wtf/DebugHeap.h>
#include <wtf/HashFunctions.h>
#include <wtf/HashTraits.h>
#include <wtf/Ref.h>
Expand Down
2 changes: 1 addition & 1 deletion Source/WTF/wtf/text/cf/StringImplCF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace WTF {

namespace StringWrapperCFAllocator {

DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(StringWrapperCFAllocator);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(StringWrapperCFAllocator, WTF_INTERNAL);
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(StringWrapperCFAllocator);

static StringImpl* currentString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#pragma once

#include <wtf/DebugHeap.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
Expand Down
3 changes: 2 additions & 1 deletion Source/WebGPU/WGSL/AST/ASTBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#pragma once

#include <wtf/MallocPtr.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/Noncopyable.h>
#include <wtf/Nonmovable.h>
#include <wtf/Vector.h>
Expand All @@ -48,7 +49,7 @@ namespace AST {

class Node;

DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(WGSLAST);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(WGSLAST, WTF_INTERNAL);

class Builder {
WTF_MAKE_NONCOPYABLE(Builder);
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/Shared/ShareableBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
namespace WebKit {
using namespace WebCore;

DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(ShareableBitmap);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(ShareableBitmap, WTF_INTERNAL);
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(ShareableBitmap);

ShareableBitmapConfiguration::ShareableBitmapConfiguration(const IntSize& size, std::optional<DestinationColorSpace> colorSpace, bool isOpaque)
Expand Down
2 changes: 2 additions & 0 deletions Source/WebKit/Shared/ShareableBitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <WebCore/IntRect.h>
#include <WebCore/PlatformImage.h>
#include <wtf/ArgumentCoder.h>
#include <wtf/DebugHeap.h>
#include <wtf/ExportMacros.h>
#include <wtf/RefPtr.h>
#include <wtf/ThreadSafeRefCounted.h>

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/Shared/ShareableBitmapHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
namespace WebKit {
using namespace WebCore;

DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(ShareableBitmapHandle);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(ShareableBitmapHandle, WTF_INTERNAL);
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(ShareableBitmapHandle);

ShareableBitmapHandle::ShareableBitmapHandle()
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static const uint32_t maximumSessionStateDataSize = std::numeric_limits<uint32_t
template<typename T> void isValidEnum(T);


DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HistoryEntryDataEncoder);
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT(HistoryEntryDataEncoder, WTF_INTERNAL);
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HistoryEntryDataEncoder);

class HistoryEntryDataEncoder {
Expand Down

0 comments on commit 33b3831

Please sign in to comment.