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.
This commit is contained in:
John Hawthorn 2025-06-08 10:52:33 -07:00
parent 0e2067dfa7
commit 6b3fa23563
Notes: git 2025-06-18 17:17:47 +00:00

6
time.c
View file

@ -5800,8 +5800,10 @@ tm_from_time(VALUE klass, VALUE time)
tm = time_s_alloc(klass);
ttm = RTYPEDDATA_GET_DATA(tm);
v = &vtm;
GMTIMEW(ttm->timew = tobj->timew, v);
ttm->timew = wsub(ttm->timew, v->subsecx);
WIDEVALUE timew = tobj->timew;
GMTIMEW(timew, v);
time_set_timew(tm, ttm, wsub(timew, v->subsecx));
v->subsecx = INT2FIX(0);
v->zone = Qnil;
time_set_vtm(tm, ttm, *v);