rb_{thread,context,fiber}_struct: trivial packing

* vm_core.h (rb_thread_struct): reorder to pack
* cont.c (rb_context_struct, rb_fiber_struct): ditto
  On x86-64, these changes reduces:
  rb_thread_struct to 1000 bytes (from 1016)
  rb_context_struct to 1288 bytes (from 1312)
  rb_fiber_struct to 2272 bytes (from 2304)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2014-08-15 00:25:34 +00:00
Родитель fdb2fc0b04
Коммит 90037145dd
3 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Fri Aug 15 09:22:12 2014 Eric Wong <e@80x24.org>
* vm_core.h (rb_thread_struct): reorder to pack
* cont.c (rb_context_struct, rb_fiber_struct): ditto
On x86-64, these changes reduces:
rb_thread_struct to 1000 bytes (from 1016)
rb_context_struct to 1288 bytes (from 1312)
rb_fiber_struct to 2272 bytes (from 2304)
Fri Aug 15 09:06:31 2014 Eric Wong <e@80x24.org> Fri Aug 15 09:06:31 2014 Eric Wong <e@80x24.org>
* thread_pthread.h: define RB_NATIVETHREAD_LOCK_INIT and * thread_pthread.h: define RB_NATIVETHREAD_LOCK_INIT and

6
cont.c
Просмотреть файл

@ -89,8 +89,8 @@ enum context_type {
typedef struct rb_context_struct { typedef struct rb_context_struct {
enum context_type type; enum context_type type;
VALUE self;
int argc; int argc;
VALUE self;
VALUE value; VALUE value;
VALUE *vm_stack; VALUE *vm_stack;
#ifdef CAPTURE_JUST_VALID_VM_STACK #ifdef CAPTURE_JUST_VALID_VM_STACK
@ -134,14 +134,14 @@ typedef struct rb_fiber_struct {
rb_context_t cont; rb_context_t cont;
VALUE prev; VALUE prev;
enum fiber_status status; enum fiber_status status;
struct rb_fiber_struct *prev_fiber;
struct rb_fiber_struct *next_fiber;
/* If a fiber invokes "transfer", /* If a fiber invokes "transfer",
* then this fiber can't "resume" any more after that. * then this fiber can't "resume" any more after that.
* You shouldn't mix "transfer" and "resume". * You shouldn't mix "transfer" and "resume".
*/ */
int transfered; int transfered;
struct rb_fiber_struct *prev_fiber;
struct rb_fiber_struct *next_fiber;
#if FIBER_USE_NATIVE #if FIBER_USE_NATIVE
#ifdef _WIN32 #ifdef _WIN32
void *fib_handle; void *fib_handle;

Просмотреть файл

@ -599,6 +599,7 @@ typedef struct rb_thread_struct {
enum rb_thread_status status; enum rb_thread_status status;
int to_kill; int to_kill;
int priority; int priority;
int mark_stack_len;
native_thread_data_t native_thread_data; native_thread_data_t native_thread_data;
void *blocking_region_buffer; void *blocking_region_buffer;
@ -616,8 +617,8 @@ typedef struct rb_thread_struct {
/* async errinfo queue */ /* async errinfo queue */
VALUE pending_interrupt_queue; VALUE pending_interrupt_queue;
int pending_interrupt_queue_checked;
VALUE pending_interrupt_mask_stack; VALUE pending_interrupt_mask_stack;
int pending_interrupt_queue_checked;
rb_atomic_t interrupt_flag; rb_atomic_t interrupt_flag;
unsigned long interrupt_mask; unsigned long interrupt_mask;
@ -665,7 +666,6 @@ typedef struct rb_thread_struct {
#endif #endif
jmp_buf regs; jmp_buf regs;
} machine; } machine;
int mark_stack_len;
/* statistics data for profiler */ /* statistics data for profiler */
VALUE stat_insn_usage; VALUE stat_insn_usage;