diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-12 12:16:29 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-12 12:16:29 +0000 |
commit | c8ce3c58ca76d9d91163c9cf3b433dc2cb2d5a68 (patch) | |
tree | ae0f809cbc1549b3ede685052d8736932db383a4 | |
parent | a284d976acc7edbaf30dd94a3a639267e4c8e5bf (diff) | |
download | ruby-c8ce3c58ca76d9d91163c9cf3b433dc2cb2d5a68.tar.gz |
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-- | ChangeLog | 5 | ||||
-rw-r--r-- | compile.c | 2 | ||||
-rw-r--r-- | vm_core.h | 6 |
3 files changed, 12 insertions, 1 deletions
@@ -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. @@ -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; @@ -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, |