Skip to content

Commit

Permalink
need write barrier for timew because it might be Bignum object
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Jul 12, 2012
1 parent 3ee0698 commit 05b2ebd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions time.c
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ time_s_alloc(VALUE klass, SEL sel)
tobj->basic.klass = klass;
tobj->basic.flags = 0;
tobj->tm_got=0;
tobj->timew = WINT2FIXWV(0);
GC_WB(&tobj->timew, WINT2FIXWV(0));

return (VALUE)tobj;
}
Expand Down Expand Up @@ -1944,7 +1944,7 @@ time_init_0(VALUE time)
time_modify(time);
GetTimeval(time, tobj);
tobj->tm_got=0;
tobj->timew = WINT2FIXWV(0);
GC_WB(&tobj->timew, WINT2FIXWV(0));
#ifdef HAVE_CLOCK_GETTIME
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
rb_sys_fail("clock_gettime");
Expand All @@ -1959,7 +1959,7 @@ time_init_0(VALUE time)
ts.tv_nsec = tv.tv_usec * 1000;
}
#endif
tobj->timew = timespec2timew(&ts);
GC_WB(&tobj->timew, timespec2timew(&ts));

return time;
}
Expand Down Expand Up @@ -2185,17 +2185,17 @@ time_init_1(int argc, VALUE *argv, VALUE time)
time_modify(time);
GetTimeval(time, tobj);
tobj->tm_got=0;
tobj->timew = WINT2FIXWV(0);
GC_WB(&tobj->timew, WINT2FIXWV(0));

if (!NIL_P(vtm.utc_offset)) {
VALUE off = vtm.utc_offset;
vtm_add_offset(&vtm, neg(off));
vtm.utc_offset = Qnil;
tobj->timew = timegmw(&vtm);
GC_WB(&tobj->timew, timegmw(&vtm));
return time_set_utc_offset(time, off);
}
else {
tobj->timew = timelocalw(&vtm);
GC_WB(&tobj->timew, timelocalw(&vtm));
return time_localtime(time);
}
}
Expand Down Expand Up @@ -2300,7 +2300,7 @@ time_new_timew(VALUE klass, wideval_t timew)
struct time_object *tobj;

GetTimeval(time, tobj);
tobj->timew = timew;
GC_WB(&tobj->timew, timew);

return time;
}
Expand Down Expand Up @@ -4708,7 +4708,7 @@ end_submicro: ;

GetTimeval(time, tobj);
tobj->tm_got = 0;
tobj->timew = timew;
GC_WB(&tobj->timew, timew);
if (gmt) {
TIME_SET_UTC(tobj);
}
Expand Down Expand Up @@ -4749,7 +4749,7 @@ imp_initWithTimeIntervalSinceReferenceDate(void *rcv, SEL sel, double interval)
struct timespec ts = rb_time_timespec(DOUBLE2NUM(interval + SINCE_EPOCH));
struct time_object *tobj;
GetTimeval(rcv, tobj);
tobj->timew = timespec2timew(&ts);
GC_WB(&tobj->timew, timespec2timew(&ts));
return rcv;
}

Expand Down

0 comments on commit 05b2ebd

Please sign in to comment.