Skip to content

Commit faced27

Browse files
authored
Export offsets necessary for external codegen (#49548)
1 parent 219dc10 commit faced27

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,10 @@ JL_DLLEXPORT void julia_init(JL_IMAGE_SEARCH rel)
771771

772772
jl_init_intrinsic_properties();
773773

774+
// Important offset for external codegen.
775+
jl_task_gcstack_offset = offsetof(jl_task_t, gcstack);
776+
jl_task_ptls_offset = offsetof(jl_task_t, ptls);
777+
774778
jl_prep_sanitizers();
775779
void *stack_lo, *stack_hi;
776780
jl_init_stack_limits(1, &stack_lo, &stack_hi);

src/jl_exported_data.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,7 @@
133133
XX(jl_n_threads, _Atomic(int)) \
134134
XX(jl_n_gcthreads, int) \
135135
XX(jl_options, jl_options_t) \
136+
XX(jl_task_gcstack_offset, int) \
137+
XX(jl_task_ptls_offset, int) \
136138

137139
// end of file

src/julia.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,9 @@ JL_DLLEXPORT void JL_NORETURN jl_no_exc_handler(jl_value_t *e, jl_task_t *ct);
19921992
JL_DLLEXPORT JL_CONST_FUNC jl_gcframe_t **(jl_get_pgcstack)(void) JL_GLOBALLY_ROOTED JL_NOTSAFEPOINT;
19931993
#define jl_current_task (container_of(jl_get_pgcstack(), jl_task_t, gcstack))
19941994

1995+
extern JL_DLLIMPORT int jl_task_gcstack_offset;
1996+
extern JL_DLLIMPORT int jl_task_ptls_offset;
1997+
19951998
#include "julia_locks.h" // requires jl_task_t definition
19961999

19972000
JL_DLLEXPORT void jl_enter_handler(jl_handler_t *eh);

0 commit comments

Comments
 (0)