@@ -292,7 +292,7 @@ size_t DropDeletesWithoutResizeAndPrepareInsert(CommonFields& common,
292292 ConvertDeletedToEmptyAndFullToDeleted (ctrl, capacity);
293293 const void * hash_fn = policy.hash_fn (common);
294294 auto hasher = policy.hash_slot ;
295- auto transfer = policy.transfer ;
295+ auto transfer_n = policy.transfer_n ;
296296 const size_t slot_size = policy.slot_size ;
297297
298298 size_t total_probe_length = 0 ;
@@ -337,7 +337,7 @@ size_t DropDeletesWithoutResizeAndPrepareInsert(CommonFields& common,
337337 // SetCtrl poisons/unpoisons the slots so we have to call it at the
338338 // right time.
339339 SetCtrlInLargeTable (common, new_i, h2, slot_size);
340- (*transfer )(set, new_slot_ptr, slot_ptr, 1 );
340+ (*transfer_n )(set, new_slot_ptr, slot_ptr, 1 );
341341 SetCtrlInLargeTable (common, i, ctrl_t ::kEmpty , slot_size);
342342 // Initialize or change empty space id.
343343 tmp_space_id = i;
@@ -353,9 +353,9 @@ size_t DropDeletesWithoutResizeAndPrepareInsert(CommonFields& common,
353353 SanitizerUnpoisonMemoryRegion (tmp_space, slot_size);
354354
355355 // Swap i and new_i elements.
356- (*transfer )(set, tmp_space, new_slot_ptr, 1 );
357- (*transfer )(set, new_slot_ptr, slot_ptr, 1 );
358- (*transfer )(set, slot_ptr, tmp_space, 1 );
356+ (*transfer_n )(set, tmp_space, new_slot_ptr, 1 );
357+ (*transfer_n )(set, new_slot_ptr, slot_ptr, 1 );
358+ (*transfer_n )(set, slot_ptr, tmp_space, 1 );
359359
360360 SanitizerPoisonMemoryRegion (tmp_space, slot_size);
361361
@@ -623,7 +623,7 @@ void InsertOldSooSlotAndInitializeControlBytes(CommonFields& c,
623623 SanitizerPoisonMemoryRegion (new_slots, policy.slot_size * new_capacity);
624624 void * target_slot = SlotAddress (new_slots, offset, policy.slot_size );
625625 SanitizerUnpoisonMemoryRegion (target_slot, policy.slot_size );
626- policy.transfer (&c, target_slot, c.soo_data (), 1 );
626+ policy.transfer_n (&c, target_slot, c.soo_data (), 1 );
627627 c.set_control </* kGenerateSeed=*/ false >(new_ctrl);
628628 c.set_slots (new_slots);
629629 ResetCtrl (c, policy.slot_size );
@@ -863,14 +863,14 @@ size_t GrowToNextCapacityAndPrepareInsert(CommonFields& common,
863863 common.generate_new_seed ();
864864 find_info = FindInfo{0 , 0 };
865865 } else {
866- if (is_single_group (new_capacity)) {
866+ if (ABSL_PREDICT_TRUE ( is_single_group (new_capacity) )) {
867867 GrowIntoSingleGroupShuffleControlBytes (old_ctrl, old_capacity, new_ctrl,
868868 new_capacity);
869- // Single group tables have no deleted slots, so we can transfer all slots
870- // without checking the control bytes.
869+ // Single group tables have all slots full on resize. So we can transfer
870+ // all slots without checking the control bytes.
871871 assert (common.size () == old_capacity);
872- policy.transfer (&common, NextSlot (new_slots, slot_size), old_slots,
873- old_capacity);
872+ policy.transfer_n (&common, NextSlot (new_slots, slot_size), old_slots,
873+ old_capacity);
874874 PoisonEmptySlots (common, slot_size);
875875 // We put the new element either at the beginning or at the end of the
876876 // table with approximately equal probability.
@@ -895,7 +895,7 @@ size_t GrowToNextCapacityAndPrepareInsert(CommonFields& common,
895895 PrepareInsertCommon (common);
896896 ResetGrowthLeft (common);
897897
898- if (has_infoz) {
898+ if (ABSL_PREDICT_FALSE ( has_infoz) ) {
899899 common.set_has_infoz ();
900900 infoz.RecordStorageChanged (common.size () - 1 , new_capacity);
901901 infoz.RecordRehash (total_probe_length);
@@ -1083,7 +1083,7 @@ void GrowFullSooTableToNextCapacity(CommonFields& common,
10831083 SanitizerPoisonMemoryRegion (next_slot, SooSlotMemcpySize - slot_size);
10841084 } else {
10851085 static_assert (SooSlotMemcpySize == 0 );
1086- policy.transfer (&common, target_slot, common.soo_data (), 1 );
1086+ policy.transfer_n (&common, target_slot, common.soo_data (), 1 );
10871087 }
10881088 common.set_control </* kGenerateSeed=*/ true >(new_ctrl);
10891089 common.set_slots (new_slots);
@@ -1134,11 +1134,11 @@ void Rehash(CommonFields& common, const PolicyFunctions& policy, size_t n) {
11341134 assert (policy.slot_align <= alignof (HeapOrSoo));
11351135 HeapOrSoo tmp_slot (uninitialized_tag_t {});
11361136 size_t begin_offset = FindFirstFullSlot (0 , cap, common.control ());
1137- policy.transfer (&common, &tmp_slot,
1138- SlotAddress ( common. slot_array (), begin_offset, slot_size) ,
1139- 1 );
1137+ policy.transfer_n (
1138+ & common, &tmp_slot ,
1139+ SlotAddress (common. slot_array (), begin_offset, slot_size), 1 );
11401140 clear_backing_array ();
1141- policy.transfer (&common, common.soo_data (), &tmp_slot, 1 );
1141+ policy.transfer_n (&common, common.soo_data (), &tmp_slot, 1 );
11421142 common.set_full_soo ();
11431143 return ;
11441144 }
0 commit comments