mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_ci_markable: added
CIs are created on-the-fly, which increases GC pressure. However they include no references to other objects, and those on-the-fly CIs tend to be short lived. Why not skip allocation of them. In doing so we need to add a flag denotes the CI object does not reside inside of objspace.
This commit is contained in:
parent
3928c151a6
commit
77293cef91
Notes:
git
2020-06-09 09:53:21 +09:00
2 changed files with 23 additions and 2 deletions
8
iseq.c
8
iseq.c
|
@ -325,9 +325,13 @@ rb_iseq_mark(const rb_iseq_t *iseq)
|
|||
if (body->call_data) {
|
||||
struct rb_call_data *cds = (struct rb_call_data *)body->call_data;
|
||||
for (unsigned int i=0; i<body->ci_size; i++) {
|
||||
rb_gc_mark_movable((VALUE)cds[i].ci);
|
||||
const struct rb_callinfo *ci = cds[i].ci;
|
||||
const struct rb_callcache *cc = cds[i].cc;
|
||||
if (cc && vm_cc_markable(cds[i].cc)) {
|
||||
|
||||
if (vm_ci_markable(ci)) {
|
||||
rb_gc_mark_movable((VALUE)ci);
|
||||
}
|
||||
if (cc && vm_cc_markable(cc)) {
|
||||
rb_gc_mark_movable((VALUE)cc);
|
||||
// TODO: check enable
|
||||
}
|
||||
|
|
|
@ -229,6 +229,23 @@ vm_ci_new_runtime_(ID mid, unsigned int flag, unsigned int argc, const struct rb
|
|||
return vm_ci_new_(mid, flag, argc, kwarg, file, line);
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
typedef VALUE (*vm_call_handler)(
|
||||
struct rb_execution_context_struct *ec,
|
||||
struct rb_control_frame_struct *cfp,
|
||||
|
|
Loading…
Reference in a new issue