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
This commit is contained in:
normal 2015-08-12 12:16:29 +00:00
Родитель 2e2bd1c26b
Коммит b3abb691da
3 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -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,