Skip to content

Commit ffbccd4

Browse files
jhawthornk0kubun
authored andcommitted
Add write barrier on tm_from_time->timew
We want to always use time_set_timew, as timew is 64-bit even on 32-bit platforms so we need to be careful to both write that size, but still trigger write barriers if we end up with a heap object.
1 parent 34af499 commit ffbccd4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

time.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5774,8 +5774,10 @@ tm_from_time(VALUE klass, VALUE time)
57745774
tm = time_s_alloc(klass);
57755775
ttm = RTYPEDDATA_GET_DATA(tm);
57765776
v = &vtm;
5777-
GMTIMEW(ttm->timew = tobj->timew, v);
5778-
ttm->timew = wsub(ttm->timew, v->subsecx);
5777+
5778+
WIDEVALUE timew = tobj->timew;
5779+
GMTIMEW(timew, v);
5780+
time_set_timew(tm, ttm, wsub(timew, v->subsecx));
57795781
v->subsecx = INT2FIX(0);
57805782
v->zone = Qnil;
57815783
time_set_vtm(tm, ttm, *v);

0 commit comments

Comments
 (0)