-
Notifications
You must be signed in to change notification settings - Fork 273
Document the sharing map, and move sharing map unit tests to catch #1899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the sharing map, and move sharing map unit tests to catch #1899
Conversation
9547dde
to
ed0918d
Compare
Build failures are genuine:
It seems that necessitates some changes to |
@tautschnig Ok, I'll add some documentation. |
ed0918d
to
f721a5f
Compare
f721a5f
to
88ac580
Compare
88ac580
to
f2afe15
Compare
Also, the test for sharing_map and sharing_node should probably be under the unit/util directory. |
unit/Makefile
Outdated
@@ -28,6 +28,7 @@ SRC += unit_tests.cpp \ | |||
java_bytecode/inherited_static_fields/inherited_static_fields.cpp \ | |||
pointer-analysis/custom_value_set_analysis.cpp \ | |||
sharing_node.cpp \ | |||
sharing_map.cpp \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @hannes-steffenhagen-diffblue said: these should likely go in the util
folder.
src/util/sharing_map.h
Outdated
@@ -450,7 +450,7 @@ SHARING_MAPT2(, size_type)::erase( | |||
return 0; | |||
|
|||
node_type *del=nullptr; | |||
unsigned del_bit; | |||
unsigned del_bit=0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure unsigned
should not be used here at all and any such use should be a std::size_t
instead.
src/util/sharing_map.h
Outdated
/// | ||
/// When inserting a key-value pair into the map, first the hash of its key is | ||
/// computed. The `bits` number of lower order bits of the hash are deemed | ||
/// significant, and are grouped into `bits` / `chunk` chunks). The hash is then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The )
does not have a matching opening parenthesis.
/// purposes of determining the position of the key-value pair in the trie. The | ||
/// actual key-value pairs are stored in the leaf nodes. Collisions (i.e., two | ||
/// different keys yield the same "string"), are handled by chaining the | ||
/// corresponding key-value pairs in a `std::list`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a std::forward_list
be sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is fixed in an upcoming PR.
src/util/sharing_map.h
Outdated
@@ -39,6 +39,66 @@ Author: Daniel Poetzl | |||
CV typename sharing_mapt<keyT, valueT, hashT, predT>::ST \ | |||
sharing_mapt<keyT, valueT, hashT, predT> | |||
|
|||
/// A map implemented as a tree where subtrees can be shared between different | |||
/// maps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you somewhere explain how to generate sharing (likely via copy and/or assignment operations)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll add an explanation for that.
Is is possible to add |
A few differences between the interfaces of
Since an iterator would need to contain a stack, it would cause unnecessary overhead to return an iterator on e.g. a call to
|
5f35d26
to
ca9906e
Compare
7728f95
to
e7b3ade
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@tautschnig Would you mind if we merge this PR? (it's documentation, plus unit test refactoring, and some smaller fixes). We can move potential further discussions to #2126 or another upcoming PR. |
Looking. |
No description provided.