-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add workaround for KeySpliterator shuffling #198
base: master
Are you sure you want to change the base?
Add workaround for KeySpliterator shuffling #198
Conversation
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've added trivial comments while making a sanity pass.
@kaiyaok2 can you please review this PR in more detail?
return classWriter.toByteArray(); | ||
} | ||
} | ||
|
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.
Extra empty line at the end?
public void forEachRemaining(Consumer<? super K> action) { | ||
iter.forEachRemaining(action); | ||
} | ||
} |
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.
Missing end-of-line at the end?
updated for resolving |
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.
Thanks for adding tryAdvance
. I've added some minor comments. I hope Kaiyao can review more, but you should also collect some experimental results while we review.
@@ -72,6 +73,7 @@ public final class Instrumenter { | |||
public static final String hashMapNodeName = "java/util/HashMap$Node.class"; | |||
public static final String hashMapEntryName = "java/util/HashMap$Entry.class"; | |||
public static final String hashMapHashIteratorShufflerName = "java/util/HashMap$HashIterator$HashIteratorShuffler.class"; | |||
public static final String hashMapKeySpliShufflerName = "java/util/HashMap$KeySpliterator$KeySpliteratorShuffler.class"; |
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.
Expand Spli
to full name.
@@ -203,6 +206,13 @@ public byte[] apply() { | |||
} | |||
}); | |||
} | |||
// add SpliteratorShuffler.class |
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.
Should this be done only in some cases, like the if-then-else
above?
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 can confirm for this key
case, we do not have to do this.
We probably will need this for the EntrySpliterator
, but I can look into this to confirm further (for EntrySpliterator
).
@@ -1559,6 +1567,10 @@ public void forEachRemaining(Consumer<? super K> action) { | |||
} | |||
|
|||
public boolean tryAdvance(Consumer<? super K> action) { | |||
return shuffler.tryAdvance(action); |
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.
Good finding that you need to change this method as well.
Added support for instrumenting both e.g.
tryAdvance:
|
@darko-marinov Thanks for the review. I’ve finished running real projects at scale from Kaiyao’s repo and manually reviewed some of the newly identified tests, and I discovered this issue. I may need to rerun the experiments with this updated version. |
Please rerun with the updated version as it'll help (1) automatically remove false alarms due to |
Access to more VMs would be really helpful! Thanks! |
KeySpliterator
ofHashMap
.Remaining Work
KeySpliterator
ValueSpliterator
EntrySpliterator