group-synchronized earlier in unprotected_norehash_emplace_or_visit

This commit is contained in:
joaquintides
2023-03-21 14:47:43 +01:00
parent 7ed7878278
commit d29815b3a8

View File

@ -870,25 +870,20 @@ private:
for(prober pb(pos0);;pb.next(this->arrays.groups_size_mask)){ for(prober pb(pos0);;pb.next(this->arrays.groups_size_mask)){
auto pos=pb.get(); auto pos=pb.get();
auto pg=this->arrays.groups+pos; auto pg=this->arrays.groups+pos;
auto lck=exclusive_access(pos);
auto mask=pg->match_available(); auto mask=pg->match_available();
if(BOOST_LIKELY(mask!=0)){ if(BOOST_LIKELY(mask!=0)){
auto lck=exclusive_access(pos); auto n=unchecked_countr_zero(mask);
do{ reserve_slot rslot{pg,n,hash};
auto n=unchecked_countr_zero(mask); if(BOOST_UNLIKELY(insert_counter(pos0)++!=counter)){
if(BOOST_LIKELY(!pg->is_occupied(n))){ /* other thread inserted from pos0, need to start over */
reserve_slot rslot{pg,n,hash}; goto startover;
if(BOOST_UNLIKELY(insert_counter(pos0)++!=counter)){ }
/* other thread inserted from pos0, need to start over */ auto p=this->arrays.elements+pos*N+n;
goto startover; this->construct_element(p,std::forward<Args>(args)...);
} rslot.commit();
auto p=this->arrays.elements+pos*N+n; rsize.commit();
this->construct_element(p,std::forward<Args>(args)...); return 1;
rslot.commit();
rsize.commit();
return 1;
}
mask&=mask-1;
}while(mask);
} }
pg->mark_overflow(hash); pg->mark_overflow(hash);
} }