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

ruby-changes:39465

From: normal <ko1@a...>
Date: Wed, 12 Aug 2015 21:16:49 +0900 (JST)
Subject: [ruby-changes:39465] normal:r51546 (trunk): hoist out rb_call_info_kw_arg_bytes to inline function

normal	2015-08-12 21:16:29 +0900 (Wed, 12 Aug 2015)

  New Revision: 51546

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

  Log:
    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

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/vm_core.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51545)
+++ ChangeLog	(revision 51546)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Aug 12 21:15:27 2015  Eric Wong  <e@8...>
+
+	* 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@a...>
 
 	* class.c (move_refined_method): same as the last commit.
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 51545)
+++ vm_core.h	(revision 51546)
@@ -180,6 +180,12 @@ typedef struct rb_call_info_kw_arg_struc https://github.com/ruby/ruby/blob/trunk/vm_core.h#L180
     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,
Index: compile.c
===================================================================
--- compile.c	(revision 51545)
+++ compile.c	(revision 51546)
@@ -5917,7 +5917,7 @@ iseq_build_callinfo_from_hash(rb_iseq_t https://github.com/ruby/ruby/blob/trunk/compile.c#L5917
 	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;

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

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