Skip to content
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 (port) performance sensitive randomization #17

Merged
merged 1 commit into from
Feb 15, 2019

Conversation

connorkuehl
Copy link

This is a port of our Clang plugin code for the reorganization of fields.

Closes #10

Please review this so that we can ultimately diminish how hacky it feels.

Co-authored-by: James Foster <jafosterja@gmail.com>
@connorkuehl connorkuehl changed the title Add performance sensitive randomization Add (port) performance sensitive randomization Feb 13, 2019
@connorkuehl connorkuehl mentioned this pull request Feb 13, 2019
Copy link
Member

@tim-pugh tim-pugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pull in branch and give it a run. Besides that the code is easy to read and understand. Great job @connorkuehl @Jafosterja .

clang/lib/AST/RecordLayoutBuilder.cpp Show resolved Hide resolved
clang/lib/AST/LayoutFieldRandomizer.cpp Show resolved Hide resolved
jcantrell
jcantrell approved these changes Feb 14, 2019
Copy link

@jcantrell jcantrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a vestigial randomize()

return true;
}

SmallVector<Decl *, 64> randomize(SmallVector<Decl *, 64> fields) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need randomize() as well as Bucket::randomize() ? randomize() looks unused

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the requirements document specifies having a basic randomize (this one) and a cache line sensitive one (perfrandomize).

If we keep both, I'd imagine we will need to introduce a switch or something so that users can specify which one they want. In that case, this code will not be unused.

If we opt to only have the performance-sensitive randomization, then we will delete this routine, yes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own curiosity, this is just a stylistic question, why not pass Bucket.fields to randomize(), instead of duplicating randomize() inside the Bucket class? Is that just in case we need to tweak Bucket.randomize() in the future?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that just in case we need to tweak Bucket.randomize() in the future?

Yeah, but there's a big chance we won't have to. What you described is probably better at the moment.


bool BitfieldRun::isBitfieldRun() const {
// Yes.
return true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the commenting that we want? While literal and correct, it's not helpful.

Copy link
Member

@tim-pugh tim-pugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebuilt after visual inspection. Ran scan build, and it returned no errors. Ran clang-format and it looked good too.

@tim-pugh tim-pugh merged commit 4ba74e9 into develop Feb 15, 2019
@connorkuehl connorkuehl deleted the port-randomization branch February 20, 2019 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants