fix(runtime/lean): incorrect assertion

This commit is contained in:
Leonardo de Moura 2019-08-22 20:31:47 -07:00
parent 124c5da414
commit 79f4eeea62
2 changed files with 4 additions and 2 deletions

View file

@ -123,7 +123,7 @@ bool object_compactor::insert_array(object * o) {
new_o->m_size = sz;
new_o->m_capacity = sz;
for (size_t i = 0; i < sz; i++) {
array_set((lean_object*)new_o, i, offsets[i]);
lean_array_set_core((lean_object*)new_o, i, offsets[i]);
}
save(o, (lean_object*)new_o);
return true;

View file

@ -702,7 +702,9 @@ static inline b_lean_obj_res lean_array_get_core(b_lean_obj_arg o, size_t i) {
return lean_to_array(o)->m_data[i];
}
static inline void lean_array_set_core(u_lean_obj_arg o, size_t i, lean_obj_arg v) {
assert(lean_is_exclusive(o));
/* Remark: we use this procedure to update non shared arrays in the heap,
and when copying objects to compact region at compact.cpp */
assert(!lean_is_heap_object(o) || lean_is_exclusive(o));
assert(i < lean_array_size(o));
lean_to_array(o)->m_data[i] = v;
}