Skip to content
Snippets Groups Projects
Commit f10f3efa authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Mappings: Compat: Reduce aggressiveness of rehash gc.

Non-reference counted values are now counted as multi-referenced
by the rehash gc. This fixes issues where elements are lost in
double-weak mappings due to either the index or the value being
a non-reference counted value.
parent 73f72e68
Branches
Tags
No related merge requests found
......@@ -350,10 +350,13 @@ static void mapping_rehash_backwards_evil(struct mapping_data *md,
}
break;
case MAPPING_WEAK:
if ((TYPEOF(from->ind) <= MAX_REF_TYPE) &&
(*from->ind.u.refs > 1) &&
(TYPEOF(from->val) <= MAX_REF_TYPE) &&
(*from->val.u.refs > 1)) {
/* NB: Compat: Unreference counted values are counted
* as multi-referenced here.
*/
if (((TYPEOF(from->ind) > MAX_REF_TYPE) ||
(*from->ind.u.refs > 1)) &&
((TYPEOF(from->val) > MAX_REF_TYPE) ||
(*from->val.u.refs > 1))) {
goto keep_keypair;
}
break;
......@@ -440,10 +443,13 @@ static void mapping_rehash_backwards_good(struct mapping_data *md,
}
break;
case MAPPING_WEAK:
if ((TYPEOF(from->ind) <= MAX_REF_TYPE) &&
(*from->ind.u.refs > 1) &&
(TYPEOF(from->val) <= MAX_REF_TYPE) &&
(*from->val.u.refs > 1)) {
/* NB: Compat: Unreference counted values are counted
* as multi-referenced here.
*/
if (((TYPEOF(from->ind) > MAX_REF_TYPE) ||
(*from->ind.u.refs > 1)) &&
((TYPEOF(from->val) > MAX_REF_TYPE) ||
(*from->val.u.refs > 1))) {
goto keep_keypair;
}
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment