зеркало из https://github.com/github/ruby.git
* gc.c: rename gc_stat entries and check stat transition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
71990d0ed1
Коммит
335ca560de
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Sep 9 12:11:41 2014 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* gc.c: rename gc_stat entries and check stat transition.
|
||||||
|
|
||||||
Tue Sep 9 12:06:03 2014 Koichi Sasada <ko1@atdot.net>
|
Tue Sep 9 12:06:03 2014 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* gc.c (gc_sweep_rest): remove wrong modification of during_gc flag.
|
* gc.c (gc_sweep_rest): remove wrong modification of during_gc flag.
|
||||||
|
|
32
gc.c
32
gc.c
|
@ -449,9 +449,9 @@ typedef struct rb_heap_struct {
|
||||||
} rb_heap_t;
|
} rb_heap_t;
|
||||||
|
|
||||||
enum gc_stat {
|
enum gc_stat {
|
||||||
none,
|
gc_stat_none,
|
||||||
marking,
|
gc_stat_marking,
|
||||||
sweeping
|
gc_stat_sweeping
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct rb_objspace {
|
typedef struct rb_objspace {
|
||||||
|
@ -687,8 +687,8 @@ VALUE *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
|
||||||
#define global_list objspace->global_list
|
#define global_list objspace->global_list
|
||||||
#define ruby_gc_stress objspace->gc_stress
|
#define ruby_gc_stress objspace->gc_stress
|
||||||
|
|
||||||
#define is_marking(objspace) ((objspace)->flags.stat == marking)
|
#define is_marking(objspace) ((objspace)->flags.stat == gc_stat_marking)
|
||||||
#define is_sweeping(objspace) ((objspace)->flags.stat == sweeping)
|
#define is_sweeping(objspace) ((objspace)->flags.stat == gc_stat_sweeping)
|
||||||
#define is_full_marking(objspace) ((objspace)->flags.during_minor_gc == FALSE)
|
#define is_full_marking(objspace) ((objspace)->flags.during_minor_gc == FALSE)
|
||||||
#if GC_ENABLE_INCREMENTAL_MARK
|
#if GC_ENABLE_INCREMENTAL_MARK
|
||||||
#define is_incremental_marking(objspace) ((objspace)->flags.during_incremental_marking != FALSE)
|
#define is_incremental_marking(objspace) ((objspace)->flags.during_incremental_marking != FALSE)
|
||||||
|
@ -3160,6 +3160,20 @@ gc_heap_prepare_minimum_pages(rb_objspace_t *objspace, rb_heap_t *heap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gc_stat_transition(rb_objspace_t *objspace, enum gc_stat stat)
|
||||||
|
{
|
||||||
|
#if RGEGNC_CHECK_MODE
|
||||||
|
enum gc_stat prev_stat = objspace->flags.stat;
|
||||||
|
switch (prev_stat) {
|
||||||
|
case gc_stat_none: assert(stat == gc_stat_marking); break;
|
||||||
|
case gc_stat_mark: assert(stat == gc_stat_sweeping); break;
|
||||||
|
case gc_stat_sweep: assert(stat == gc_stat_none); break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
objspace->flags.stat = stat;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gc_sweep_start_heap(rb_objspace_t *objspace, rb_heap_t *heap)
|
gc_sweep_start_heap(rb_objspace_t *objspace, rb_heap_t *heap)
|
||||||
{
|
{
|
||||||
|
@ -3187,7 +3201,7 @@ gc_sweep_start(rb_objspace_t *objspace)
|
||||||
rb_heap_t *heap;
|
rb_heap_t *heap;
|
||||||
size_t total_limit_slot;
|
size_t total_limit_slot;
|
||||||
|
|
||||||
objspace->flags.stat = sweeping;
|
gc_stat_transition(objspace, gc_stat_sweeping);
|
||||||
|
|
||||||
/* sweep unlinked method entries */
|
/* sweep unlinked method entries */
|
||||||
if (GET_VM()->unlinked_method_entry_list) {
|
if (GET_VM()->unlinked_method_entry_list) {
|
||||||
|
@ -3242,7 +3256,7 @@ gc_sweep_finish(rb_objspace_t *objspace)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_END_SWEEP, 0);
|
gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_END_SWEEP, 0);
|
||||||
objspace->flags.stat = none;
|
gc_stat_transition(objspace, gc_stat_none);
|
||||||
|
|
||||||
#if RGENGC_CHECK_MODE >= 2
|
#if RGENGC_CHECK_MODE >= 2
|
||||||
gc_verify_internal_consistency(Qnil);
|
gc_verify_internal_consistency(Qnil);
|
||||||
|
@ -4819,7 +4833,7 @@ gc_marks_start(rb_objspace_t *objspace, int full_mark)
|
||||||
{
|
{
|
||||||
/* start marking */
|
/* start marking */
|
||||||
gc_report(1, objspace, "gc_marks_start: (%s)\n", full_mark ? "full" : "minor");
|
gc_report(1, objspace, "gc_marks_start: (%s)\n", full_mark ? "full" : "minor");
|
||||||
objspace->flags.stat = marking;
|
gc_stat_transition(objspace, gc_stat_marking);
|
||||||
|
|
||||||
#if USE_RGENGC
|
#if USE_RGENGC
|
||||||
objspace->rgengc.old_object_count_at_gc_start = objspace->rgengc.old_object_count;
|
objspace->rgengc.old_object_count_at_gc_start = objspace->rgengc.old_object_count;
|
||||||
|
@ -5768,7 +5782,7 @@ gc_start(rb_objspace_t *objspace, const int full_mark, const int immediate_mark,
|
||||||
if (!ready_to_gc(objspace)) return TRUE; /* GC is not allowed */
|
if (!ready_to_gc(objspace)) return TRUE; /* GC is not allowed */
|
||||||
|
|
||||||
if (RGENGC_CHECK_MODE) {
|
if (RGENGC_CHECK_MODE) {
|
||||||
assert(objspace->flags.stat == none);
|
assert(objspace->flags.stat == gc_stat_none);
|
||||||
assert(!is_lazy_sweeping(heap_eden));
|
assert(!is_lazy_sweeping(heap_eden));
|
||||||
assert(!is_incremental_marking(objspace));
|
assert(!is_incremental_marking(objspace));
|
||||||
#if RGENGC_CHECK_MODE >= 2
|
#if RGENGC_CHECK_MODE >= 2
|
||||||
|
|
Загрузка…
Ссылка в новой задаче