Skip to content

Commit

Permalink
Confirm object-graph safety at barrier creation point
Browse files Browse the repository at this point in the history
  • Loading branch information
rm155 committed Apr 15, 2024
1 parent d6a9f46 commit 358277a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 10 additions & 9 deletions internal/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,16 @@ void rb_global_tables_init(void);
void rb_absorb_objspace_of_closing_ractor(rb_ractor_t *receiving_ractor, rb_ractor_t *closing_ractor);

typedef enum {
OGS_FLAG_NONE = 0x000,
OGS_FLAG_NOT_RUNNING = 0x001,
OGS_FLAG_BLOCKING = 0x002,
OGS_FLAG_BARRIER_WAITING = 0x004,
OGS_FLAG_ENTERING_VM_LOCK = 0x008,
OGS_FLAG_RUNNING_LOCAL_GC = 0x010,
OGS_FLAG_RUNNING_GLOBAL_GC = 0x020,
OGS_FLAG_ABSORBING_OBJSPACE = 0x040,
OGS_FLAG_COND_AND_BARRIER = 0x080,
OGS_FLAG_NONE = 0x000,
OGS_FLAG_NOT_RUNNING = 0x001,
OGS_FLAG_BLOCKING = 0x002,
OGS_FLAG_BARRIER_WAITING = 0x004,
OGS_FLAG_BARRIER_CREATING = 0x008,
OGS_FLAG_ENTERING_VM_LOCK = 0x010,
OGS_FLAG_RUNNING_LOCAL_GC = 0x020,
OGS_FLAG_RUNNING_GLOBAL_GC = 0x040,
OGS_FLAG_ABSORBING_OBJSPACE = 0x080,
OGS_FLAG_COND_AND_BARRIER = 0x100,
};

struct rb_order_chain_node {
Expand Down
2 changes: 2 additions & 0 deletions vm_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ rb_vm_barrier(void)
VM_ASSERT(cr == GET_RACTOR());
VM_ASSERT(rb_ractor_status_p(cr, ractor_running));

rb_ractor_object_graph_safety_advance(cr, OGS_FLAG_BARRIER_CREATING);
rb_ractor_sched_barrier_start(vm, cr);
rb_ractor_object_graph_safety_withdraw(cr, OGS_FLAG_BARRIER_CREATING);
}
}

Expand Down

0 comments on commit 358277a

Please sign in to comment.