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

ruby-changes:66458

From: Nobuyoshi <ko1@a...>
Date: Wed, 9 Jun 2021 19:21:08 +0900 (JST)
Subject: [ruby-changes:66458] e03bf76b31 (master): Pack iseq_inline_constant_cache_entry

https://git.ruby-lang.org/ruby.git/commit/?id=e03bf76b31

From e03bf76b312e9cba0e44488fcd8f67099af816cb Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 9 Jun 2021 19:15:57 +0900
Subject: Pack iseq_inline_constant_cache_entry

Reordered iseq_inline_constant_cache_entry members not to exceed
the size of RValue.
---
 vm_core.h | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/vm_core.h b/vm_core.h
index 0657271..7eda31f 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -218,23 +218,20 @@ struct rb_control_frame_struct; https://github.com/ruby/ruby/blob/trunk/vm_core.h#L218
 /* iseq data type */
 typedef struct rb_compile_option_struct rb_compile_option_t;
 
-#if (SIZEOF_SERIAL_T > SIZEOF_VOIDP) && defined(__CYGWIN__)
-#pragma pack(push, 4) /* == SIZEOF_VOIDP */
-#endif
-
 // imemo_constcache
 struct iseq_inline_constant_cache_entry {
     VALUE flags;
 
     VALUE value;              // v0
-    const rb_cref_t *ic_cref; // v1
-    rb_serial_t ic_serial;    // v2
-                              // v3
-};
-
-#if (SIZEOF_SERIAL_T > SIZEOF_VOIDP) && defined(__CYGWIN__)
-#pragma pack(pop)
+    rb_serial_t ic_serial;    // v1
+#if (SIZEOF_SERIAL_T < 2 * SIZEOF_VOIDP)
+    VALUE ic_padding;         // v2
 #endif
+    const rb_cref_t *ic_cref; // v3
+};
+STATIC_ASSERT(sizeof_iseq_inline_constant_cache_entry,
+              (offsetof(struct iseq_inline_constant_cache_entry, ic_cref) +
+	       sizeof(const rb_cref_t *)) <= sizeof(struct RObject));
 
 struct iseq_inline_constant_cache {
     struct iseq_inline_constant_cache_entry *entry;
-- 
cgit v1.1


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

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