Comments (3)
Nice! I just created #35 for this. I was also already thinking about reducing redundancy with these comments, but wasn't sure where to put them yet. The definition of Moved
seems like a good place!
There is also some other PR i saw which had copied the argument, I'll go find it and tell them about the PR so that we don't introduce more copies of the FIXME again 😉
from flurry.
I'm thinking as follows: If we perform an operation that sees a Moved(t)
, we must have gotten there by loading self.table
with a guard g
. This guard g
will pin an epoch before the resize is finished with respect to the loaded table, otherwise we would have loaded the next table. This argument also exists here:
Lines 719 to 749 in 051ca79
- During the resize,
t
points tonext_table
and is thus valid. - After the resize,
t == self.table
, thust
is valid. - This holds until a subsequent resize ends, at which point
self.table != t
andt
isdefer_destroy
ed (see the code above). At this point,t
is not referenced by the map anymore. However, thedefer_destroy
happens whileg
is still pinning the epoch. Thus,t
remains valid for at least the lifetime ofg
. - After releasing
g
, performing operations on the map with a new guardg'
cannot access the table anymore (also see above).
Since this traces the entire lifetime of both the guard and the table and in particular, the above code is the only place that defer_destroy
s tables, I think the argument is sound. What do you think? Does this make sense to you?
from flurry.
Yes, that seems correct to me as well! Could you submit a PR with that argument included? I think maybe we want to make that argument as a comment on the Moved
variant of BinEntry
(rather than in everywhere that uses it), and then reference that argument from the two or three places that rely on it.
from flurry.
Related Issues (20)
- `#![deny(unsafe_op_in_unsafe_fn)]`
- Fails to build on arm HOT 1
- Memory usage in Flurry Hashmap HOT 16
- Hashmap lacks of get_mut API HOT 1
- Bump ahash dependency version to 0.8.5 HOT 4
- Allow use of pre-hashed keys HOT 1
- Tedious map constructors HOT 2
- Expose non-replacing `insert` HOT 17
- Implement Drain and IntoIterator HOT 2
- Replacing map elements incorrectly decrements the map's element count HOT 2
- Implement `HashSet::replace` HOT 3
- Optimize garbage collection HOT 4
- Run cargo audit in CI? HOT 2
- Racy test failure: treeifying a Moved entry HOT 8
- Racy test failure: segfault in map::tree_bins::concurrent_tree_bin HOT 5
- map::tree_bins::concurrent_tree_bin: attempt to subtract with overflow HOT 5
- HashMap enters unreachable code in try_insert HOT 2
- Miri CI invocation needs updating HOT 3
- Use of deprecated `compare_and_swap` and `spin_loop_hint` HOT 1
- Unsoundness in `HashMap::clear` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flurry.