Skip to content

Commit

Permalink
arrayset: correct write barrier
Browse files Browse the repository at this point in the history
keeps jl_arrayset for older julia version which should deal with the
write barrier internally

Co-authored-by: Jameson Nash <[email protected]>
  • Loading branch information
benlorenz and vtjnash committed Oct 30, 2023
1 parent 92af986 commit 26c76fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/jlcxx/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,14 @@ class Array
JL_GC_PUSH1(&m_array);
const size_t pos = jl_array_len(m_array);
jl_array_grow_end(m_array, 1);
jl_value_t** data = jlcxx_array_data<jl_value_t*>(m_array);
jl_value_t* jval = box<ValueT>(val);
#if (JULIA_VERSION_MAJOR * 100 + JULIA_VERSION_MINOR) >= 111
jl_value_t** data = jlcxx_array_data<jl_value_t*>(m_array);
data[pos] = jval;
jl_gc_wb(m_array, jval);
jl_gc_wb(jl_array_owner(m_array), jval);
#else
jl_arrayset(m_array, jval, pos);
#endif
JL_GC_POP();
}

Expand Down

0 comments on commit 26c76fa

Please sign in to comment.