From b3a4367ce40912344310eded05e3d6fa5657330f Mon Sep 17 00:00:00 2001 From: normal Date: Wed, 10 Sep 2014 06:32:44 +0000 Subject: rb_call_info_t: shrink to 96 bytes from 104 bytes on 64-bit This keeps ci->flag and ci->aux.index consistent across 32-bit and 64-bit platforms. ci->flag: VM_CALL_* flags only use 9 bits, currently ci->aux.index: 2 billion ivars per class should be enough for anybody This saves around 50K allocations on "valgrind ruby -e exit" on x86-64 before: total heap usage: 48,122 allocs, 19,253 frees, 8,099,197 bytes allocated after: total heap usage: 48,069 allocs, 19,214 frees, 8,047,266 bytes allocated * vm_core.h (rb_call_info_t): ci->flag becomes 32-bit unsigned int ci->index becomes a 32-bit signed int (from signed long). Reorder for better packing on 64-bit, giving an 8 byte reduction from 104 to 96 bytes for each ci. * compile.c (new_callinfo, setup_args, iseq_compile_each, iseq_build_from_ary_body): adjust for type changes * vm_insnhelper.c (vm_getivar): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_core.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index dfbc8c7f76..f5ddb17a47 100644 --- a/vm_core.h +++ b/vm_core.h @@ -140,11 +140,9 @@ struct rb_control_frame_struct; typedef struct rb_call_info_struct { /* fixed at compile time */ ID mid; - VALUE flag; - rb_iseq_t *blockiseq; + unsigned int flag; int orig_argc; - - int argc; /* temporary for method calling */ + rb_iseq_t *blockiseq; /* inline cache: keys */ rb_serial_t method_state; @@ -158,9 +156,10 @@ typedef struct rb_call_info_struct { /* temporary values for method calling */ struct rb_block_struct *blockptr; VALUE recv; + int argc; union { int opt_pc; /* used by iseq */ - long index; /* used by ivar */ + int index; /* used by ivar */ int missing_reason; /* used by method_missing */ int inc_sp; /* used by cfunc */ } aux; -- cgit v1.2.3