Garbage-Collected Heap

This set of functions is used to allocate objects on GC Heap.

#include <jnc_GcHeap.h>

// enums

enum jnc_GcDef;
enum jnc_GcShadowStackFrameMapOp;

// structs

struct jnc_GcHeap;
struct jnc_GcSizeTriggers;
struct jnc_GcStats;

// global functions

jnc_Runtime*
jnc_GcHeap_getRuntime(jnc_GcHeap* gcHeap);

void
jnc_GcHeap_getStats(
    jnc_GcHeap* gcHeap,
    jnc_GcStats* stats
);

void
jnc_GcHeap_getSizeTriggers(
    jnc_GcHeap* gcHeap,
    jnc_GcSizeTriggers* triggers
);

void
jnc_GcHeap_setSizeTriggers(
    jnc_GcHeap* gcHeap,
    const jnc_GcSizeTriggers* triggers
);

void
jnc_GcHeap_collect(jnc_GcHeap* gcHeap);

void
jnc_GcHeap_enterNoCollectRegion(jnc_GcHeap* gcHeap);

void
jnc_GcHeap_leaveNoCollectRegion(
    jnc_GcHeap* gcHeap,
    bool_t canCollectNow
);

void
jnc_GcHeap_enterWaitRegion(jnc_GcHeap* gcHeap);

void
jnc_GcHeap_leaveWaitRegion(jnc_GcHeap* gcHeap);

void
jnc_GcHeap_safePoint(jnc_GcHeap* gcHeap);

void
jnc_GcHeap_setFrameMap(
    jnc_GcHeap* gcHeap,
    jnc_GcShadowStackFrame* frame,
    jnc_GcShadowStackFrameMap* map,
    jnc_GcShadowStackFrameMapOp op
);

void
jnc_GcHeap_addStaticDestructor(
    jnc_GcHeap* gcHeap,
    jnc_StaticDestructFunc* destructFunc
);

void
jnc_GcHeap_addStaticClassDestructor(
    jnc_GcHeap* gcHeap,
    jnc_DestructFunc* destructFunc,
    jnc_IfaceHdr* iface
);

void
jnc_GcHeap_addStaticRoot(
    jnc_GcHeap* gcHeap,
    const void* p,
    jnc_Type* type
);

jnc_IfaceHdr*
jnc_GcHeap_allocateClass(
    jnc_GcHeap* gcHeap,
    jnc_ClassType* type
);

jnc_IfaceHdr*
jnc_GcHeap_tryAllocateClass(
    jnc_GcHeap* gcHeap,
    jnc_ClassType* type
);

jnc_DataPtr
jnc_GcHeap_allocateData(
    jnc_GcHeap* gcHeap,
    jnc_Type* type
);

jnc_DataPtr
jnc_GcHeap_tryAllocateData(
    jnc_GcHeap* gcHeap,
    jnc_Type* type
);

jnc_DataPtr
jnc_GcHeap_allocateArray(
    jnc_GcHeap* gcHeap,
    jnc_Type* type,
    size_t count
);

jnc_DataPtr
jnc_GcHeap_tryAllocateArray(
    jnc_GcHeap* gcHeap,
    jnc_Type* type,
    size_t count
);

jnc_DataPtr
jnc_GcHeap_allocateBuffer(
    jnc_GcHeap* gcHeap,
    size_t size
);

jnc_DataPtr
jnc_GcHeap_tryAllocateBuffer(
    jnc_GcHeap* gcHeap,
    size_t size
);

jnc_DataPtrValidator*
jnc_GcHeap_createDataPtrValidator(
    jnc_GcHeap* gcHeap,
    jnc_Box* box,
    const void* rangeBegin,
    size_t rangeLength
);

jnc_DetachedDataBox*
jnc_GcHeap_createForeignDataBox(
    jnc_GcHeap* gcHeap,
    jnc_Type* type,
    size_t elementCount,
    const void* p,
    bool_t isCallSiteLocal
);

jnc_DataPtr
jnc_GcHeap_createForeignBufferPtr(
    jnc_GcHeap* gcHeap,
    const void* p,
    size_t size,
    bool_t isCallSiteLocal
);

void
jnc_GcHeap_invalidateDataPtrValidator(
    jnc_GcHeap* gcHeap,
    jnc_DataPtrValidator* validator
);

static
void
jnc_GcHeap_invalidateDataPtr(
    jnc_GcHeap* gcHeap,
    jnc_DataPtr ptr
);

void
jnc_GcHeap_weakMark(
    jnc_GcHeap* gcHeap,
    jnc_Box* box
);

void
jnc_GcHeap_markData(
    jnc_GcHeap* gcHeap,
    jnc_Box* box
);

static
void
jnc_GcHeap_markDataPtr(
    jnc_GcHeap* gcHeap,
    jnc_DataPtr ptr
);

void
jnc_GcHeap_markClass(
    jnc_GcHeap* gcHeap,
    jnc_Box* box
);

static
void
jnc_GcHeap_markClassPtr(
    jnc_GcHeap* gcHeap,
    jnc_IfaceHdr* iface
);

static
void
jnc_GcHeap_markString(
    jnc_GcHeap* gcHeap,
    jnc_String string
);

void
jnc_GcHeap_markVariant(
    jnc_GcHeap* gcHeap,
    jnc_Variant variant
);

void
jnc_GcHeap_addRoot(
    jnc_GcHeap* gcHeap,
    const void* p,
    jnc_Type* type
);

void
jnc_GcHeap_addBoxToCallSite(jnc_Box* box);