@@ -72,21 +72,20 @@ typedef struct _jl_tls_states_t *jl_ptls_t;
72
72
#endif
73
73
#include "gc-interface.h"
74
74
#include "julia_atomics.h"
75
- #include "julia_threads.h"
76
75
#include "julia_assert.h"
77
76
77
+ // the common fields are hidden before the pointer, but the following macro is
78
+ // used to indicate which types below are subtypes of jl_value_t
79
+ #define JL_DATA_TYPE
80
+ typedef struct _jl_value_t jl_value_t ;
81
+ #include "julia_threads.h"
82
+
78
83
#ifdef __cplusplus
79
84
extern "C" {
80
85
#endif
81
86
82
87
// core data types ------------------------------------------------------------
83
88
84
- // the common fields are hidden before the pointer, but the following macro is
85
- // used to indicate which types below are subtypes of jl_value_t
86
- #define JL_DATA_TYPE
87
-
88
- typedef struct _jl_value_t jl_value_t ;
89
-
90
89
struct _jl_taggedvalue_bits {
91
90
uintptr_t gc :2 ;
92
91
uintptr_t in_image :1 ;
@@ -484,9 +483,6 @@ typedef struct _jl_abi_override_t {
484
483
jl_method_instance_t * def ;
485
484
} jl_abi_override_t ;
486
485
487
- // all values are callable as Functions
488
- typedef jl_value_t jl_function_t ;
489
-
490
486
typedef struct {
491
487
JL_DATA_TYPE
492
488
jl_sym_t * name ;
@@ -2265,12 +2261,8 @@ JL_DLLEXPORT void jl_sigatomic_end(void);
2265
2261
2266
2262
// tasks and exceptions -------------------------------------------------------
2267
2263
2268
- typedef struct _jl_timing_block_t jl_timing_block_t ;
2269
- typedef struct _jl_timing_event_t jl_timing_event_t ;
2270
- typedef struct _jl_excstack_t jl_excstack_t ;
2271
-
2272
2264
// info describing an exception handler
2273
- typedef struct _jl_handler_t {
2265
+ struct _jl_handler_t {
2274
2266
jl_jmp_buf eh_ctx ;
2275
2267
jl_gcframe_t * gcstack ;
2276
2268
jl_value_t * scope ;
@@ -2280,68 +2272,7 @@ typedef struct _jl_handler_t {
2280
2272
sig_atomic_t defer_signal ;
2281
2273
jl_timing_block_t * timing_stack ;
2282
2274
size_t world_age ;
2283
- } jl_handler_t ;
2284
-
2285
- #define JL_RNG_SIZE 5 // xoshiro 4 + splitmix 1
2286
-
2287
- typedef struct _jl_task_t {
2288
- JL_DATA_TYPE
2289
- jl_value_t * next ; // invasive linked list for scheduler
2290
- jl_value_t * queue ; // invasive linked list for scheduler
2291
- jl_value_t * tls ;
2292
- jl_value_t * donenotify ;
2293
- jl_value_t * result ;
2294
- jl_value_t * scope ;
2295
- jl_function_t * start ;
2296
- _Atomic (uint8_t ) _state ;
2297
- uint8_t sticky ; // record whether this Task can be migrated to a new thread
2298
- uint16_t priority ;
2299
- _Atomic (uint8_t ) _isexception ; // set if `result` is an exception to throw or that we exited with
2300
- uint8_t pad0 [3 ];
2301
- // === 64 bytes (cache line)
2302
- uint64_t rngState [JL_RNG_SIZE ];
2303
- // flag indicating whether or not to record timing metrics for this task
2304
- uint8_t metrics_enabled ;
2305
- uint8_t pad1 [3 ];
2306
- // timestamp this task first entered the run queue
2307
- _Atomic (uint64_t ) first_enqueued_at ;
2308
- // timestamp this task was most recently scheduled to run
2309
- _Atomic (uint64_t ) last_started_running_at ;
2310
- // time this task has spent running; updated when it yields or finishes.
2311
- _Atomic (uint64_t ) running_time_ns ;
2312
- // === 64 bytes (cache line)
2313
- // timestamp this task finished (i.e. entered state DONE or FAILED).
2314
- _Atomic (uint64_t ) finished_at ;
2315
-
2316
- // hidden state:
2317
-
2318
- // id of owning thread - does not need to be defined until the task runs
2319
- _Atomic (int16_t ) tid ;
2320
- // threadpool id
2321
- int8_t threadpoolid ;
2322
- // Reentrancy bits
2323
- // Bit 0: 1 if we are currently running inference/codegen
2324
- // Bit 1-2: 0-3 counter of how many times we've reentered inference
2325
- // Bit 3: 1 if we are writing the image and inference is illegal
2326
- uint8_t reentrant_timing ;
2327
- // 2 bytes of padding on 32-bit, 6 bytes on 64-bit
2328
- // uint16_t padding2_32;
2329
- // uint48_t padding2_64;
2330
- // saved gc stack top for context switches
2331
- jl_gcframe_t * gcstack ;
2332
- size_t world_age ;
2333
- // quick lookup for current ptls
2334
- jl_ptls_t ptls ; // == jl_all_tls_states[tid]
2335
- #ifdef USE_TRACY
2336
- const char * name ;
2337
- #endif
2338
- // saved exception stack
2339
- jl_excstack_t * excstack ;
2340
- // current exception handler
2341
- jl_handler_t * eh ;
2342
- // saved thread state
2343
- jl_ucontext_t ctx ; // pointer into stkbuf, if suspended
2344
- } jl_task_t ;
2275
+ };
2345
2276
2346
2277
#define JL_TASK_STATE_RUNNABLE 0
2347
2278
#define JL_TASK_STATE_DONE 1
0 commit comments