mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c: fix around GC_DEBUG.
* gc.c (RVALUE::line): should be VALUE. On some environment (such as mswin64), `int' introduces alignment mismatch. * gc.c (newobj_of): add an assertion to check VALUE alignment. * gc.c (aligned_malloc): `&' is low priority than `=='. * gc.c: define GC_DEBUG everytime and use it as value 0 or 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
158f3547e9
commit
21ecf88ce0
2 changed files with 28 additions and 7 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
Mon Aug 19 20:55:12 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* gc.c: fix around GC_DEBUG.
|
||||||
|
|
||||||
|
* gc.c (RVALUE::line): should be VALUE. On some environment
|
||||||
|
(such as mswin64), `int' introduces alignment mismatch.
|
||||||
|
|
||||||
|
* gc.c (newobj_of): add an assertion to check VALUE alignment.
|
||||||
|
|
||||||
|
* gc.c (aligned_malloc): `&' is low priority than `=='.
|
||||||
|
|
||||||
|
* gc.c: define GC_DEBUG everytime and use it as value 0 or 1.
|
||||||
|
|
||||||
Mon Aug 19 17:43:44 2013 Koichi Sasada <ko1@atdot.net>
|
Mon Aug 19 17:43:44 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* test/ruby/test_fiber.rb: collect garbage fibers immediately.
|
* test/ruby/test_fiber.rb: collect garbage fibers immediately.
|
||||||
|
|
22
gc.c
22
gc.c
|
@ -90,6 +90,13 @@ static ruby_gc_params_t initial_params = {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* GC_DEBUG:
|
||||||
|
* enable to embed GC debugging information.
|
||||||
|
*/
|
||||||
|
#ifndef GC_DEBUG
|
||||||
|
#define GC_DEBUG 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if USE_RGENGC
|
#if USE_RGENGC
|
||||||
/* RGENGC_DEBUG:
|
/* RGENGC_DEBUG:
|
||||||
* 1: basic information
|
* 1: basic information
|
||||||
|
@ -230,9 +237,9 @@ typedef struct RVALUE {
|
||||||
VALUE v3;
|
VALUE v3;
|
||||||
} values;
|
} values;
|
||||||
} as;
|
} as;
|
||||||
#ifdef GC_DEBUG
|
#if GC_DEBUG
|
||||||
const char *file;
|
const char *file;
|
||||||
int line;
|
VALUE line;
|
||||||
#endif
|
#endif
|
||||||
} RVALUE;
|
} RVALUE;
|
||||||
|
|
||||||
|
@ -979,9 +986,10 @@ newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3)
|
||||||
RANY(obj)->as.values.v2 = v2;
|
RANY(obj)->as.values.v2 = v2;
|
||||||
RANY(obj)->as.values.v3 = v3;
|
RANY(obj)->as.values.v3 = v3;
|
||||||
|
|
||||||
#ifdef GC_DEBUG
|
#if GC_DEBUG
|
||||||
RANY(obj)->file = rb_sourcefile();
|
RANY(obj)->file = rb_sourcefile();
|
||||||
RANY(obj)->line = rb_sourceline();
|
RANY(obj)->line = rb_sourceline();
|
||||||
|
assert(!SPECIAL_CONST_P(obj)); /* check alignment */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if RGENGC_PROFILE
|
#if RGENGC_PROFILE
|
||||||
|
@ -3339,7 +3347,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef GC_DEBUG
|
#if GC_DEBUG
|
||||||
rb_gcdebug_print_obj_condition((VALUE)obj);
|
rb_gcdebug_print_obj_condition((VALUE)obj);
|
||||||
#endif
|
#endif
|
||||||
if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("rb_gc_mark(): %p is T_NONE", (void *)obj);
|
if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("rb_gc_mark(): %p is T_NONE", (void *)obj);
|
||||||
|
@ -4619,9 +4627,9 @@ aligned_malloc(size_t alignment, size_t size)
|
||||||
res = (void*)aligned;
|
res = (void*)aligned;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(GC_DEBUG)
|
#if defined(_DEBUG) || GC_DEBUG
|
||||||
/* alignment must be a power of 2 */
|
/* alignment must be a power of 2 */
|
||||||
assert((alignment - 1) & alignment == 0);
|
assert(((alignment - 1) & alignment) == 0);
|
||||||
assert(alignment % sizeof(void*) == 0);
|
assert(alignment % sizeof(void*) == 0);
|
||||||
#endif
|
#endif
|
||||||
return res;
|
return res;
|
||||||
|
@ -5640,7 +5648,7 @@ obj_type_name(VALUE obj)
|
||||||
return type_name(TYPE(obj), obj);
|
return type_name(TYPE(obj), obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GC_DEBUG
|
#if GC_DEBUG
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_gcdebug_print_obj_condition(VALUE obj)
|
rb_gcdebug_print_obj_condition(VALUE obj)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue