Skip to content

Commit

Permalink
make Task smaller by rearranging fields (JuliaLang#41351)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JeffBezanson authored and johanmon committed Jul 5, 2021
1 parent eaf220d commit 2b3f225
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2539,13 +2539,13 @@ void jl_init_types(void) JL_GC_DISABLED
"result",
"logstate",
"code",
"_state",
"sticky",
"_isexception",
"rngState0",
"rngState1",
"rngState2",
"rngState3"),
"rngState3",
"_state",
"sticky",
"_isexception"),
jl_svec(14,
jl_any_type,
jl_any_type,
Expand All @@ -2554,13 +2554,13 @@ void jl_init_types(void) JL_GC_DISABLED
jl_any_type,
jl_any_type,
jl_any_type,
jl_uint8_type,
jl_bool_type,
jl_bool_type,
jl_uint64_type,
jl_uint64_type,
jl_uint64_type,
jl_uint64_type),
jl_uint64_type,
jl_uint8_type,
jl_bool_type,
jl_bool_type),
jl_emptysvec,
0, 1, 6);
jl_value_t *listt = jl_new_struct(jl_uniontype_type, jl_task_type, jl_nothing_type);
Expand Down
14 changes: 7 additions & 7 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1829,24 +1829,24 @@ typedef struct _jl_task_t {
jl_value_t *result;
jl_value_t *logstate;
jl_function_t *start;
uint8_t _state;
uint8_t sticky; // record whether this Task can be migrated to a new thread
uint8_t _isexception; // set if `result` is an exception to throw or that we exited with
uint64_t rngState0; // really rngState[4], but more convenient to split
uint64_t rngState1;
uint64_t rngState2;
uint64_t rngState3;
uint8_t _state;
uint8_t sticky; // record whether this Task can be migrated to a new thread
uint8_t _isexception; // set if `result` is an exception to throw or that we exited with

// hidden state:
// id of owning thread - does not need to be defined until the task runs
int16_t tid;
// multiqueue priority
int16_t prio;
// saved gc stack top for context switches
jl_gcframe_t *gcstack;
size_t world_age;
// quick lookup for current ptls
jl_tls_states_t *ptls; // == jl_all_tls_states[tid]
// id of owning thread - does not need to be defined until the task runs
int16_t tid;
// multiqueue priority
int16_t prio;
// saved exception stack
jl_excstack_t *excstack;
// current exception handler
Expand Down

0 comments on commit 2b3f225

Please sign in to comment.