LibGC: Enable EXPLICIT_SYMBOL_EXPORT

This commit is contained in:
ayeteadoe 2025-06-28 01:34:31 -07:00 committed by Andrew Kaster
commit 83846b3861
Notes: github-actions[bot] 2025-06-30 16:51:58 +00:00
18 changed files with 22 additions and 24 deletions

View file

@ -11,7 +11,7 @@
namespace GC { namespace GC {
class BlockAllocator { class GC_API BlockAllocator {
public: public:
BlockAllocator() = default; BlockAllocator() = default;
~BlockAllocator(); ~BlockAllocator();

View file

@ -12,7 +12,7 @@ set(SOURCES
WeakContainer.cpp WeakContainer.cpp
) )
serenity_lib(LibGC gc) serenity_lib(LibGC gc EXPLICIT_SYMBOL_EXPORT)
target_link_libraries(LibGC PRIVATE LibCore) target_link_libraries(LibGC PRIVATE LibCore)
if (ENABLE_SWIFT) if (ENABLE_SWIFT)

View file

@ -37,7 +37,7 @@ public: \
} \ } \
friend class GC::Heap; friend class GC::Heap;
class Cell { class GC_API Cell {
AK_MAKE_NONCOPYABLE(Cell); AK_MAKE_NONCOPYABLE(Cell);
AK_MAKE_NONMOVABLE(Cell); AK_MAKE_NONMOVABLE(Cell);
@ -57,7 +57,7 @@ public:
virtual StringView class_name() const = 0; virtual StringView class_name() const = 0;
class Visitor { class GC_API Visitor {
public: public:
void visit(Cell* cell) void visit(Cell* cell)
{ {

View file

@ -21,7 +21,7 @@
namespace GC { namespace GC {
class CellAllocator { class GC_API CellAllocator {
public: public:
CellAllocator(size_t cell_size, char const* class_name = nullptr); CellAllocator(size_t cell_size, char const* class_name = nullptr);
~CellAllocator() = default; ~CellAllocator() = default;
@ -68,7 +68,7 @@ private:
}; };
template<typename T> template<typename T>
class TypeIsolatingCellAllocator { class GC_API TypeIsolatingCellAllocator {
public: public:
using CellType = T; using CellType = T;

View file

@ -14,7 +14,7 @@
namespace GC { namespace GC {
class ConservativeVectorBase { class GC_API ConservativeVectorBase {
public: public:
virtual ReadonlySpan<FlatPtr> possible_values() const = 0; virtual ReadonlySpan<FlatPtr> possible_values() const = 0;
@ -32,7 +32,7 @@ public:
}; };
template<typename T, size_t inline_capacity> template<typename T, size_t inline_capacity>
class ConservativeVector final class GC_API ConservativeVector final
: public ConservativeVectorBase : public ConservativeVectorBase
, public Vector<T, inline_capacity> { , public Vector<T, inline_capacity> {

View file

@ -11,7 +11,7 @@
namespace GC { namespace GC {
class DeferGC { class GC_API DeferGC {
public: public:
explicit DeferGC(Heap& heap) explicit DeferGC(Heap& heap)
: m_heap(heap) : m_heap(heap)

View file

@ -24,7 +24,7 @@ struct ForeignPtr;
using Base = base_class; \ using Base = base_class; \
friend class GC::Heap; friend class GC::Heap;
class ForeignCell : public Cell { class GC_API ForeignCell : public Cell {
FOREIGN_CELL(ForeignCell, Cell); FOREIGN_CELL(ForeignCell, Cell);
public: public:

View file

@ -7,6 +7,7 @@
#pragma once #pragma once
#include <AK/Types.h> #include <AK/Types.h>
#include <LibGC/Export.h>
namespace GC { namespace GC {

View file

@ -30,7 +30,7 @@
namespace GC { namespace GC {
class Heap : public HeapBase { class GC_API Heap : public HeapBase {
AK_MAKE_NONCOPYABLE(Heap); AK_MAKE_NONCOPYABLE(Heap);
AK_MAKE_NONMOVABLE(Heap); AK_MAKE_NONMOVABLE(Heap);

View file

@ -20,7 +20,7 @@
namespace GC { namespace GC {
class HeapBlock : public HeapBlockBase { class GC_API HeapBlock : public HeapBlockBase {
AK_MAKE_NONCOPYABLE(HeapBlock); AK_MAKE_NONCOPYABLE(HeapBlock);
AK_MAKE_NONMOVABLE(HeapBlock); AK_MAKE_NONMOVABLE(HeapBlock);

View file

@ -10,7 +10,7 @@
namespace GC { namespace GC {
struct HeapRoot { struct GC_API HeapRoot {
enum class Type { enum class Type {
HeapFunctionCapturedPointer, HeapFunctionCapturedPointer,
Root, Root,

View file

@ -13,7 +13,7 @@
namespace GC { namespace GC {
class HeapBase { class GC_API HeapBase {
AK_MAKE_NONCOPYABLE(HeapBase); AK_MAKE_NONCOPYABLE(HeapBase);
AK_MAKE_NONMOVABLE(HeapBase); AK_MAKE_NONMOVABLE(HeapBase);
@ -29,12 +29,12 @@ protected:
void* m_private_data; void* m_private_data;
}; };
class HeapBlockBase { class GC_API HeapBlockBase {
AK_MAKE_NONMOVABLE(HeapBlockBase); AK_MAKE_NONMOVABLE(HeapBlockBase);
AK_MAKE_NONCOPYABLE(HeapBlockBase); AK_MAKE_NONCOPYABLE(HeapBlockBase);
public: public:
GC_API static size_t block_size; static size_t block_size;
static HeapBlockBase* from_cell(Cell const* cell) static HeapBlockBase* from_cell(Cell const* cell)
{ {
return reinterpret_cast<HeapBlockBase*>(bit_cast<FlatPtr>(cell) & ~(HeapBlockBase::block_size - 1)); return reinterpret_cast<HeapBlockBase*>(bit_cast<FlatPtr>(cell) & ~(HeapBlockBase::block_size - 1));

View file

@ -55,7 +55,7 @@ static constexpr u64 TAG_SHIFT = 48;
static constexpr u64 TAG_EXTRACTION = 0xFFFF000000000000; static constexpr u64 TAG_EXTRACTION = 0xFFFF000000000000;
static constexpr u64 SHIFTED_IS_CELL_PATTERN = IS_CELL_PATTERN << TAG_SHIFT; static constexpr u64 SHIFTED_IS_CELL_PATTERN = IS_CELL_PATTERN << TAG_SHIFT;
class NanBoxedValue { class GC_API NanBoxedValue {
public: public:
bool is_cell() const { return (m_value.tag & IS_CELL_PATTERN) == IS_CELL_PATTERN; } bool is_cell() const { return (m_value.tag & IS_CELL_PATTERN) == IS_CELL_PATTERN; }

View file

@ -17,7 +17,7 @@
namespace GC { namespace GC {
class RootImpl : public RefCounted<RootImpl> { class GC_API RootImpl : public RefCounted<RootImpl> {
AK_MAKE_NONCOPYABLE(RootImpl); AK_MAKE_NONCOPYABLE(RootImpl);
AK_MAKE_NONMOVABLE(RootImpl); AK_MAKE_NONMOVABLE(RootImpl);

View file

@ -15,7 +15,7 @@
namespace GC { namespace GC {
class RootHashMapBase { class GC_API RootHashMapBase {
public: public:
virtual void gather_roots(HashMap<Cell*, GC::HeapRoot>&) const = 0; virtual void gather_roots(HashMap<Cell*, GC::HeapRoot>&) const = 0;

View file

@ -16,7 +16,7 @@
namespace GC { namespace GC {
class RootVectorBase { class GC_API RootVectorBase {
public: public:
virtual void gather_roots(HashMap<Cell*, GC::HeapRoot>&) const = 0; virtual void gather_roots(HashMap<Cell*, GC::HeapRoot>&) const = 0;

View file

@ -11,7 +11,7 @@
namespace GC { namespace GC {
class WeakContainer { class GC_API WeakContainer {
public: public:
explicit WeakContainer(Heap&); explicit WeakContainer(Heap&);
virtual ~WeakContainer(); virtual ~WeakContainer();

View file

@ -281,9 +281,6 @@ endif()
if (WIN32) if (WIN32)
# FIXME: Windows on ARM # FIXME: Windows on ARM
target_link_libraries(LibJS PRIVATE clang_rt.builtins-x86_64.lib) target_link_libraries(LibJS PRIVATE clang_rt.builtins-x86_64.lib)
# FIXME: This is a hack to get around lld-link error undefined symbol GC::HeapBlockBase::block_size
# LibGC HeapBlock.obj is given directly to LibJS linker
target_link_libraries(LibJS PRIVATE $<FILTER:$<TARGET_OBJECTS:LibGC>,INCLUDE,HeapBlock>)
else() else()
# This flag has no effect on Windows # This flag has no effect on Windows
target_compile_options(LibJS PRIVATE -fno-omit-frame-pointer) target_compile_options(LibJS PRIVATE -fno-omit-frame-pointer)