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
JitCache cleanup #404
JitCache cleanup #404
Conversation
|
-1 from me. I care less about debug builds performance than code readability. It sounds like we'll have to end up rewriting an optimized bitfield class. Thanks MSVC for sucking so much once again. |
|
I pretty much fall in-line with what delroth stated. Code readability is much more important (in my opinion, of course) |
|
Okay; updated version with the bit-manipulation extracted into a class. |
| { | ||
| delete[] valid_block; | ||
| } | ||
| void set(u32 bit) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
I think I've addressed all the review comments. And yes, it's 2MB, but this needs to be fast; if we do anything complicated, it defeats the purpose of the optimization. We could probably reduce the granularity a bit: I mean, nothing would notice the difference if InvalidateICache invalidated, for example, 256 bytes rather than 32 bytes. On a side note, we actually shouldn't be masking off the top three bits, because JIT generated code depends on the full value of the program counter... but fixing that isn't a high priority. |
|
Okay, this time I've really addressed all review comments. |
|
Looks good to me. |
|
LGTM, please squash the commits that should be squashed together. |
Unfortunately, this appears to be necessary for the sake of performance; the standard library equivalents don't work well enough on Visual Studio 2013. vector<bool>::insert() is way too slow in debug builds to be usable, and std::bitset generates inefficient code in release builds.
|
What is some example of this bad codegen from std::bitset? |
|
Eh, so the bitset issue is only in debug as well? |
|
The visual implementation of the bit reference use internally the test and set methods that throw on invalid bounds. But the standard do not specify that the operator[] that returns that reference had to throw, that's a Microsoft bug. Technically not a bug, as operator[] on an invalid bounds is undefined behavior and throw is an valid outcome. But it is not coherent with operator[] of std::array and std::vector To shuffle : sadly, that's not the range checked iterator :( |
|
I see. The overhead that remains in release builds is because of callers to std::bitset::_Xran() in msvc's implementation. This is because |
|
It's fine how it is, although I'm slightly curious how codegen from supporting 64bit elements changes things (templatize underlying type by platform?). |
vector::insert() is way too slow in debug builds to be usable. Just write out the bit manipulation using raw pointers, since that's apparently the only way to get it right.
Get rid of ClearSafe() because the existing Clear() works just fine for the same purpose.