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

ruby-changes:56620

From: Nobuyoshi <ko1@a...>
Date: Tue, 23 Jul 2019 05:21:07 +0900 (JST)
Subject: [ruby-changes:56620] Nobuyoshi Nakada: 11f3da8e9d (master): Stop packing rb_method_definition_t

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

From 11f3da8e9dd98cb6b0c2c2fd22220f8508af32f2 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 23 Jul 2019 05:20:04 +0900
Subject: Stop packing rb_method_definition_t

By using `BITFIELD`, `type` field should not be forced to align.

diff --git a/method.h b/method.h
index a604554..84ade7f 100644
--- a/method.h
+++ b/method.h
@@ -160,7 +160,7 @@ enum method_optimized_type { https://github.com/ruby/ruby/blob/trunk/method.h#L160
     OPTIMIZED_METHOD_TYPE__MAX
 };
 
-PACKED_STRUCT_UNALIGNED(struct rb_method_definition_struct {
+struct rb_method_definition_struct {
     BITFIELD(rb_method_type_t, type, VM_METHOD_TYPE_MINIMUM_BITS);
     int alias_count : 28;
     int complemented_count : 28;
@@ -177,9 +177,10 @@ PACKED_STRUCT_UNALIGNED(struct rb_method_definition_struct { https://github.com/ruby/ruby/blob/trunk/method.h#L177
     } body;
 
     ID original_id;
-});
+};
 
 typedef struct rb_method_definition_struct rb_method_definition_t;
+STATIC_ASSERT(sizeof_method_def, offsetof(rb_method_definition_t, body)==8);
 
 #define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
 #define UNDEFINED_REFINED_METHOD_P(def) \
-- 
cgit v0.10.2


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

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