diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | compile.c | 4 | ||||
-rw-r--r-- | iseq.c | 6 | ||||
-rw-r--r-- | iseq.h | 10 |
4 files changed, 15 insertions, 10 deletions
@@ -1,3 +1,8 @@ +Sat Jul 26 16:55:18 2014 Eric Wong <e@80x24.org> + + * iseq.h (struct iseq_compile_data_storage): reduce overhead + to 16 bytes (from 32) on 64-bit + Sat Jul 26 16:28:06 2014 Eric Wong <e@80x24.org> * vm_core.h (struct rb_iseq_struct): reduce to 280 bytes @@ -604,13 +604,11 @@ compile_data_alloc(rb_iseq_t *iseq, size_t size) goto retry; } storage->next = (void *)ALLOC_N(char, alloc_size + - sizeof(struct - iseq_compile_data_storage)); + SIZEOF_ISEQ_COMPILE_DATA_STORAGE); storage = iseq->compile_data->storage_current = storage->next; storage->next = 0; storage->pos = 0; storage->size = alloc_size; - storage->buff = (char *)(&storage->buff + 1); } ptr = (void *)&storage->buff[storage->pos]; @@ -153,7 +153,7 @@ iseq_memsize(const void *ptr) cur = iseq->compile_data->storage_head; while (cur) { - size += cur->size + sizeof(struct iseq_compile_data_storage); + size += cur->size + SIZEOF_ISEQ_COMPILE_DATA_STORAGE; cur = cur->next; } size += sizeof(struct iseq_compile_data); @@ -293,15 +293,13 @@ prepare_iseq_build(rb_iseq_t *iseq, iseq->compile_data->storage_head = iseq->compile_data->storage_current = (struct iseq_compile_data_storage *) ALLOC_N(char, INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE + - sizeof(struct iseq_compile_data_storage)); + SIZEOF_ISEQ_COMPILE_DATA_STORAGE); RB_OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, rb_ary_new()); iseq->compile_data->storage_head->pos = 0; iseq->compile_data->storage_head->next = 0; iseq->compile_data->storage_head->size = INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE; - iseq->compile_data->storage_head->buff = - (char *)(&iseq->compile_data->storage_head->buff + 1); iseq->compile_data->option = option; iseq->compile_data->last_coverable_line = -1; @@ -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; |