Skip to content

Commit bafa35c

Browse files
JeffBezansonKristofferC
authored andcommitted
make Task smaller by rearranging fields (#41351)
This makes jl_task_t 8 bytes smaller, moving it into the next-smallest pool, which drops the effective size from 400 to 368 bytes. (cherry picked from commit af4bbfd)
1 parent 49961fb commit bafa35c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/jltypes.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,13 +2539,13 @@ void jl_init_types(void) JL_GC_DISABLED
25392539
"result",
25402540
"logstate",
25412541
"code",
2542-
"_state",
2543-
"sticky",
2544-
"_isexception",
25452542
"rngState0",
25462543
"rngState1",
25472544
"rngState2",
2548-
"rngState3"),
2545+
"rngState3",
2546+
"_state",
2547+
"sticky",
2548+
"_isexception"),
25492549
jl_svec(14,
25502550
jl_any_type,
25512551
jl_any_type,
@@ -2554,13 +2554,13 @@ void jl_init_types(void) JL_GC_DISABLED
25542554
jl_any_type,
25552555
jl_any_type,
25562556
jl_any_type,
2557-
jl_uint8_type,
2558-
jl_bool_type,
2559-
jl_bool_type,
25602557
jl_uint64_type,
25612558
jl_uint64_type,
25622559
jl_uint64_type,
2563-
jl_uint64_type),
2560+
jl_uint64_type,
2561+
jl_uint8_type,
2562+
jl_bool_type,
2563+
jl_bool_type),
25642564
jl_emptysvec,
25652565
0, 1, 6);
25662566
jl_value_t *listt = jl_new_struct(jl_uniontype_type, jl_task_type, jl_nothing_type);

src/julia.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,24 +1829,24 @@ typedef struct _jl_task_t {
18291829
jl_value_t *result;
18301830
jl_value_t *logstate;
18311831
jl_function_t *start;
1832-
uint8_t _state;
1833-
uint8_t sticky; // record whether this Task can be migrated to a new thread
1834-
uint8_t _isexception; // set if `result` is an exception to throw or that we exited with
18351832
uint64_t rngState0; // really rngState[4], but more convenient to split
18361833
uint64_t rngState1;
18371834
uint64_t rngState2;
18381835
uint64_t rngState3;
1836+
uint8_t _state;
1837+
uint8_t sticky; // record whether this Task can be migrated to a new thread
1838+
uint8_t _isexception; // set if `result` is an exception to throw or that we exited with
18391839

18401840
// hidden state:
1841+
// id of owning thread - does not need to be defined until the task runs
1842+
int16_t tid;
1843+
// multiqueue priority
1844+
int16_t prio;
18411845
// saved gc stack top for context switches
18421846
jl_gcframe_t *gcstack;
18431847
size_t world_age;
18441848
// quick lookup for current ptls
18451849
jl_tls_states_t *ptls; // == jl_all_tls_states[tid]
1846-
// id of owning thread - does not need to be defined until the task runs
1847-
int16_t tid;
1848-
// multiqueue priority
1849-
int16_t prio;
18501850
// saved exception stack
18511851
jl_excstack_t *excstack;
18521852
// current exception handler

0 commit comments

Comments
 (0)