From 36b476cd1e24f0f0b472d86cdf422f5e2085b7f5 Mon Sep 17 00:00:00 2001 From: normal Date: Sat, 26 Jul 2014 07:57:44 +0000 Subject: struct iseq_compile_data_storage: 16 bytes (from 32) overhead This reduces the iseq_compile_data_storage header from 32 to 16 bytes on 64-bit systems. pos and size fields cannot exceed 32-bit sizes due to stack size limits. Using a flexible array for the buffer also saves us 8 bytes of pointer overhead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'iseq.h') diff --git a/iseq.h b/iseq.h index 9a225180df..da2b678c1b 100644 --- a/iseq.h +++ b/iseq.h @@ -88,11 +88,15 @@ iseq_catch_table_bytes(int n) struct iseq_compile_data_storage { struct iseq_compile_data_storage *next; - unsigned long pos; - unsigned long size; - char *buff; + unsigned int pos; + unsigned int size; + char buff[1]; /* flexible array */ }; +/* account for flexible array */ +#define SIZEOF_ISEQ_COMPILE_DATA_STORAGE \ + (sizeof(struct iseq_compile_data_storage) - 1) + struct iseq_compile_data { /* GC is needed */ const VALUE err_info; -- cgit v1.2.3