Skip to content

Instantly share code, notes, and snippets.

@timo
Created August 21, 2018 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timo/006fa069d16c9d5c210144f35e4cb3bf to your computer and use it in GitHub Desktop.
Save timo/006fa069d16c9d5c210144f35e4cb3bf to your computer and use it in GitHub Desktop.
how to reorder MVMStaticFrameBody to save some space
/* Moving 'specializable' from after 'no_inline' to after 'num_lexicals' */
struct MVMStaticFrameBody {
MVMuint8 * bytecode; /* 0 8 */
MVMCompUnit * cu; /* 8 8 */
MVMuint16 * local_types; /* 16 8 */
MVMuint16 * lexical_types; /* 24 8 */
MVMLexicalRegistry * lexical_names; /* 32 8 */
MVMLexicalRegistry * * lexical_names_list; /* 40 8 */
MVMRegister * static_env; /* 48 8 */
MVMuint8 * static_env_flags; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
MVMuint32 has_state_vars; /* 64 4 */
MVMuint32 instrumentation_level; /* 68 4 */
MVMStaticFrameSpesh * spesh; /* 72 8 */
MVMuint32 env_size; /* 80 4 */
MVMuint32 work_size; /* 84 4 */
MVMuint32 num_lexicals; /* 88 4 */
MVMuint8 specializable; /* 92 1 */
/* XXX 3 bytes hole, try to pack */
MVMRegister * work_initial; /* 96 8 */
MVMuint32 bytecode_size; /* 104 4 */
MVMuint32 num_locals; /* 108 4 */
MVMFrameHandler * handlers; /* 112 8 */
MVMuint32 num_handlers; /* 120 4 */
MVMuint8 fully_deserialized; /* 124 1 */
MVMuint8 is_thunk; /* 125 1 */
MVMuint8 has_exit_handler; /* 126 1 */
MVMuint8 allocate_on_heap; /* 127 1 */
/* --- cacheline 2 boundary (128 bytes) --- */
MVMuint8 no_inline; /* 128 1 */
/* XXX 7 bytes hole, try to pack */
MVMString * cuuid; /* 136 8 */
MVMString * name; /* 144 8 */
MVMStaticFrame * outer; /* 152 8 */
MVMCode * static_code; /* 160 8 */
MVMuint32 num_annotations; /* 168 4 */
/* XXX 4 bytes hole, try to pack */
MVMuint8 * annotations_data; /* 176 8 */
MVMuint8 * orig_bytecode; /* 184 8 */
/* --- cacheline 3 boundary (192 bytes) --- */
MVMuint8 * frame_data_pos; /* 192 8 */
MVMuint8 * frame_static_lex_pos; /* 200 8 */
MVMint32 code_obj_sc_dep_idx; /* 208 4 */
MVMint32 code_obj_sc_idx; /* 212 4 */
MVMStaticFrameInstrumentation * instrumentation; /* 216 8 */
/* size: 224, cachelines: 4, members: 37 */
/* sum members: 210, holes: 3, sum holes: 14 */
/* last cacheline: 32 bytes */
}
/* Moving 'no_inline' from after 'allocate_on_heap' to after 'specializable' */
struct MVMStaticFrameBody {
MVMuint8 * bytecode; /* 0 8 */
MVMCompUnit * cu; /* 8 8 */
MVMuint16 * local_types; /* 16 8 */
MVMuint16 * lexical_types; /* 24 8 */
MVMLexicalRegistry * lexical_names; /* 32 8 */
MVMLexicalRegistry * * lexical_names_list; /* 40 8 */
MVMRegister * static_env; /* 48 8 */
MVMuint8 * static_env_flags; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
MVMuint32 has_state_vars; /* 64 4 */
MVMuint32 instrumentation_level; /* 68 4 */
MVMStaticFrameSpesh * spesh; /* 72 8 */
MVMuint32 env_size; /* 80 4 */
MVMuint32 work_size; /* 84 4 */
MVMuint32 num_lexicals; /* 88 4 */
MVMuint8 specializable; /* 92 1 */
MVMuint8 no_inline; /* 93 1 */
/* XXX 2 bytes hole, try to pack */
MVMRegister * work_initial; /* 96 8 */
MVMuint32 bytecode_size; /* 104 4 */
MVMuint32 num_locals; /* 108 4 */
MVMFrameHandler * handlers; /* 112 8 */
MVMuint32 num_handlers; /* 120 4 */
MVMuint8 fully_deserialized; /* 124 1 */
MVMuint8 is_thunk; /* 125 1 */
MVMuint8 has_exit_handler; /* 126 1 */
MVMuint8 allocate_on_heap; /* 127 1 */
/* --- cacheline 2 boundary (128 bytes) --- */
MVMString * cuuid; /* 128 8 */
MVMString * name; /* 136 8 */
MVMStaticFrame * outer; /* 144 8 */
MVMCode * static_code; /* 152 8 */
MVMuint32 num_annotations; /* 160 4 */
/* XXX 4 bytes hole, try to pack */
MVMuint8 * annotations_data; /* 168 8 */
MVMuint8 * orig_bytecode; /* 176 8 */
MVMuint8 * frame_data_pos; /* 184 8 */
/* --- cacheline 3 boundary (192 bytes) --- */
MVMuint8 * frame_static_lex_pos; /* 192 8 */
MVMint32 code_obj_sc_dep_idx; /* 200 4 */
MVMint32 code_obj_sc_idx; /* 204 4 */
MVMStaticFrameInstrumentation * instrumentation; /* 208 8 */
/* size: 216, cachelines: 4, members: 37 */
/* sum members: 210, holes: 2, sum holes: 6 */
/* last cacheline: 24 bytes */
}
/* Moving 'allocate_on_heap' from after 'has_exit_handler' to after 'no_inline' */
struct MVMStaticFrameBody {
MVMuint8 * bytecode; /* 0 8 */
MVMCompUnit * cu; /* 8 8 */
MVMuint16 * local_types; /* 16 8 */
MVMuint16 * lexical_types; /* 24 8 */
MVMLexicalRegistry * lexical_names; /* 32 8 */
MVMLexicalRegistry * * lexical_names_list; /* 40 8 */
MVMRegister * static_env; /* 48 8 */
MVMuint8 * static_env_flags; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
MVMuint32 has_state_vars; /* 64 4 */
MVMuint32 instrumentation_level; /* 68 4 */
MVMStaticFrameSpesh * spesh; /* 72 8 */
MVMuint32 env_size; /* 80 4 */
MVMuint32 work_size; /* 84 4 */
MVMuint32 num_lexicals; /* 88 4 */
MVMuint8 specializable; /* 92 1 */
MVMuint8 no_inline; /* 93 1 */
MVMuint8 allocate_on_heap; /* 94 1 */
/* XXX 1 byte hole, try to pack */
MVMRegister * work_initial; /* 96 8 */
MVMuint32 bytecode_size; /* 104 4 */
MVMuint32 num_locals; /* 108 4 */
MVMFrameHandler * handlers; /* 112 8 */
MVMuint32 num_handlers; /* 120 4 */
MVMuint8 fully_deserialized; /* 124 1 */
MVMuint8 is_thunk; /* 125 1 */
MVMuint8 has_exit_handler; /* 126 1 */
/* XXX 1 byte hole, try to pack */
/* --- cacheline 2 boundary (128 bytes) --- */
MVMString * cuuid; /* 128 8 */
MVMString * name; /* 136 8 */
MVMStaticFrame * outer; /* 144 8 */
MVMCode * static_code; /* 152 8 */
MVMuint32 num_annotations; /* 160 4 */
/* XXX 4 bytes hole, try to pack */
MVMuint8 * annotations_data; /* 168 8 */
MVMuint8 * orig_bytecode; /* 176 8 */
MVMuint8 * frame_data_pos; /* 184 8 */
/* --- cacheline 3 boundary (192 bytes) --- */
MVMuint8 * frame_static_lex_pos; /* 192 8 */
MVMint32 code_obj_sc_dep_idx; /* 200 4 */
MVMint32 code_obj_sc_idx; /* 204 4 */
MVMStaticFrameInstrumentation * instrumentation; /* 208 8 */
/* size: 216, cachelines: 4, members: 37 */
/* sum members: 210, holes: 3, sum holes: 6 */
/* last cacheline: 24 bytes */
}
/* Moving 'has_exit_handler' from after 'is_thunk' to after 'allocate_on_heap' */
struct MVMStaticFrameBody {
MVMuint8 * bytecode; /* 0 8 */
MVMCompUnit * cu; /* 8 8 */
MVMuint16 * local_types; /* 16 8 */
MVMuint16 * lexical_types; /* 24 8 */
MVMLexicalRegistry * lexical_names; /* 32 8 */
MVMLexicalRegistry * * lexical_names_list; /* 40 8 */
MVMRegister * static_env; /* 48 8 */
MVMuint8 * static_env_flags; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
MVMuint32 has_state_vars; /* 64 4 */
MVMuint32 instrumentation_level; /* 68 4 */
MVMStaticFrameSpesh * spesh; /* 72 8 */
MVMuint32 env_size; /* 80 4 */
MVMuint32 work_size; /* 84 4 */
MVMuint32 num_lexicals; /* 88 4 */
MVMuint8 specializable; /* 92 1 */
MVMuint8 no_inline; /* 93 1 */
MVMuint8 allocate_on_heap; /* 94 1 */
MVMuint8 has_exit_handler; /* 95 1 */
MVMRegister * work_initial; /* 96 8 */
MVMuint32 bytecode_size; /* 104 4 */
MVMuint32 num_locals; /* 108 4 */
MVMFrameHandler * handlers; /* 112 8 */
MVMuint32 num_handlers; /* 120 4 */
MVMuint8 fully_deserialized; /* 124 1 */
MVMuint8 is_thunk; /* 125 1 */
/* XXX 2 bytes hole, try to pack */
/* --- cacheline 2 boundary (128 bytes) --- */
MVMString * cuuid; /* 128 8 */
MVMString * name; /* 136 8 */
MVMStaticFrame * outer; /* 144 8 */
MVMCode * static_code; /* 152 8 */
MVMuint32 num_annotations; /* 160 4 */
/* XXX 4 bytes hole, try to pack */
MVMuint8 * annotations_data; /* 168 8 */
MVMuint8 * orig_bytecode; /* 176 8 */
MVMuint8 * frame_data_pos; /* 184 8 */
/* --- cacheline 3 boundary (192 bytes) --- */
MVMuint8 * frame_static_lex_pos; /* 192 8 */
MVMint32 code_obj_sc_dep_idx; /* 200 4 */
MVMint32 code_obj_sc_idx; /* 204 4 */
MVMStaticFrameInstrumentation * instrumentation; /* 208 8 */
/* size: 216, cachelines: 4, members: 37 */
/* sum members: 210, holes: 2, sum holes: 6 */
/* last cacheline: 24 bytes */
}
/* Moving 'code_obj_sc_idx' from after 'code_obj_sc_dep_idx' to after 'num_annotations' */
struct MVMStaticFrameBody {
MVMuint8 * bytecode; /* 0 8 */
MVMCompUnit * cu; /* 8 8 */
MVMuint16 * local_types; /* 16 8 */
MVMuint16 * lexical_types; /* 24 8 */
MVMLexicalRegistry * lexical_names; /* 32 8 */
MVMLexicalRegistry * * lexical_names_list; /* 40 8 */
MVMRegister * static_env; /* 48 8 */
MVMuint8 * static_env_flags; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
MVMuint32 has_state_vars; /* 64 4 */
MVMuint32 instrumentation_level; /* 68 4 */
MVMStaticFrameSpesh * spesh; /* 72 8 */
MVMuint32 env_size; /* 80 4 */
MVMuint32 work_size; /* 84 4 */
MVMuint32 num_lexicals; /* 88 4 */
MVMuint8 specializable; /* 92 1 */
MVMuint8 no_inline; /* 93 1 */
MVMuint8 allocate_on_heap; /* 94 1 */
MVMuint8 has_exit_handler; /* 95 1 */
MVMRegister * work_initial; /* 96 8 */
MVMuint32 bytecode_size; /* 104 4 */
MVMuint32 num_locals; /* 108 4 */
MVMFrameHandler * handlers; /* 112 8 */
MVMuint32 num_handlers; /* 120 4 */
MVMuint8 fully_deserialized; /* 124 1 */
MVMuint8 is_thunk; /* 125 1 */
/* XXX 2 bytes hole, try to pack */
/* --- cacheline 2 boundary (128 bytes) --- */
MVMString * cuuid; /* 128 8 */
MVMString * name; /* 136 8 */
MVMStaticFrame * outer; /* 144 8 */
MVMCode * static_code; /* 152 8 */
MVMuint32 num_annotations; /* 160 4 */
MVMint32 code_obj_sc_idx; /* 164 4 */
MVMuint8 * annotations_data; /* 168 8 */
MVMuint8 * orig_bytecode; /* 176 8 */
MVMuint8 * frame_data_pos; /* 184 8 */
/* --- cacheline 3 boundary (192 bytes) --- */
MVMuint8 * frame_static_lex_pos; /* 192 8 */
MVMint32 code_obj_sc_dep_idx; /* 200 4 */
/* XXX 4 bytes hole, try to pack */
MVMStaticFrameInstrumentation * instrumentation; /* 208 8 */
/* size: 216, cachelines: 4, members: 37 */
/* sum members: 210, holes: 2, sum holes: 6 */
/* last cacheline: 24 bytes */
}
/* Final reorganized struct: */
struct MVMStaticFrameBody {
MVMuint8 * bytecode; /* 0 8 */
MVMCompUnit * cu; /* 8 8 */
MVMuint16 * local_types; /* 16 8 */
MVMuint16 * lexical_types; /* 24 8 */
MVMLexicalRegistry * lexical_names; /* 32 8 */
MVMLexicalRegistry * * lexical_names_list; /* 40 8 */
MVMRegister * static_env; /* 48 8 */
MVMuint8 * static_env_flags; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
MVMuint32 has_state_vars; /* 64 4 */
MVMuint32 instrumentation_level; /* 68 4 */
MVMStaticFrameSpesh * spesh; /* 72 8 */
MVMuint32 env_size; /* 80 4 */
MVMuint32 work_size; /* 84 4 */
MVMuint32 num_lexicals; /* 88 4 */
MVMuint8 specializable; /* 92 1 */
MVMuint8 no_inline; /* 93 1 */
MVMuint8 allocate_on_heap; /* 94 1 */
MVMuint8 has_exit_handler; /* 95 1 */
MVMRegister * work_initial; /* 96 8 */
MVMuint32 bytecode_size; /* 104 4 */
MVMuint32 num_locals; /* 108 4 */
MVMFrameHandler * handlers; /* 112 8 */
MVMuint32 num_handlers; /* 120 4 */
MVMuint8 fully_deserialized; /* 124 1 */
MVMuint8 is_thunk; /* 125 1 */
/* XXX 2 bytes hole, try to pack */
/* --- cacheline 2 boundary (128 bytes) --- */
MVMString * cuuid; /* 128 8 */
MVMString * name; /* 136 8 */
MVMStaticFrame * outer; /* 144 8 */
MVMCode * static_code; /* 152 8 */
MVMuint32 num_annotations; /* 160 4 */
MVMint32 code_obj_sc_idx; /* 164 4 */
MVMuint8 * annotations_data; /* 168 8 */
MVMuint8 * orig_bytecode; /* 176 8 */
MVMuint8 * frame_data_pos; /* 184 8 */
/* --- cacheline 3 boundary (192 bytes) --- */
MVMuint8 * frame_static_lex_pos; /* 192 8 */
MVMint32 code_obj_sc_dep_idx; /* 200 4 */
/* XXX 4 bytes hole, try to pack */
MVMStaticFrameInstrumentation * instrumentation; /* 208 8 */
/* size: 216, cachelines: 4, members: 37 */
/* sum members: 210, holes: 2, sum holes: 6 */
/* last cacheline: 24 bytes */
}; /* saved 8 bytes! */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment