mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/ruby.h, gc.c: rename macros and functions:
OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(), rb_obj_wb_giveup() -> rb_obj_wb_unprotect(), rb_gc_giveup_promoted_writebarrier() -> rb_gc_writebarrier_unprotect_promoted(), * class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3cf42a0b2d
commit
982fee4fcc
6 changed files with 26 additions and 18 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Sun Jun 23 06:49:28 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* include/ruby/ruby.h, gc.c: rename macros and functions:
|
||||
OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(),
|
||||
rb_obj_wb_giveup() -> rb_obj_wb_unprotect(),
|
||||
rb_gc_giveup_promoted_writebarrier() ->
|
||||
rb_gc_writebarrier_unprotect_promoted(),
|
||||
|
||||
* class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT().
|
||||
|
||||
Sun Jun 23 05:41:32 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* class.c (rb_include_class_new), eval.c (rb_using_refinement):
|
||||
|
|
2
class.c
2
class.c
|
@ -690,7 +690,7 @@ rb_include_class_new(VALUE module, VALUE super)
|
|||
RCLASS_IV_TBL(klass) = RCLASS_IV_TBL(module);
|
||||
RCLASS_CONST_TBL(klass) = RCLASS_CONST_TBL(module);
|
||||
|
||||
RCLASS_M_TBL(OBJ_WB_GIVEUP(klass)) = RCLASS_M_TBL(OBJ_WB_GIVEUP(RCLASS_ORIGIN(module)));
|
||||
RCLASS_M_TBL(OBJ_WB_UNPROTECT(klass)) = RCLASS_M_TBL(OBJ_WB_UNPROTECT(RCLASS_ORIGIN(module)));
|
||||
|
||||
RCLASS_SET_SUPER(klass, super);
|
||||
if (RB_TYPE_P(module, T_ICLASS)) {
|
||||
|
|
2
eval.c
2
eval.c
|
@ -1100,7 +1100,7 @@ rb_using_refinement(NODE *cref, VALUE klass, VALUE module)
|
|||
c = iclass = rb_include_class_new(module, superclass);
|
||||
RCLASS_REFINED_CLASS(c) = klass;
|
||||
|
||||
RCLASS_M_TBL(OBJ_WB_GIVEUP(c)) = RCLASS_M_TBL(OBJ_WB_GIVEUP(module));
|
||||
RCLASS_M_TBL(OBJ_WB_UNPROTECT(c)) = RCLASS_M_TBL(OBJ_WB_UNPROTECT(module));
|
||||
|
||||
module = RCLASS_SUPER(module);
|
||||
while (module && module != klass) {
|
||||
|
|
8
gc.c
8
gc.c
|
@ -3876,16 +3876,16 @@ rb_gc_writebarrier(VALUE a, VALUE b)
|
|||
}
|
||||
|
||||
void
|
||||
rb_gc_giveup_promoted_writebarrier(VALUE obj)
|
||||
rb_gc_writebarrier_unprotect_promoted(VALUE obj)
|
||||
{
|
||||
rb_objspace_t *objspace = &rb_objspace;
|
||||
|
||||
if (RGENGC_CHECK_MODE) {
|
||||
if (!RVALUE_PROMOTED(obj)) rb_bug("rb_gc_giveup_promoted_writebarrier: called on non-promoted object");
|
||||
if (!RVALUE_SHADY(obj)) rb_bug("rb_gc_giveup_promoted_writebarrier: called on non-shady object");
|
||||
if (!RVALUE_PROMOTED(obj)) rb_bug("rb_gc_writebarrier_unprotect_promoted: called on non-promoted object");
|
||||
if (!RVALUE_SHADY(obj)) rb_bug("rb_gc_writebarrier_unprotect_promoted: called on non-shady object");
|
||||
}
|
||||
|
||||
rgengc_report(2, objspace, "rb_gc_giveup_writebarrier: %p (%s)%s\n", (void *)obj, obj_type_name(obj),
|
||||
rgengc_report(2, objspace, "rb_gc_writebarrier_unprotect_promoted: %p (%s)%s\n", (void *)obj, obj_type_name(obj),
|
||||
rgengc_remembered(objspace, obj) ? " (already remembered)" : "");
|
||||
|
||||
RVALUE_DEMOTE(obj);
|
||||
|
|
2
hash.c
2
hash.c
|
@ -298,7 +298,7 @@ hash_tbl(VALUE hash)
|
|||
struct st_table *
|
||||
rb_hash_tbl(VALUE hash)
|
||||
{
|
||||
OBJ_WB_GIVEUP(hash);
|
||||
OBJ_WB_UNPROTECT(hash);
|
||||
return hash_tbl(hash);
|
||||
}
|
||||
|
||||
|
|
|
@ -972,7 +972,7 @@ struct RArray {
|
|||
OBJ_WRITE(_ary_, &RARRAY_RAWPTR(_ary_)[i], (v)); \
|
||||
} while (0)
|
||||
|
||||
#define RARRAY_PTR(a) ((VALUE *)RARRAY_RAWPTR(RGENGC_WB_PROTECTED_ARRAY ? OBJ_WB_GIVEUP((VALUE)a) : ((VALUE)a)))
|
||||
#define RARRAY_PTR(a) ((VALUE *)RARRAY_RAWPTR(RGENGC_WB_PROTECTED_ARRAY ? OBJ_WB_UNPROTECT((VALUE)a) : ((VALUE)a)))
|
||||
|
||||
struct RRegexp {
|
||||
struct RBasic basic;
|
||||
|
@ -1129,7 +1129,7 @@ struct RStruct {
|
|||
((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
|
||||
RSTRUCT(st)->as.ary : \
|
||||
RSTRUCT(st)->as.heap.ptr)
|
||||
#define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_RAWPTR(RGENGC_WB_PROTECTED_STRUCT ? OBJ_WB_GIVEUP((VALUE)st) : (VALUE)st))
|
||||
#define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_RAWPTR(RGENGC_WB_PROTECTED_STRUCT ? OBJ_WB_UNPROTECT((VALUE)st) : (VALUE)st))
|
||||
|
||||
#define RSTRUCT_SET(st, idx, v) OBJ_WRITE(st, &RSTRUCT_RAWPTR(st)[idx], (v))
|
||||
#define RSTRUCT_GET(st, idx) (RSTRUCT_RAWPTR(st)[idx])
|
||||
|
@ -1245,27 +1245,25 @@ struct RBignum {
|
|||
#if USE_RGENGC
|
||||
#define OBJ_PROMOTED(x) (SPECIAL_CONST_P(x) ? 0 : FL_TEST_RAW((x), FL_OLDGEN))
|
||||
#define OBJ_WB_PROTECTED(x) (SPECIAL_CONST_P(x) ? 1 : FL_TEST_RAW((x), FL_WB_PROTECTED))
|
||||
#define OBJ_WB_GIVEUP(x) rb_obj_wb_giveup(x, __FILE__, __LINE__)
|
||||
#define OBJ_WB_
|
||||
#define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
|
||||
|
||||
void rb_gc_writebarrier(VALUE a, VALUE b);
|
||||
void rb_gc_giveup_promoted_writebarrier(VALUE obj);
|
||||
void rb_gc_writebarrier_unprotect_promoted(VALUE obj);
|
||||
|
||||
#else /* USE_RGENGC */
|
||||
#define OBJ_PROMOTED(x) 0
|
||||
#define OBJ_WB_PROTECTED(x) 0
|
||||
#define OBJ_WB_GIVEUP(x) rb_obj_wb_giveup(x, __FILE__, __LINE__)
|
||||
#define OBJ_SHADE(x) OBJ_WB_GIVEUP(x) /* RGENGC terminology */
|
||||
#define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
#define OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)
|
||||
#define OBJ_WRITTEN(a, oldv, b) rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__)
|
||||
|
||||
static inline VALUE
|
||||
rb_obj_wb_giveup(VALUE x, const char *filename, int line)
|
||||
rb_obj_wb_unprotect(VALUE x, const char *filename, int line)
|
||||
{
|
||||
#ifdef RGENGC_LOGGING_WB_GIVEUP
|
||||
RGENGC_LOGGING_WB_GIVEUP(x, filename, line);
|
||||
#ifdef RGENGC_LOGGING_WB_UNPROTECT
|
||||
RGENGC_LOGGING_WB_UNPROTECT(x, filename, line);
|
||||
#endif
|
||||
|
||||
#if USE_RGENGC
|
||||
|
@ -1274,7 +1272,7 @@ rb_obj_wb_giveup(VALUE x, const char *filename, int line)
|
|||
RBASIC(x)->flags &= ~FL_WB_PROTECTED;
|
||||
|
||||
if (FL_TEST_RAW((x), FL_OLDGEN)) {
|
||||
rb_gc_giveup_promoted_writebarrier(x);
|
||||
rb_gc_writebarrier_unprotect_promoted(x);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue