[前][次][番号順一覧][スレッド一覧]

ruby-changes:52969

From: normal <ko1@a...>
Date: Sat, 20 Oct 2018 05:56:16 +0900 (JST)
Subject: [ruby-changes:52969] normal:r65183 (trunk): rb_execution_context_t: pack bits, 256 -> 252 bytes (on 32-bit)

normal	2018-10-20 05:56:10 +0900 (Sat, 20 Oct 2018)

  New Revision: 65183

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65183

  Log:
    rb_execution_context_t: pack bits, 256 -> 252 bytes (on 32-bit)
    
    Maybe execution contexts will become more common.

  Modified files:
    trunk/eval_error.c
    trunk/vm_core.h
Index: eval_error.c
===================================================================
--- eval_error.c	(revision 65182)
+++ eval_error.c	(revision 65183)
@@ -268,7 +268,7 @@ VALUE rb_get_message(VALUE exc); https://github.com/ruby/ruby/blob/trunk/eval_error.c#L268
 void
 rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo)
 {
-    volatile int raised_flag = ec->raised_flag;
+    volatile uint8_t raised_flag = ec->raised_flag;
     volatile VALUE errat = Qundef;
     volatile VALUE emesg = Qundef;
 
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 65182)
+++ vm_core.h	(revision 65183)
@@ -845,8 +845,12 @@ typedef struct rb_execution_context_stru https://github.com/ruby/ruby/blob/trunk/vm_core.h#L845
     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;
+
+    uint8_t raised_flag; /* only 3 bits needed */
+
+    /* n.b. only 7 bits needed, really: */
+    BITFIELD(enum method_missing_reason, method_missing_reason, 8);
+
     VALUE private_const_reference;
 
     /* for GC */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]