Improve packing of iseq_constant_body struct
By moving the two bools into a packing gap above the mark_bits pointer/union we can save 8 bytes in the struct and avoid an extra cache line (328 bytes vs 320 bytes). Co-authored-by: Adam Hess <HParker@github.com>
This commit is contained in:
parent
dcbea7671b
commit
def258e775
Notes:
git
2022-12-02 00:32:13 +00:00
@ -518,13 +518,13 @@ module RubyVM::MJIT
|
|||||||
icvarc_size: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), icvarc_size)")],
|
icvarc_size: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), icvarc_size)")],
|
||||||
ci_size: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), ci_size)")],
|
ci_size: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), ci_size)")],
|
||||||
stack_max: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), stack_max)")],
|
stack_max: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), stack_max)")],
|
||||||
|
catch_except_p: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), catch_except_p)")],
|
||||||
|
builtin_inline_p: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), builtin_inline_p)")],
|
||||||
mark_bits: [CType::Union.new(
|
mark_bits: [CType::Union.new(
|
||||||
"", Primitive.cexpr!("SIZEOF(((struct rb_iseq_constant_body *)NULL)->mark_bits)"),
|
"", Primitive.cexpr!("SIZEOF(((struct rb_iseq_constant_body *)NULL)->mark_bits)"),
|
||||||
list: CType::Pointer.new { self.iseq_bits_t },
|
list: CType::Pointer.new { self.iseq_bits_t },
|
||||||
single: self.iseq_bits_t,
|
single: self.iseq_bits_t,
|
||||||
), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), mark_bits)")],
|
), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), mark_bits)")],
|
||||||
catch_except_p: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), catch_except_p)")],
|
|
||||||
builtin_inline_p: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), builtin_inline_p)")],
|
|
||||||
outer_variables: [CType::Pointer.new { self.rb_id_table }, Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), outer_variables)")],
|
outer_variables: [CType::Pointer.new { self.rb_id_table }, Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), outer_variables)")],
|
||||||
mandatory_only_iseq: [CType::Pointer.new { self.rb_iseq_t }, Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), mandatory_only_iseq)")],
|
mandatory_only_iseq: [CType::Pointer.new { self.rb_iseq_t }, Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), mandatory_only_iseq)")],
|
||||||
jit_func: [CType::Immediate.parse("void *"), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), jit_func)")],
|
jit_func: [CType::Immediate.parse("void *"), Primitive.cexpr!("OFFSETOF((*((struct rb_iseq_constant_body *)NULL)), jit_func)")],
|
||||||
|
10
vm_core.h
10
vm_core.h
@ -483,10 +483,6 @@ struct rb_iseq_constant_body {
|
|||||||
unsigned int icvarc_size; // Number of ICVARC caches
|
unsigned int icvarc_size; // Number of ICVARC caches
|
||||||
unsigned int ci_size;
|
unsigned int ci_size;
|
||||||
unsigned int stack_max; /* for stack overflow check */
|
unsigned int stack_max; /* for stack overflow check */
|
||||||
union {
|
|
||||||
iseq_bits_t * list; /* Find references for GC */
|
|
||||||
iseq_bits_t single;
|
|
||||||
} mark_bits;
|
|
||||||
|
|
||||||
bool catch_except_p; // If a frame of this ISeq may catch exception, set true.
|
bool catch_except_p; // If a frame of this ISeq may catch exception, set true.
|
||||||
// If true, this ISeq is leaf *and* backtraces are not used, for example,
|
// If true, this ISeq is leaf *and* backtraces are not used, for example,
|
||||||
@ -495,6 +491,12 @@ struct rb_iseq_constant_body {
|
|||||||
// ObjectSpace#trace_object_allocations.
|
// ObjectSpace#trace_object_allocations.
|
||||||
// For more details, see: https://bugs.ruby-lang.org/issues/16956
|
// For more details, see: https://bugs.ruby-lang.org/issues/16956
|
||||||
bool builtin_inline_p;
|
bool builtin_inline_p;
|
||||||
|
|
||||||
|
union {
|
||||||
|
iseq_bits_t * list; /* Find references for GC */
|
||||||
|
iseq_bits_t single;
|
||||||
|
} mark_bits;
|
||||||
|
|
||||||
struct rb_id_table *outer_variables;
|
struct rb_id_table *outer_variables;
|
||||||
|
|
||||||
const rb_iseq_t *mandatory_only_iseq;
|
const rb_iseq_t *mandatory_only_iseq;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user