From c5a5563dbe48497fd00a14de82ec359204b06365 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 29 Jul 2018 01:32:37 +0000 Subject: repack structs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Repack rb_thread_struct, rb_execution_context_struct, args_info and iseq_compile_data to save 1 word per struct. re_pattern_buffer remains unpacked due to the possible binary compatibility. [Fix GH-1907] Based on the patch From: Lourens Naudé git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.h | 2 +- vm_args.c | 2 +- vm_core.h | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/iseq.h b/iseq.h index eba17168eb..b8c10d8816 100644 --- a/iseq.h +++ b/iseq.h @@ -93,9 +93,9 @@ struct iseq_compile_data { VALUE ensure_node; VALUE for_iseq; struct iseq_compile_data_ensure_node_stack *ensure_node_stack; - int loopval_popped; /* used by NODE_BREAK */ struct iseq_compile_data_storage *storage_head; struct iseq_compile_data_storage *storage_current; + int loopval_popped; /* used by NODE_BREAK */ int last_line; int label_no; int node_level; diff --git a/vm_args.c b/vm_args.c index 0c7db1cb9d..ef5193b77f 100644 --- a/vm_args.c +++ b/vm_args.c @@ -19,10 +19,10 @@ struct args_info { /* basic args info */ VALUE *argv; int argc; - const struct rb_call_info_kw_arg *kw_arg; /* additional args info */ int rest_index; + const struct rb_call_info_kw_arg *kw_arg; VALUE *kw_argv; VALUE rest; }; diff --git a/vm_core.h b/vm_core.h index 73ef51da49..67c384c509 100644 --- a/vm_core.h +++ b/vm_core.h @@ -807,7 +807,6 @@ typedef struct rb_execution_context_struct { struct rb_vm_tag *tag; struct rb_vm_protect_tag *protect_tag; - int raised_flag; /* interrupt flags */ rb_atomic_t interrupt_flag; @@ -835,6 +834,7 @@ typedef struct rb_execution_context_struct { VALUE errinfo; VALUE passed_block_handler; /* for rb_iterate */ const rb_callable_method_entry_t *passed_bmethod_me; /* for bmethod */ + int raised_flag; enum method_missing_reason method_missing_reason; VALUE private_const_reference; @@ -893,7 +893,6 @@ typedef struct rb_thread_struct { /* async errinfo queue */ VALUE pending_interrupt_queue; VALUE pending_interrupt_mask_stack; - int pending_interrupt_queue_checked; /* interrupt management */ rb_nativethread_lock_t interrupt_lock; @@ -915,10 +914,13 @@ typedef struct rb_thread_struct { rb_jmpbuf_t root_jmpbuf; /* misc */ + VALUE name; + uint32_t running_time_us; /* 12500..800000 */ + + /* bit flags */ unsigned int abort_on_exception: 1; unsigned int report_on_exception: 1; - uint32_t running_time_us; /* 12500..800000 */ - VALUE name; + unsigned int pending_interrupt_queue_checked: 1; } rb_thread_t; typedef enum { -- cgit v1.2.3