Skip to content

Commit 7dd9c76

Browse files
committed
Make imemo_tmpbuf not write-barrier protected
imemo_tmpbuf is not write-barrier protected and uses mark maybe to mark the buffer it holds. The normal rb_imemo_new creates a write-barrier protected object which can make the tmpbuf miss marking references.
1 parent 1e3e04c commit 7dd9c76

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

imemo.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ rb_imemo_new(enum imemo_type type, VALUE v0, size_t size)
5151
VALUE
5252
rb_imemo_tmpbuf_new(void)
5353
{
54-
return rb_imemo_new(imemo_tmpbuf, 0, sizeof(rb_imemo_tmpbuf_t));
54+
VALUE flags = T_IMEMO | (imemo_tmpbuf << FL_USHIFT);
55+
NEWOBJ_OF(obj, rb_imemo_tmpbuf_t, 0, flags, sizeof(rb_imemo_tmpbuf_t), NULL);
56+
57+
return (VALUE)obj;
5558
}
5659

5760
void *

0 commit comments

Comments
 (0)