Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,32 @@ jobs:
-DANDROID_PLATFORM=24 -DANDROID_ABI=arm64-v8a -DBUILD_SHARED_LIBS=OFF -DWITH_VM=OFF
cmake --build build

check-abi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Checkout current
- uses: actions/checkout@v6
name: Checkout 1.15
with:
path: hashlink_1.15
ref: 1.15
- run: |
sudo apt-get update
sudo apt-get install abigail-tools
name: Setup abi tools
- run: |
make DEBUG=1 -j8 libhl.so
name: Build current
- run: |
make -C hashlink_1.15 DEBUG=1 -j8 libhl
name: Build 1.15
- run: |
(cd hashlink_1.15 && abidw --header-file src/hl.h libhl.so > libhl.abi)
abidw --header-file src/hl.h libhl.so > libhl.abi

abidiff hashlink_1.15/libhl.abi libhl.abi --no-added-syms --suppr other/abidiff.suppr

haxe-test-suite:
needs: build
strategy:
Expand Down Expand Up @@ -527,7 +553,7 @@ jobs:
publish-latest-release:
###########################################################
runs-on: ubuntu-latest
needs: [build, haxe-test-suite]
needs: [build, check-abi, haxe-test-suite]
if: github.ref == 'refs/heads/master'
concurrency: publish-latest-release # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency

Expand Down
27 changes: 27 additions & 0 deletions other/abidiff.suppr
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[suppress_type]
type_kind = enum
name = hl_type_kind
changed_enumerators = HLAST

# pcre2 was accidentally exported by libhl.so
[suppress_function]
symbol_name_regexp = ^_?pcre(2|16)_
drop = yes

[suppress_variable]
symbol_name_regexp = ^_?pcre(2|16)_
drop = yes

# accidentally exported, but never part of hl.h
[suppress_function]
symbol_name_regexp = hl_(cache_init|internal_capture_stack|mlookup_alloc|mlookup_find|mlookup_set_impl)
drop = yes

[suppress_function]
symbol_name_regexp = gc_get_mark_threads
drop = yes

# exported explicitly, but never part of hl.h
[suppress_variable]
symbol_name_regexp = hl_closure_stack_capture
drop = yes
11 changes: 10 additions & 1 deletion src/hl.h
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ typedef struct {
} hl_setup_t;

HL_API hl_setup_t hl_setup;
HL_API void hl_sys_init();
HL_API void hl_sys_init( void **args, int nargs, void *hlfile );

HL_API double hl_nan( void );
HL_API bool hl_is_dynamic( hl_type *t );
Expand Down Expand Up @@ -1020,6 +1020,15 @@ HL_API hl_track_info hl_track;

#endif

// -------------- COMPAT ------------------------------------

HL_API void hl_setup_longjump( void *j );
HL_API void hl_setup_exception( void *resolve_symbol, void *capture_stack );
HL_API void hl_set_debug_mode( bool b );
HL_API void hl_setup_callbacks(void* sc, void* gw);
HL_API void hl_setup_callbacks2(void* sc, void* gw, int flags);
HL_API void hl_setup_reload_check( void *freload, void *param );

C_FUNCTION_END

#endif
2 changes: 1 addition & 1 deletion src/hlc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) {
hl_setup.get_wrapper = hlc_get_wrapper;
hl_setup.sys_args = (pchar**)(argv + 1);
hl_setup.sys_nargs = argc - 1;
hl_sys_init();
hl_sys_init(NULL, 0, NULL);
tf.ret = &hlt_void;
clt.kind = HFUN;
clt.fun = &tf;
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int main(int argc, pchar *argv[]) {
hl_setup.file_path = file;
hl_setup.sys_args = (pchar**)argv;
hl_setup.sys_nargs = argc;
hl_sys_init();
hl_sys_init(NULL, 0, NULL);
hl_register_thread(&ctx);
main_ctx = &ctx;
ctx.file = file;
Expand Down
15 changes: 15 additions & 0 deletions src/std/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,27 @@ HL_PRIM uchar *hl_resolve_symbol( void *addr, uchar *out, int *outSize ) {
return hl_setup.resolve_symbol(addr, out, outSize);
}

static void (*throw_jump)( jmp_buf, int ) = NULL;

HL_PRIM void hl_setup_longjump( void *j ) {
throw_jump = j;
}

HL_PRIM void hl_setup_exception( void *resolve_symbol, void *capture_stack ) {
hl_setup.resolve_symbol = resolve_symbol;
hl_setup.capture_stack = capture_stack;
}

HL_PRIM void hl_set_error_handler( vclosure *d ) {
hl_thread_info *t = hl_get_thread();
t->trap_uncaught = t->trap_current;
t->exc_handler = d;
}

HL_PRIM void hl_set_debug_mode( bool b ) {
hl_setup.is_debugger_enabled = b;
}

static bool break_on_trap( hl_thread_info *t, hl_trap_ctx *trap, vdynamic *v ) {
bool unwrapped = false;
vdynamic *vvalue = NULL;
Expand Down
14 changes: 14 additions & 0 deletions src/std/fun.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ HL_PRIM bool hl_fun_compare( vdynamic *a, vdynamic *b ) {

// ------------ DYNAMIC CALLS

typedef void *(*fptr_static_call)(void *fun, hl_type *t, void **args, vdynamic *out);
typedef void *(*fptr_get_wrapper)(hl_type *t);

HL_PRIM void hl_setup_callbacks2( void *c, void *w, int flags ) {
hl_setup.static_call = (fptr_static_call)c;
hl_setup.get_wrapper = (fptr_get_wrapper)w;
hl_setup.static_call_ref = flags & 1;
}

HL_PRIM void hl_setup_callbacks( void *c, void *w ) {
hl_setup.static_call = (fptr_static_call)c;
hl_setup.get_wrapper = (fptr_get_wrapper)w;
}

#define HL_MAX_ARGS 9

HL_PRIM vdynamic* hl_call_method( vdynamic *c, varray *args ) {
Expand Down
39 changes: 37 additions & 2 deletions src/std/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ HL_PRIM void hl_sys_print( vbyte *msg ) {
hl_blocking(false);
}

HL_PRIM void hl_setup_profiler( void *profile_event, void *before_exit ) {
hl_setup.before_exit = before_exit;
hl_setup.profile_event = profile_event;
}

HL_PRIM void hl_sys_profile_event( int code, vbyte *data, int dataLen ) {
if( hl_setup.profile_event ) hl_setup.profile_event(code, data, dataLen);
}
Expand All @@ -168,6 +173,18 @@ HL_PRIM void hl_sys_exit( int code ) {
exit(code);
}

static void *f_vtune_init = NULL;
static void *g_vtune_module = NULL;
static void setup_vtune_wrapper() {
((void(*)(void*))f_vtune_init)(g_vtune_module);
}

HL_PRIM void hl_setup_vtune( void *vtune_init, void *m ) {
f_vtune_init = vtune_init;
g_vtune_module = m;
hl_setup.vtune_init = setup_vtune_wrapper;
}

HL_PRIM void hl_sys_vtune_init() {
if( hl_setup.vtune_init ) hl_setup.vtune_init();
}
Expand Down Expand Up @@ -674,10 +691,16 @@ HL_PRIM varray *hl_sys_args() {
return a;
}

HL_PRIM void hl_sys_init() {
HL_PRIM void hl_sys_init(void **args, int nargs, void *hlfile) {
#ifdef HL_WIN
QueryPerformanceFrequency(&qpcFrequency);
#endif
if (hlfile)
hl_setup.file_path = (pchar*)hlfile;
if (args)
hl_setup.sys_args = (pchar**)args;
if (nargs)
hl_setup.sys_nargs = nargs;
# ifdef HL_WIN_DESKTOP
setlocale(LC_CTYPE, ""); // printf to current locale
# endif
Expand All @@ -687,6 +710,18 @@ HL_PRIM vbyte *hl_sys_hl_file() {
return (vbyte*)hl_setup.file_path;
}

static void *compat_reload_fun = NULL;
static void *compat_reload_param = NULL;
static bool reload_wrapper() {
return ((bool(*)(void*))compat_reload_fun)(compat_reload_param);
}

HL_PRIM void hl_setup_reload_check( void *freload, void *param ) {
compat_reload_fun = freload;
compat_reload_param = param;
hl_setup.reload_check = reload_wrapper;
}

HL_PRIM bool hl_sys_check_reload( vbyte *debug_alt_file ) {
return hl_setup.reload_check != NULL && hl_setup.reload_check(debug_alt_file);
}
Expand All @@ -696,7 +731,7 @@ HL_PRIM bool hl_sys_has_debugger() {
}

#ifndef HL_MOBILE
const char *hl_sys_special( const char *key ) {
HL_PRIM const char *hl_sys_special( const char *key ) {
hl_error("Unknown sys_special key");
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/std/sys_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static const char* hl_sys_android_get_internal_storage_path(void)
return hl_android_internal_files_path;
}

const char *hl_sys_special( const char *key ) {
HL_PRIM const char *hl_sys_special( const char *key ) {
if (strcmp(key, "android_external_storage_path")==0)
return hl_sys_android_get_external_storage_path();
else if (strcmp(key, "android_internal_storage_path")==0)
Expand All @@ -239,4 +239,4 @@ const char *hl_sys_special( const char *key ) {

DEFINE_PRIM(_BYTES, sys_special, _BYTES);

#endif
#endif
2 changes: 1 addition & 1 deletion src/std/sys_ios.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static int ios_get_retina_scale_factor()
return [[UIScreen mainScreen] scale];
}

const char *hl_sys_special( const char *key ) {
HL_PRIM const char *hl_sys_special( const char *key ) {
if (strcmp(key, "ios_resource_path")==0)
return ios_get_resource_path();
else if (strcmp(key, "ios_document_path")==0)
Expand Down
Loading