mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_core.h (rb_thread_t): pack small fields together
On a 64-bit system, this reduces rb_thread_t from 536 to 520 bytes. Depending on the allocation, this can reduce cacheline access for checking the abort_on_exception, report_on_exception and pending_interrupt_queue_checked flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
906ad1670a
commit
727a2d55a3
2 changed files with 9 additions and 9 deletions
2
thread.c
2
thread.c
|
@ -3608,7 +3608,7 @@ rb_thread_priority_set(VALUE thread, VALUE prio)
|
||||||
else if (priority < RUBY_THREAD_PRIORITY_MIN) {
|
else if (priority < RUBY_THREAD_PRIORITY_MIN) {
|
||||||
priority = RUBY_THREAD_PRIORITY_MIN;
|
priority = RUBY_THREAD_PRIORITY_MIN;
|
||||||
}
|
}
|
||||||
target_th->priority = priority;
|
target_th->priority = (int8_t)priority;
|
||||||
#endif
|
#endif
|
||||||
return INT2NUM(target_th->priority);
|
return INT2NUM(target_th->priority);
|
||||||
}
|
}
|
||||||
|
|
16
vm_core.h
16
vm_core.h
|
@ -879,9 +879,14 @@ typedef struct rb_thread_struct {
|
||||||
#ifdef NON_SCALAR_THREAD_ID
|
#ifdef NON_SCALAR_THREAD_ID
|
||||||
rb_thread_id_string_t thread_id_string;
|
rb_thread_id_string_t thread_id_string;
|
||||||
#endif
|
#endif
|
||||||
enum rb_thread_status status;
|
BITFIELD(enum rb_thread_status) status : 2;
|
||||||
int to_kill;
|
/* bit flags */
|
||||||
int priority;
|
unsigned int to_kill : 1;
|
||||||
|
unsigned int abort_on_exception: 1;
|
||||||
|
unsigned int report_on_exception: 1;
|
||||||
|
unsigned int pending_interrupt_queue_checked: 1;
|
||||||
|
int8_t priority; /* -3 .. 3 (RUBY_THREAD_PRIORITY_{MIN,MAX}) */
|
||||||
|
uint32_t running_time_us; /* 12500..800000 */
|
||||||
|
|
||||||
native_thread_data_t native_thread_data;
|
native_thread_data_t native_thread_data;
|
||||||
void *blocking_region_buffer;
|
void *blocking_region_buffer;
|
||||||
|
@ -919,12 +924,7 @@ typedef struct rb_thread_struct {
|
||||||
|
|
||||||
/* misc */
|
/* misc */
|
||||||
VALUE name;
|
VALUE name;
|
||||||
uint32_t running_time_us; /* 12500..800000 */
|
|
||||||
|
|
||||||
/* bit flags */
|
|
||||||
unsigned int abort_on_exception: 1;
|
|
||||||
unsigned int report_on_exception: 1;
|
|
||||||
unsigned int pending_interrupt_queue_checked: 1;
|
|
||||||
} rb_thread_t;
|
} rb_thread_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue