From def258e77544409df507c0fa153cf40e84d65082 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 1 Dec 2022 11:51:18 -0800 Subject: 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 --- vm_core.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index 98ac69b1e8..e921629619 100644 --- a/vm_core.h +++ b/vm_core.h @@ -483,10 +483,6 @@ struct rb_iseq_constant_body { unsigned int icvarc_size; // Number of ICVARC caches unsigned int ci_size; 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. // 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. // For more details, see: https://bugs.ruby-lang.org/issues/16956 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; const rb_iseq_t *mandatory_only_iseq; -- cgit v1.2.3