Feature #14813 ยป 0001-gc.c-make-gc_enter-gc_exit-pairs-dtrace-probes-too.patch
gc.c | ||
---|---|---|
rb_objspace_call_finalizer(&rb_objspace);
|
||
}
|
||
enum gc_event {
|
||
gc_ev_SWEEP_CONTINUE = 0,
|
||
gc_ev_MARKS_CONTINUE,
|
||
gc_ev_START,
|
||
gc_ev_REST,
|
||
gc_ev_RB_OBJSPACE_CALL_FINALIZER
|
||
};
|
||
static const char * const
|
||
gc_event_str[] = {
|
||
"sweep_continue",
|
||
"marks_continue",
|
||
"gc_start",
|
||
"gc_rest",
|
||
"rb_objspace_call_finalizer"
|
||
};
|
||
#define RUBY_DTRACE_GC_HOOK(name) \
|
||
do {if (RUBY_DTRACE_GC_##name##_ENABLED()) RUBY_DTRACE_GC_##name();} while (0)
|
||
#define GC_ENTER(objspace, event) do { \
|
||
RUBY_DTRACE_GC_HOOK(event##_ENTER); \
|
||
gc_enter(objspace, gc_event_str[gc_ev_##event]); \
|
||
} while (0)
|
||
#define GC_EXIT(objspace, event) do { \
|
||
RUBY_DTRACE_GC_HOOK(event##_EXIT); \
|
||
gc_exit(objspace, gc_event_str[gc_ev_##event]); \
|
||
} while (0)
|
||
static void
|
||
rb_objspace_call_finalizer(rb_objspace_t *objspace)
|
||
{
|
||
... | ... | |
dont_gc = 1;
|
||
/* running data/file finalizers are part of garbage collection */
|
||
gc_enter(objspace, "rb_objspace_call_finalizer");
|
||
GC_ENTER(objspace, RB_OBJSPACE_CALL_FINALIZER);
|
||
/* run data/file object's finalizers */
|
||
for (i = 0; i < heap_allocated_pages; i++) {
|
||
... | ... | |
}
|
||
}
|
||
gc_exit(objspace, "rb_objspace_call_finalizer");
|
||
GC_EXIT(objspace, RB_OBJSPACE_CALL_FINALIZER);
|
||
if (heap_pages_deferred_final) {
|
||
finalize_list(objspace, heap_pages_deferred_final);
|
||
... | ... | |
{
|
||
GC_ASSERT(dont_gc == FALSE);
|
||
gc_enter(objspace, "sweep_continue");
|
||
GC_ENTER(objspace, SWEEP_CONTINUE);
|
||
#if USE_RGENGC
|
||
if (objspace->rgengc.need_major_gc == GPR_FLAG_NONE && heap_increment(objspace, heap)) {
|
||
gc_report(3, objspace, "gc_sweep_continue: success heap_increment().\n");
|
||
}
|
||
#endif
|
||
gc_sweep_step(objspace, heap);
|
||
gc_exit(objspace, "sweep_continue");
|
||
GC_EXIT(objspace, SWEEP_CONTINUE);
|
||
}
|
||
#endif
|
||
... | ... | |
GC_ASSERT(dont_gc == FALSE);
|
||
gc_enter(objspace, "marks_continue");
|
||
GC_ENTER(objspace, MARKS_CONTINUE);
|
||
PUSH_MARK_FUNC_DATA(NULL);
|
||
{
|
||
... | ... | |
}
|
||
POP_MARK_FUNC_DATA();
|
||
gc_exit(objspace, "marks_continue");
|
||
GC_EXIT(objspace, MARKS_CONTINUE);
|
||
}
|
||
#endif
|
||
... | ... | |
gc_verify_internal_consistency(Qnil);
|
||
#endif
|
||
gc_enter(objspace, "gc_start");
|
||
GC_ENTER(objspace, START);
|
||
if (ruby_gc_stressful) {
|
||
int flag = FIXNUM_P(ruby_gc_stress_mode) ? FIX2INT(ruby_gc_stress_mode) : 0;
|
||
... | ... | |
}
|
||
gc_prof_timer_stop(objspace);
|
||
gc_exit(objspace, "gc_start");
|
||
GC_EXIT(objspace, START);
|
||
return TRUE;
|
||
}
|
||
... | ... | |
int sweeping = is_lazy_sweeping(heap_eden);
|
||
if (marking || sweeping) {
|
||
gc_enter(objspace, "gc_rest");
|
||
GC_ENTER(objspace, REST);
|
||
if (RGENGC_CHECK_MODE >= 2) gc_verify_internal_consistency(Qnil);
|
||
... | ... | |
if (is_lazy_sweeping(heap_eden)) {
|
||
gc_sweep_rest(objspace);
|
||
}
|
||
gc_exit(objspace, "gc_rest");
|
||
GC_EXIT(objspace, REST);
|
||
}
|
||
}
|
||
... | ... | |
}
|
||
}
|
||
#define RUBY_DTRACE_GC_HOOK(name) \
|
||
do {if (RUBY_DTRACE_GC_##name##_ENABLED()) RUBY_DTRACE_GC_##name();} while (0)
|
||
static inline void
|
||
gc_prof_mark_timer_start(rb_objspace_t *objspace)
|
||
{
|
probes.d | ||
---|---|---|
*/
|
||
probe gc__sweep__end();
|
||
probe gc__sweep__continue__enter();
|
||
probe gc__sweep__continue__exit();
|
||
probe gc__marks__continue__enter();
|
||
probe gc__marks__continue__exit();
|
||
probe gc__start__enter();
|
||
probe gc__start__exit();
|
||
probe gc__rest__enter();
|
||
probe gc__rest__exit();
|
||
probe gc__rb__objspace__call__finalizer__enter();
|
||
probe gc__rb__objspace__call__finalizer__exit();
|
||
/*
|
||
ruby:::method-cache-clear(class, filename, lineno);
|
||
-
|