2020-04-10 01:11:40 -04:00
|
|
|
#ifndef RUBY_VM_CALLINFO_H /*-*-C-*-vi:se ft=c:*/
|
|
|
|
#define RUBY_VM_CALLINFO_H
|
|
|
|
/**
|
|
|
|
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
|
|
* @copyright This file is a part of the programming language Ruby.
|
|
|
|
* Permission is hereby granted, to either redistribute and/or
|
|
|
|
* modify this file, provided that the conditions mentioned in the
|
|
|
|
* file COPYING are met. Consult the file for details.
|
|
|
|
*/
|
|
|
|
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
#include "debug_counter.h"
|
|
|
|
|
|
|
|
enum vm_call_flag_bits {
|
|
|
|
VM_CALL_ARGS_SPLAT_bit, /* m(*args) */
|
|
|
|
VM_CALL_ARGS_BLOCKARG_bit, /* m(&block) */
|
|
|
|
VM_CALL_FCALL_bit, /* m(...) */
|
|
|
|
VM_CALL_VCALL_bit, /* m */
|
|
|
|
VM_CALL_ARGS_SIMPLE_bit, /* (ci->flag & (SPLAT|BLOCKARG)) && blockiseq == NULL && ci->kw_arg == NULL */
|
|
|
|
VM_CALL_BLOCKISEQ_bit, /* has blockiseq */
|
|
|
|
VM_CALL_KWARG_bit, /* has kwarg */
|
|
|
|
VM_CALL_KW_SPLAT_bit, /* m(**opts) */
|
|
|
|
VM_CALL_TAILCALL_bit, /* located at tail position */
|
|
|
|
VM_CALL_SUPER_bit, /* super */
|
|
|
|
VM_CALL_ZSUPER_bit, /* zsuper */
|
|
|
|
VM_CALL_OPT_SEND_bit, /* internal flag */
|
Reduce allocations for keyword argument hashes
Previously, passing a keyword splat to a method always allocated
a hash on the caller side, and accepting arbitrary keywords in
a method allocated a separate hash on the callee side. Passing
explicit keywords to a method that accepted a keyword splat
did not allocate a hash on the caller side, but resulted in two
hashes allocated on the callee side.
This commit makes passing a single keyword splat to a method not
allocate a hash on the caller side. Passing multiple keyword
splats or a mix of explicit keywords and a keyword splat still
generates a hash on the caller side. On the callee side,
if arbitrary keywords are not accepted, it does not allocate a
hash. If arbitrary keywords are accepted, it will allocate a
hash, but this commit uses a callinfo flag to indicate whether
the caller already allocated a hash, and if so, the callee can
use the passed hash without duplicating it. So this commit
should make it so that a maximum of a single hash is allocated
during method calls.
To set the callinfo flag appropriately, method call argument
compilation checks if only a single keyword splat is given.
If only one keyword splat is given, the VM_CALL_KW_SPLAT_MUT
callinfo flag is not set, since in that case the keyword
splat is passed directly and not mutable. If more than one
splat is used, a new hash needs to be generated on the caller
side, and in that case the callinfo flag is set, indicating
the keyword splat is mutable by the callee.
In compile_hash, used for both hash and keyword argument
compilation, if compiling keyword arguments and only a
single keyword splat is used, pass the argument directly.
On the caller side, in vm_args.c, the callinfo flag needs to
be recognized and handled. Because the keyword splat
argument may not be a hash, it needs to be converted to a
hash first if not. Then, unless the callinfo flag is set,
the hash needs to be duplicated. The temporary copy of the
callinfo flag, kw_flag, is updated if a hash was duplicated,
to prevent the need to duplicate it again. If we are
converting to a hash or duplicating a hash, we need to update
the argument array, which can including duplicating the
positional splat array if one was passed. CALLER_SETUP_ARG
and a couple other places needs to be modified to handle
similar issues for other types of calls.
This includes fairly comprehensive tests for different ways
keywords are handled internally, checking that you get equal
results but that keyword splats on the caller side result in
distinct objects for keyword rest parameters.
Included are benchmarks for keyword argument calls.
Brief results when compiled without optimization:
def kw(a: 1) a end
def kws(**kw) kw end
h = {a: 1}
kw(a: 1) # about same
kw(**h) # 2.37x faster
kws(a: 1) # 1.30x faster
kws(**h) # 2.19x faster
kw(a: 1, **h) # 1.03x slower
kw(**h, **h) # about same
kws(a: 1, **h) # 1.16x faster
kws(**h, **h) # 1.14x faster
2020-02-24 15:05:07 -05:00
|
|
|
VM_CALL_KW_SPLAT_MUT_bit, /* kw splat hash can be modified (to avoid allocating a new one) */
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
VM_CALL__END
|
|
|
|
};
|
|
|
|
|
|
|
|
#define VM_CALL_ARGS_SPLAT (0x01 << VM_CALL_ARGS_SPLAT_bit)
|
|
|
|
#define VM_CALL_ARGS_BLOCKARG (0x01 << VM_CALL_ARGS_BLOCKARG_bit)
|
|
|
|
#define VM_CALL_FCALL (0x01 << VM_CALL_FCALL_bit)
|
|
|
|
#define VM_CALL_VCALL (0x01 << VM_CALL_VCALL_bit)
|
|
|
|
#define VM_CALL_ARGS_SIMPLE (0x01 << VM_CALL_ARGS_SIMPLE_bit)
|
|
|
|
#define VM_CALL_BLOCKISEQ (0x01 << VM_CALL_BLOCKISEQ_bit)
|
|
|
|
#define VM_CALL_KWARG (0x01 << VM_CALL_KWARG_bit)
|
|
|
|
#define VM_CALL_KW_SPLAT (0x01 << VM_CALL_KW_SPLAT_bit)
|
|
|
|
#define VM_CALL_TAILCALL (0x01 << VM_CALL_TAILCALL_bit)
|
|
|
|
#define VM_CALL_SUPER (0x01 << VM_CALL_SUPER_bit)
|
|
|
|
#define VM_CALL_ZSUPER (0x01 << VM_CALL_ZSUPER_bit)
|
|
|
|
#define VM_CALL_OPT_SEND (0x01 << VM_CALL_OPT_SEND_bit)
|
Reduce allocations for keyword argument hashes
Previously, passing a keyword splat to a method always allocated
a hash on the caller side, and accepting arbitrary keywords in
a method allocated a separate hash on the callee side. Passing
explicit keywords to a method that accepted a keyword splat
did not allocate a hash on the caller side, but resulted in two
hashes allocated on the callee side.
This commit makes passing a single keyword splat to a method not
allocate a hash on the caller side. Passing multiple keyword
splats or a mix of explicit keywords and a keyword splat still
generates a hash on the caller side. On the callee side,
if arbitrary keywords are not accepted, it does not allocate a
hash. If arbitrary keywords are accepted, it will allocate a
hash, but this commit uses a callinfo flag to indicate whether
the caller already allocated a hash, and if so, the callee can
use the passed hash without duplicating it. So this commit
should make it so that a maximum of a single hash is allocated
during method calls.
To set the callinfo flag appropriately, method call argument
compilation checks if only a single keyword splat is given.
If only one keyword splat is given, the VM_CALL_KW_SPLAT_MUT
callinfo flag is not set, since in that case the keyword
splat is passed directly and not mutable. If more than one
splat is used, a new hash needs to be generated on the caller
side, and in that case the callinfo flag is set, indicating
the keyword splat is mutable by the callee.
In compile_hash, used for both hash and keyword argument
compilation, if compiling keyword arguments and only a
single keyword splat is used, pass the argument directly.
On the caller side, in vm_args.c, the callinfo flag needs to
be recognized and handled. Because the keyword splat
argument may not be a hash, it needs to be converted to a
hash first if not. Then, unless the callinfo flag is set,
the hash needs to be duplicated. The temporary copy of the
callinfo flag, kw_flag, is updated if a hash was duplicated,
to prevent the need to duplicate it again. If we are
converting to a hash or duplicating a hash, we need to update
the argument array, which can including duplicating the
positional splat array if one was passed. CALLER_SETUP_ARG
and a couple other places needs to be modified to handle
similar issues for other types of calls.
This includes fairly comprehensive tests for different ways
keywords are handled internally, checking that you get equal
results but that keyword splats on the caller side result in
distinct objects for keyword rest parameters.
Included are benchmarks for keyword argument calls.
Brief results when compiled without optimization:
def kw(a: 1) a end
def kws(**kw) kw end
h = {a: 1}
kw(a: 1) # about same
kw(**h) # 2.37x faster
kws(a: 1) # 1.30x faster
kws(**h) # 2.19x faster
kw(a: 1, **h) # 1.03x slower
kw(**h, **h) # about same
kws(a: 1, **h) # 1.16x faster
kws(**h, **h) # 1.14x faster
2020-02-24 15:05:07 -05:00
|
|
|
#define VM_CALL_KW_SPLAT_MUT (0x01 << VM_CALL_KW_SPLAT_MUT_bit)
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
|
|
|
|
struct rb_callinfo_kwarg {
|
|
|
|
int keyword_len;
|
2020-04-12 15:19:06 -04:00
|
|
|
VALUE keywords[];
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline size_t
|
|
|
|
rb_callinfo_kwarg_bytes(int keyword_len)
|
|
|
|
{
|
|
|
|
return rb_size_mul_add_or_raise(
|
2020-04-12 15:19:06 -04:00
|
|
|
keyword_len,
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
sizeof(VALUE),
|
|
|
|
sizeof(struct rb_callinfo_kwarg),
|
|
|
|
rb_eRuntimeError);
|
|
|
|
}
|
|
|
|
|
|
|
|
// imemo_callinfo
|
|
|
|
struct rb_callinfo {
|
|
|
|
VALUE flags;
|
|
|
|
const struct rb_callinfo_kwarg *kwarg;
|
|
|
|
VALUE mid;
|
|
|
|
VALUE flag;
|
|
|
|
VALUE argc;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef USE_EMBED_CI
|
|
|
|
#define USE_EMBED_CI 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if SIZEOF_VALUE == 8
|
|
|
|
#define CI_EMBED_TAG_bits 1
|
|
|
|
#define CI_EMBED_ARGC_bits 15
|
|
|
|
#define CI_EMBED_FLAG_bits 16
|
|
|
|
#define CI_EMBED_ID_bits 32
|
|
|
|
#elif SIZEOF_VALUE == 4
|
|
|
|
#define CI_EMBED_TAG_bits 1
|
Reduce allocations for keyword argument hashes
Previously, passing a keyword splat to a method always allocated
a hash on the caller side, and accepting arbitrary keywords in
a method allocated a separate hash on the callee side. Passing
explicit keywords to a method that accepted a keyword splat
did not allocate a hash on the caller side, but resulted in two
hashes allocated on the callee side.
This commit makes passing a single keyword splat to a method not
allocate a hash on the caller side. Passing multiple keyword
splats or a mix of explicit keywords and a keyword splat still
generates a hash on the caller side. On the callee side,
if arbitrary keywords are not accepted, it does not allocate a
hash. If arbitrary keywords are accepted, it will allocate a
hash, but this commit uses a callinfo flag to indicate whether
the caller already allocated a hash, and if so, the callee can
use the passed hash without duplicating it. So this commit
should make it so that a maximum of a single hash is allocated
during method calls.
To set the callinfo flag appropriately, method call argument
compilation checks if only a single keyword splat is given.
If only one keyword splat is given, the VM_CALL_KW_SPLAT_MUT
callinfo flag is not set, since in that case the keyword
splat is passed directly and not mutable. If more than one
splat is used, a new hash needs to be generated on the caller
side, and in that case the callinfo flag is set, indicating
the keyword splat is mutable by the callee.
In compile_hash, used for both hash and keyword argument
compilation, if compiling keyword arguments and only a
single keyword splat is used, pass the argument directly.
On the caller side, in vm_args.c, the callinfo flag needs to
be recognized and handled. Because the keyword splat
argument may not be a hash, it needs to be converted to a
hash first if not. Then, unless the callinfo flag is set,
the hash needs to be duplicated. The temporary copy of the
callinfo flag, kw_flag, is updated if a hash was duplicated,
to prevent the need to duplicate it again. If we are
converting to a hash or duplicating a hash, we need to update
the argument array, which can including duplicating the
positional splat array if one was passed. CALLER_SETUP_ARG
and a couple other places needs to be modified to handle
similar issues for other types of calls.
This includes fairly comprehensive tests for different ways
keywords are handled internally, checking that you get equal
results but that keyword splats on the caller side result in
distinct objects for keyword rest parameters.
Included are benchmarks for keyword argument calls.
Brief results when compiled without optimization:
def kw(a: 1) a end
def kws(**kw) kw end
h = {a: 1}
kw(a: 1) # about same
kw(**h) # 2.37x faster
kws(a: 1) # 1.30x faster
kws(**h) # 2.19x faster
kw(a: 1, **h) # 1.03x slower
kw(**h, **h) # about same
kws(a: 1, **h) # 1.16x faster
kws(**h, **h) # 1.14x faster
2020-02-24 15:05:07 -05:00
|
|
|
#define CI_EMBED_ARGC_bits 3
|
|
|
|
#define CI_EMBED_FLAG_bits 13
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
#define CI_EMBED_ID_bits 15
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (CI_EMBED_TAG_bits + CI_EMBED_ARGC_bits + CI_EMBED_FLAG_bits + CI_EMBED_ID_bits) != (SIZEOF_VALUE * 8)
|
|
|
|
#error
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CI_EMBED_FLAG 0x01
|
|
|
|
#define CI_EMBED_ARGC_SHFT (CI_EMBED_TAG_bits)
|
2020-01-08 02:14:01 -05:00
|
|
|
#define CI_EMBED_ARGC_MASK ((((VALUE)1)<<CI_EMBED_ARGC_bits) - 1)
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
#define CI_EMBED_FLAG_SHFT (CI_EMBED_TAG_bits + CI_EMBED_ARGC_bits)
|
2020-01-08 02:14:01 -05:00
|
|
|
#define CI_EMBED_FLAG_MASK ((((VALUE)1)<<CI_EMBED_FLAG_bits) - 1)
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
#define CI_EMBED_ID_SHFT (CI_EMBED_TAG_bits + CI_EMBED_ARGC_bits + CI_EMBED_FLAG_bits)
|
2020-01-08 02:14:01 -05:00
|
|
|
#define CI_EMBED_ID_MASK ((((VALUE)1)<<CI_EMBED_ID_bits) - 1)
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
|
2020-01-08 02:14:01 -05:00
|
|
|
static inline bool
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
vm_ci_packed_p(const struct rb_callinfo *ci)
|
|
|
|
{
|
|
|
|
#if USE_EMBED_CI
|
|
|
|
if (LIKELY(((VALUE)ci) & 0x01)) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else {
|
2020-01-08 02:14:01 -05:00
|
|
|
VM_ASSERT(IMEMO_TYPE_P(ci, imemo_callinfo));
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-01-08 02:14:01 -05:00
|
|
|
static inline bool
|
|
|
|
vm_ci_p(const struct rb_callinfo *ci)
|
|
|
|
{
|
|
|
|
if (vm_ci_packed_p(ci) || IMEMO_TYPE_P(ci, imemo_callinfo)) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
static inline ID
|
|
|
|
vm_ci_mid(const struct rb_callinfo *ci)
|
|
|
|
{
|
|
|
|
if (vm_ci_packed_p(ci)) {
|
|
|
|
return (((VALUE)ci) >> CI_EMBED_ID_SHFT) & CI_EMBED_ID_MASK;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return (ID)ci->mid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int
|
|
|
|
vm_ci_flag(const struct rb_callinfo *ci)
|
|
|
|
{
|
|
|
|
if (vm_ci_packed_p(ci)) {
|
|
|
|
return (unsigned int)((((VALUE)ci) >> CI_EMBED_FLAG_SHFT) & CI_EMBED_FLAG_MASK);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return (unsigned int)ci->flag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int
|
|
|
|
vm_ci_argc(const struct rb_callinfo *ci)
|
|
|
|
{
|
|
|
|
if (vm_ci_packed_p(ci)) {
|
|
|
|
return (unsigned int)((((VALUE)ci) >> CI_EMBED_ARGC_SHFT) & CI_EMBED_ARGC_MASK);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return (unsigned int)ci->argc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const struct rb_callinfo_kwarg *
|
|
|
|
vm_ci_kwarg(const struct rb_callinfo *ci)
|
|
|
|
{
|
|
|
|
if (vm_ci_packed_p(ci)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return ci->kwarg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
vm_ci_dump(const struct rb_callinfo *ci)
|
|
|
|
{
|
|
|
|
if (vm_ci_packed_p(ci)) {
|
2021-09-09 10:21:06 -04:00
|
|
|
ruby_debug_printf("packed_ci ID:%s flag:%x argc:%u\n",
|
|
|
|
rb_id2name(vm_ci_mid(ci)), vm_ci_flag(ci), vm_ci_argc(ci));
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
rp(ci);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define vm_ci_new(mid, flag, argc, kwarg) vm_ci_new_(mid, flag, argc, kwarg, __FILE__, __LINE__)
|
|
|
|
#define vm_ci_new_runtime(mid, flag, argc, kwarg) vm_ci_new_runtime_(mid, flag, argc, kwarg, __FILE__, __LINE__)
|
|
|
|
|
2020-05-29 03:04:53 -04:00
|
|
|
#/* This is passed to STATIC_ASSERT. Cannot be an inline function. */
|
|
|
|
#define VM_CI_EMBEDDABLE_P(mid, flag, argc, kwarg) \
|
|
|
|
(((mid ) & ~CI_EMBED_ID_MASK) ? false : \
|
|
|
|
((flag) & ~CI_EMBED_FLAG_MASK) ? false : \
|
|
|
|
((argc) & ~CI_EMBED_ARGC_MASK) ? false : \
|
|
|
|
(kwarg) ? false : true)
|
|
|
|
|
2020-06-03 05:25:13 -04:00
|
|
|
#define vm_ci_new_id(mid, flag, argc, must_zero) \
|
|
|
|
((const struct rb_callinfo *) \
|
|
|
|
((((VALUE)(mid )) << CI_EMBED_ID_SHFT) | \
|
|
|
|
(((VALUE)(flag)) << CI_EMBED_FLAG_SHFT) | \
|
|
|
|
(((VALUE)(argc)) << CI_EMBED_ARGC_SHFT) | \
|
|
|
|
RUBY_FIXNUM_FLAG))
|
|
|
|
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
static inline const struct rb_callinfo *
|
|
|
|
vm_ci_new_(ID mid, unsigned int flag, unsigned int argc, const struct rb_callinfo_kwarg *kwarg, const char *file, int line)
|
|
|
|
{
|
|
|
|
#if USE_EMBED_CI
|
2020-05-29 03:04:53 -04:00
|
|
|
if (VM_CI_EMBEDDABLE_P(mid, flag, argc, kwarg)) {
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
RB_DEBUG_COUNTER_INC(ci_packed);
|
2020-06-03 05:25:13 -04:00
|
|
|
return vm_ci_new_id(mid, flag, argc, kwarg);
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
}
|
|
|
|
#endif
|
2020-01-08 02:14:01 -05:00
|
|
|
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
const bool debug = 0;
|
2021-09-09 10:21:06 -04:00
|
|
|
if (debug) ruby_debug_printf("%s:%d ", file, line);
|
2020-01-08 02:14:01 -05:00
|
|
|
|
|
|
|
// TODO: dedup
|
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-01-07 18:20:36 -05:00
|
|
|
const struct rb_callinfo *ci = (const struct rb_callinfo *)
|
|
|
|
rb_imemo_new(imemo_callinfo,
|
|
|
|
(VALUE)mid,
|
|
|
|
(VALUE)flag,
|
|
|
|
(VALUE)argc,
|
|
|
|
(VALUE)kwarg);
|
|
|
|
if (debug) rp(ci);
|
|
|
|
if (kwarg) {
|
|
|
|
RB_DEBUG_COUNTER_INC(ci_kw);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
RB_DEBUG_COUNTER_INC(ci_nokw);
|
|
|
|
}
|
|
|
|
|
|
|
|
VM_ASSERT(vm_ci_flag(ci) == flag);
|
|
|
|
VM_ASSERT(vm_ci_argc(ci) == argc);
|
|
|
|
|
|
|
|
return ci;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline const struct rb_callinfo *
|
|
|
|
vm_ci_new_runtime_(ID mid, unsigned int flag, unsigned int argc, const struct rb_callinfo_kwarg *kwarg, const char *file, int line)
|
|
|
|
{
|
|
|
|
RB_DEBUG_COUNTER_INC(ci_runtime);
|
|
|
|
return vm_ci_new_(mid, flag, argc, kwarg, file, line);
|
|
|
|
}
|
2020-01-08 02:14:01 -05:00
|
|
|
|
2020-05-29 02:20:57 -04:00
|
|
|
#define VM_CALLINFO_NOT_UNDER_GC IMEMO_FL_USER0
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
vm_ci_markable(const struct rb_callinfo *ci)
|
|
|
|
{
|
|
|
|
if (! ci) {
|
|
|
|
return false; /* or true? This is Qfalse... */
|
|
|
|
}
|
|
|
|
else if (vm_ci_packed_p(ci)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(ci, imemo_callinfo));
|
|
|
|
return ! FL_ANY_RAW((VALUE)ci, VM_CALLINFO_NOT_UNDER_GC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-01 03:01:30 -04:00
|
|
|
#define VM_CI_ON_STACK(mid_, flags_, argc_, kwarg_) \
|
|
|
|
(struct rb_callinfo) { \
|
|
|
|
.flags = T_IMEMO | \
|
|
|
|
(imemo_callinfo << FL_USHIFT) | \
|
|
|
|
VM_CALLINFO_NOT_UNDER_GC, \
|
|
|
|
.mid = mid_, \
|
|
|
|
.flag = flags_, \
|
|
|
|
.argc = argc_, \
|
|
|
|
.kwarg = kwarg_, \
|
|
|
|
}
|
|
|
|
|
2020-01-08 02:14:01 -05:00
|
|
|
typedef VALUE (*vm_call_handler)(
|
|
|
|
struct rb_execution_context_struct *ec,
|
|
|
|
struct rb_control_frame_struct *cfp,
|
2020-12-14 15:40:38 -05:00
|
|
|
struct rb_calling_info *calling);
|
2020-01-08 02:14:01 -05:00
|
|
|
|
|
|
|
// imemo_callcache
|
|
|
|
|
|
|
|
struct rb_callcache {
|
2020-02-21 19:59:23 -05:00
|
|
|
const VALUE flags;
|
2020-01-08 02:14:01 -05:00
|
|
|
|
|
|
|
/* inline cache: key */
|
|
|
|
const VALUE klass; // should not mark it because klass can not be free'd
|
|
|
|
// because of this marking. When klass is collected,
|
|
|
|
// cc will be cleared (cc->klass = 0) at vm_ccs_free().
|
|
|
|
|
|
|
|
/* inline cache: values */
|
|
|
|
const struct rb_callable_method_entry_struct * const cme_;
|
|
|
|
const vm_call_handler call_;
|
|
|
|
|
|
|
|
union {
|
|
|
|
const unsigned int attr_index;
|
|
|
|
const enum method_missing_reason method_missing_reason; /* used by method_missing */
|
2020-03-02 00:25:35 -05:00
|
|
|
VALUE v;
|
2020-01-08 02:14:01 -05:00
|
|
|
} aux_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define VM_CALLCACHE_UNMARKABLE IMEMO_FL_USER0
|
|
|
|
|
|
|
|
static inline const struct rb_callcache *
|
|
|
|
vm_cc_new(VALUE klass,
|
|
|
|
const struct rb_callable_method_entry_struct *cme,
|
|
|
|
vm_call_handler call)
|
|
|
|
{
|
|
|
|
const struct rb_callcache *cc = (const struct rb_callcache *)rb_imemo_new(imemo_callcache, (VALUE)cme, (VALUE)call, 0, klass);
|
|
|
|
RB_DEBUG_COUNTER_INC(cc_new);
|
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
2020-06-01 03:01:30 -04:00
|
|
|
#define VM_CC_ON_STACK(clazz, call, aux, cme) \
|
|
|
|
(struct rb_callcache) { \
|
|
|
|
.flags = T_IMEMO | \
|
|
|
|
(imemo_callcache << FL_USHIFT) | \
|
|
|
|
VM_CALLCACHE_UNMARKABLE, \
|
|
|
|
.klass = clazz, \
|
|
|
|
.cme_ = cme, \
|
|
|
|
.call_ = call, \
|
|
|
|
.aux_ = aux, \
|
|
|
|
}
|
2020-01-08 02:14:01 -05:00
|
|
|
|
|
|
|
static inline bool
|
|
|
|
vm_cc_class_check(const struct rb_callcache *cc, VALUE klass)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
VM_ASSERT(cc->klass == 0 ||
|
|
|
|
RB_TYPE_P(cc->klass, T_CLASS) || RB_TYPE_P(cc->klass, T_ICLASS));
|
|
|
|
return cc->klass == klass;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const struct rb_callable_method_entry_struct *
|
|
|
|
vm_cc_cme(const struct rb_callcache *cc)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
return cc->cme_;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline vm_call_handler
|
|
|
|
vm_cc_call(const struct rb_callcache *cc)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
return cc->call_;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int
|
|
|
|
vm_cc_attr_index(const struct rb_callcache *cc)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
return cc->aux_.attr_index;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int
|
|
|
|
vm_cc_cmethod_missing_reason(const struct rb_callcache *cc)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
return cc->aux_.method_missing_reason;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
vm_cc_markable(const struct rb_callcache *cc)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
2020-04-08 00:28:13 -04:00
|
|
|
return FL_TEST_RAW((VALUE)cc, VM_CALLCACHE_UNMARKABLE) == 0;
|
2020-01-08 02:14:01 -05:00
|
|
|
}
|
|
|
|
|
2021-01-05 23:06:25 -05:00
|
|
|
static inline bool
|
|
|
|
vm_cc_invalidated_p(const struct rb_callcache *cc)
|
|
|
|
{
|
2021-01-18 12:47:04 -05:00
|
|
|
if (cc->klass && !METHOD_ENTRY_INVALIDATED(vm_cc_cme(cc))) {
|
2021-01-05 23:06:25 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-11 03:54:18 -04:00
|
|
|
// For MJIT. cc_cme is supposed to have inlined `vm_cc_cme(cc)`.
|
2020-01-08 02:14:01 -05:00
|
|
|
static inline bool
|
2020-03-11 03:54:18 -04:00
|
|
|
vm_cc_valid_p(const struct rb_callcache *cc, const rb_callable_method_entry_t *cc_cme, VALUE klass)
|
2020-01-08 02:14:01 -05:00
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
2020-03-11 03:54:18 -04:00
|
|
|
if (cc->klass == klass && !METHOD_ENTRY_INVALIDATED(cc_cme)) {
|
2020-01-08 02:14:01 -05:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extern const struct rb_callcache *rb_vm_empty_cc(void);
|
2020-06-04 04:13:56 -04:00
|
|
|
#define vm_cc_empty() rb_vm_empty_cc()
|
2020-01-08 02:14:01 -05:00
|
|
|
|
2020-10-22 18:20:35 -04:00
|
|
|
/* callcache: mutate */
|
2020-01-08 02:14:01 -05:00
|
|
|
|
|
|
|
static inline void
|
|
|
|
vm_cc_call_set(const struct rb_callcache *cc, vm_call_handler call)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
VM_ASSERT(cc != vm_cc_empty());
|
|
|
|
*(vm_call_handler *)&cc->call_ = call;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
vm_cc_attr_index_set(const struct rb_callcache *cc, int index)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
VM_ASSERT(cc != vm_cc_empty());
|
|
|
|
*(int *)&cc->aux_.attr_index = index;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
vm_cc_method_missing_reason_set(const struct rb_callcache *cc, enum method_missing_reason reason)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
VM_ASSERT(cc != vm_cc_empty());
|
|
|
|
*(enum method_missing_reason *)&cc->aux_.method_missing_reason = reason;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
vm_cc_invalidate(const struct rb_callcache *cc)
|
|
|
|
{
|
|
|
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
|
|
VM_ASSERT(cc != vm_cc_empty());
|
|
|
|
VM_ASSERT(cc->klass != 0); // should be enable
|
|
|
|
|
|
|
|
*(VALUE *)&cc->klass = 0;
|
|
|
|
RB_DEBUG_COUNTER_INC(cc_ent_invalidate);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* calldata */
|
|
|
|
|
|
|
|
struct rb_call_data {
|
|
|
|
const struct rb_callinfo *ci;
|
|
|
|
const struct rb_callcache *cc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rb_class_cc_entries {
|
|
|
|
#if VM_CHECK_MODE > 0
|
|
|
|
VALUE debug_sig;
|
|
|
|
#endif
|
|
|
|
int capa;
|
|
|
|
int len;
|
|
|
|
const struct rb_callable_method_entry_struct *cme;
|
|
|
|
struct rb_class_cc_entries_entry {
|
|
|
|
const struct rb_callinfo *ci;
|
|
|
|
const struct rb_callcache *cc;
|
|
|
|
} *entries;
|
|
|
|
};
|
|
|
|
|
|
|
|
#if VM_CHECK_MODE > 0
|
|
|
|
static inline bool
|
|
|
|
vm_ccs_p(const struct rb_class_cc_entries *ccs)
|
|
|
|
{
|
|
|
|
return ccs->debug_sig == ~(VALUE)ccs;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// gc.c
|
|
|
|
void rb_vm_ccs_free(struct rb_class_cc_entries *ccs);
|
2020-04-10 01:11:40 -04:00
|
|
|
|
|
|
|
#endif /* RUBY_VM_CALLINFO_H */
|