Skip to content

Commit

Permalink
Add marking functions for Julia objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbehrends committed Apr 18, 2019
1 parent df48487 commit eabd1b2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/julia_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,31 @@ static inline int JMark(void * obj)
return jl_gc_mark_queue_obj(JuliaTLS, (jl_value_t *)obj);
}

void MarkJuliaObjSafe(void * obj)
{
if (!obj)
return;
// Validate that `obj` is still allocated and not on a
// free list already. We verify this by checking that the
// type is a pool object of type `jl_datatype_type`.
jl_value_t *ty = jl_typeof(obj);
if (jl_gc_internal_obj_base_ptr(ty) != ty)
return;
if (!jl_typeis(ty, jl_datatype_type))
return;
if (jl_gc_mark_queue_obj(JuliaTLS, (jl_value_t *)obj))
YoungRef++;
}


void MarkJuliaObj(void * obj)
{
if (!obj)
return;
if (jl_gc_mark_queue_obj(JuliaTLS, (jl_value_t *)obj))
YoungRef++;
}


// Overview of conservative stack scanning
//
Expand Down

0 comments on commit eabd1b2

Please sign in to comment.