Project

General

Profile

« Previous | Next » 

Revision d8a4af47

Added by tenderlovemaking (Aaron Patterson) over 4 years ago

Only use add_mark_object in Ripper

This patch changes parse.y to only use add_mark_object in Ripper.
Previously we were seeing a bug in write barrier verification. I had
changed add_mark_object to execute the write barrier, but the problem
is that we had code like this:

NEW_STR(add_mark_object(p, obj), loc)

In this case, add_mark_object would execute the write barrier between
the ast and obj, but the problem is that obj isn't actually
reachable from the AST at the time the write barrier executed.
NEW_STR can possibly call malloc which can kick a GC, and since
obj isn't actually reachable from the AST at the time of WB execution,
verification would fail.

Basically the steps were like this:

  1. RB_OBJ_WRITTEN via add_mark_object
  2. Allocate node
  3. Possibly execute GC via malloc
  4. Write obj in to allocated node

This patch changes the steps to:

  1. Allocate node
  2. Possibly execute GC via malloc
  3. Write obj in to allocated node
  4. RB_OBJ_WRITTEN