[前][次][番号順一覧][スレッド一覧]

ruby-changes:32197

From: ko1 <ko1@a...>
Date: Wed, 18 Dec 2013 16:58:19 +0900 (JST)
Subject: [ruby-changes:32197] ko1:r44276 (trunk): * gc.c (gc_profile_clear, gc_profile_enable): remove rest_sweep().

ko1	2013-12-18 16:58:04 +0900 (Wed, 18 Dec 2013)

  New Revision: 44276

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44276

  Log:
    * gc.c (gc_profile_clear, gc_profile_enable): remove rest_sweep().
    * gc.c: check objspace->profile.current_record before inserting
      profiling record by new macro gc_prof_enabled().

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44275)
+++ ChangeLog	(revision 44276)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec 18 16:49:40 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (gc_profile_clear, gc_profile_enable): remove rest_sweep().
+
+	* gc.c: check objspace->profile.current_record before inserting
+	  profiling record by new macro gc_prof_enabled().
+
 Wed Dec 18 14:32:06 2013  Koichi Sasada  <ko1@a...>
 
 	* vm_exec.h (VM_DEBUG_STACKOVERFLOW): added.
Index: gc.c
===================================================================
--- gc.c	(revision 44275)
+++ gc.c	(revision 44276)
@@ -680,6 +680,7 @@ static inline void gc_prof_set_malloc_in https://github.com/ruby/ruby/blob/trunk/gc.c#L680
 static inline void gc_prof_set_heap_info(rb_objspace_t *);
 
 #define gc_prof_record(objspace) (objspace)->profile.current_record
+#define gc_prof_enabled(objspace) ((objspace)->profile.run && (objspace)->profile.current_record)
 
 #define rgengc_report if (RGENGC_DEBUG) rgengc_report_body
 static void rgengc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...);
@@ -2758,7 +2759,7 @@ gc_page_sweep(rb_objspace_t *objspace, r https://github.com/ruby/ruby/blob/trunk/gc.c#L2759
     gc_setup_mark_bits(sweep_page);
 
 #if GC_PROFILE_MORE_DETAIL
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
 	gc_profile_record *record = gc_prof_record(objspace);
 	record->removing_objects += final_slots + freed_slots;
 	record->empty_objects += empty_slots;
@@ -6782,7 +6783,7 @@ gc_prof_setup_new_record(rb_objspace_t * https://github.com/ruby/ruby/blob/trunk/gc.c#L6783
 static inline void
 gc_prof_timer_start(rb_objspace_t *objspace)
 {
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
 	gc_profile_record *record = gc_prof_record(objspace);
 #if GC_PROFILE_MORE_DETAIL
 	record->prepare_time = objspace->profile.prepare_time;
@@ -6807,7 +6808,7 @@ elapsed_time_from(double time) https://github.com/ruby/ruby/blob/trunk/gc.c#L6808
 static inline void
 gc_prof_timer_stop(rb_objspace_t *objspace)
 {
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
 	gc_profile_record *record = gc_prof_record(objspace);
 	record->gc_time = elapsed_time_from(record->gc_invoke_time);
 	record->gc_invoke_time -= objspace->profile.invoke_time;
@@ -6821,7 +6822,7 @@ gc_prof_mark_timer_start(rb_objspace_t * https://github.com/ruby/ruby/blob/trunk/gc.c#L6822
 	RUBY_DTRACE_GC_MARK_BEGIN();
     }
 #if GC_PROFILE_MORE_DETAIL
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
 	gc_prof_record(objspace)->gc_mark_time = getrusage_time();
     }
 #endif
@@ -6834,7 +6835,7 @@ gc_prof_mark_timer_stop(rb_objspace_t *o https://github.com/ruby/ruby/blob/trunk/gc.c#L6835
 	RUBY_DTRACE_GC_MARK_END();
     }
 #if GC_PROFILE_MORE_DETAIL
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
         gc_profile_record *record = gc_prof_record(objspace);
 	record->gc_mark_time = elapsed_time_from(record->gc_mark_time);
     }
@@ -6847,7 +6848,7 @@ gc_prof_sweep_timer_start(rb_objspace_t https://github.com/ruby/ruby/blob/trunk/gc.c#L6848
     if (RUBY_DTRACE_GC_SWEEP_BEGIN_ENABLED()) {
 	RUBY_DTRACE_GC_SWEEP_BEGIN();
     }
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
 	gc_profile_record *record = gc_prof_record(objspace);
 
 	if (record->gc_time > 0 || GC_PROFILE_MORE_DETAIL) {
@@ -6863,7 +6864,7 @@ gc_prof_sweep_timer_stop(rb_objspace_t * https://github.com/ruby/ruby/blob/trunk/gc.c#L6864
 	RUBY_DTRACE_GC_SWEEP_END();
     }
 
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
 	double sweep_time;
 	gc_profile_record *record = gc_prof_record(objspace);
 
@@ -6888,7 +6889,7 @@ static inline void https://github.com/ruby/ruby/blob/trunk/gc.c#L6889
 gc_prof_set_malloc_info(rb_objspace_t *objspace)
 {
 #if GC_PROFILE_MORE_DETAIL
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
         gc_profile_record *record = gc_prof_record(objspace);
 	record->allocate_increase = malloc_increase;
 	record->allocate_limit = malloc_limit;
@@ -6899,7 +6900,7 @@ gc_prof_set_malloc_info(rb_objspace_t *o https://github.com/ruby/ruby/blob/trunk/gc.c#L6900
 static inline void
 gc_prof_set_heap_info(rb_objspace_t *objspace)
 {
-    if (objspace->profile.run) {
+    if (gc_prof_enabled(objspace)) {
 	gc_profile_record *record = gc_prof_record(objspace);
 	size_t live = objspace->profile.total_allocated_object_num_at_gc_start - objspace->profile.total_freed_object_num;
 	size_t total = objspace->profile.heap_used_at_gc_start * HEAP_OBJ_LIMIT;
@@ -6928,12 +6929,6 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/gc.c#L6929
 gc_profile_clear(void)
 {
     rb_objspace_t *objspace = &rb_objspace;
-
-    /* This method doesn't change profile.run status.
-     * While lazy sweeping, it is possible to touch zero-cleared profile.current_record.
-     */
-    gc_rest_sweep(objspace);
-
     if (GC_PROFILE_RECORD_DEFAULT_SIZE * 2 < objspace->profile.size) {
         objspace->profile.size = GC_PROFILE_RECORD_DEFAULT_SIZE * 2;
         objspace->profile.records = realloc(objspace->profile.records, sizeof(gc_profile_record) * objspace->profile.size);
@@ -7005,7 +7000,7 @@ gc_profile_record_get(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L7000
     size_t i;
     rb_objspace_t *objspace = (&rb_objspace);
 
-    if (!objspace->profile.run) {
+    if (!gc_prof_enabled(objspace)) {
 	return Qnil;
     }
 
@@ -7254,8 +7249,8 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/gc.c#L7249
 gc_profile_enable(void)
 {
     rb_objspace_t *objspace = &rb_objspace;
-    gc_rest_sweep(objspace);
     objspace->profile.run = TRUE;
+    objspace->profile.current_record = 0;
     return Qnil;
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]