Skip to content

Commit

Permalink
arrayset: simplify code with jl_array_ptr_1d_push
Browse files Browse the repository at this point in the history
this avoids the arrayset and manually dealing with the write barrier
  • Loading branch information
benlorenz committed Oct 30, 2023
1 parent 92af986 commit 877e9c7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions include/jlcxx/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,8 @@ class Array
void push_back(VT&& val)
{
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);
data[pos] = jval;
jl_gc_wb(m_array, jval);
jl_array_ptr_1d_push(m_array, jval);
JL_GC_POP();
}

Expand Down

0 comments on commit 877e9c7

Please sign in to comment.