Runtime

#include <jnc_Runtime.h>

// structs

struct jnc_Runtime;

// global functions

jnc_Runtime*
jnc_Runtime_create();

void
jnc_Runtime_destroy(jnc_Runtime* runtime);

jnc_Module*
jnc_Runtime_getModule(jnc_Runtime* runtime);

jnc_GcHeap*
jnc_Runtime_getGcHeap(jnc_Runtime* runtime);

bool_t
jnc_Runtime_isAborted(jnc_Runtime* runtime);

bool_t
jnc_Runtime_startup(
    jnc_Runtime* runtime,
    jnc_Module* module
);

void
jnc_Runtime_shutdown(jnc_Runtime* runtime);

void
jnc_Runtime_abort(jnc_Runtime* runtime);

void
jnc_Runtime_initializeCallSite(
    jnc_Runtime* runtime,
    jnc_CallSite* callSite
);

void
jnc_Runtime_uninitializeCallSite(
    jnc_Runtime* runtime,
    jnc_CallSite* callSite
);

jnc_SjljFrame*
jnc_Runtime_setSjljFrame(
    jnc_Runtime* runtime,
    jnc_SjljFrame* frame
);

void*
jnc_Runtime_getUserData(jnc_Runtime* runtime);

void*
jnc_Runtime_setUserData(
    jnc_Runtime* runtime,
    void* data
);

jnc_Runtime*
jnc_getCurrentThreadRuntime();

static
jnc_GcHeap*
jnc_getCurrentThreadGcHeap();

jnc_Tls*
jnc_getCurrentThreadTls();

void
jnc_dynamicThrow();

void
jnc_saveSignalInfo(jnc_SjljFrame* sjljFrame);

void
jnc_primeClass(
    jnc_Box* box,
    jnc_Box* root,
    jnc_ClassType* type,
    const void* vtable
);

jnc_IfaceHdr*
jnc_strengthenClassPtr(jnc_IfaceHdr* iface);

size_t
jnc_strLen(jnc_DataPtr ptr);

jnc_DataPtr
jnc_strDup(
    const char* p,
    size_t length
);

jnc_DataPtr
jnc_strDup_w(
    const wchar_t* p,
    size_t length
);

jnc_DataPtr
jnc_strDup_utf16(
    const utf16_t* p,
    size_t length
);

jnc_String
jnc_allocateString(
    const char* p,
    size_t length
);

jnc_String
jnc_allocateString_w(
    const wchar_t* p,
    size_t length
);

jnc_String
jnc_allocateString_utf16(
    const utf16_t* p,
    size_t length
);

jnc_DataPtr
jnc_memDup(
    const void* p,
    size_t size
);

static
intptr_t
jnc_getDataPtrLeftRadius(jnc_DataPtr ptr);

static
intptr_t
jnc_getDataPtrRightRadius(jnc_DataPtr ptr);

jnc_DataPtr
jnc_limitDataPtr(
    jnc_DataPtr ptr,
    size_t length
);

jnc_DataPtrValidator*
jnc_createDataPtrValidator(
    jnc_Box* box,
    const void* rangeBegin,
    size_t rangeLength
);

jnc_DataPtr
jnc_createForeignBufferPtr(
    const void* p,
    size_t size,
    bool_t isCallSiteLocal
);

jnc_String
jnc_createForeignString(
    const char* p,
    size_t length,
    bool_t isCallSiteLocal
);

jnc_String
jnc_createForeignString_sz(
    const char* p,
    size_t length,
    bool_t isCallSiteLocal
);

// macros

#define jnc_longJmp
#define jnc_setJmp