summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-12 12:16:29 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-12 12:16:29 (GMT)
commitb3abb691daa86e8336a3e2e426e2b2621651896b (patch)
treeae0f809cbc1549b3ede685052d8736932db383a4
parent2e2bd1c26b21ab3298b32f881bccebc14c7cac3d (diff)
hoist out rb_call_info_kw_arg_bytes to inline function
* vm_core.h (rb_call_info_kw_arg_bytes): extract from compile.c * compile.c (iseq_build_callinfo_from_hash): use above function This will be use for implementing iseq_memsize git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--compile.c2
-rw-r--r--vm_core.h6
3 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e91eab7..f95f231 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Aug 12 21:15:27 2015 Eric Wong <e@80x24.org>
+
+ * vm_core.h (rb_call_info_kw_arg_bytes): extract from compile.c
+ * compile.c (iseq_build_callinfo_from_hash): use above function
+
Wed Aug 12 18:00:17 2015 Koichi Sasada <ko1@atdot.net>
* class.c (move_refined_method): same as the last commit.
diff --git a/compile.c b/compile.c
index 637f56f..26ee3b2 100644
--- a/compile.c
+++ b/compile.c
@@ -5917,7 +5917,7 @@ iseq_build_callinfo_from_hash(rb_iseq_t *iseq, VALUE op)
if (!NIL_P(vkw_arg)) {
int i;
int len = RARRAY_LENINT(vkw_arg);
- size_t n = sizeof(rb_call_info_kw_arg_t) + sizeof(VALUE) * (len - 1);
+ size_t n = rb_call_info_kw_arg_bytes(len);
kw_arg = xmalloc(n);
kw_arg->keyword_len = len;
diff --git a/vm_core.h b/vm_core.h
index a032daa..6745837 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -180,6 +180,12 @@ typedef struct rb_call_info_kw_arg_struct {
VALUE keywords[1];
} rb_call_info_kw_arg_t;
+static inline size_t
+rb_call_info_kw_arg_bytes(int keyword_len)
+{
+ return sizeof(rb_call_info_kw_arg_t) + sizeof(VALUE) * (keyword_len - 1);
+}
+
enum method_missing_reason {
MISSING_NOENTRY = 0x00,
MISSING_PRIVATE = 0x01,