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

Seedarg/global/wip #26

Merged
merged 36 commits into from
Feb 26, 2019
Merged

Seedarg/global/wip #26

merged 36 commits into from
Feb 26, 2019

Conversation

jcantrell
Copy link

@jcantrell jcantrell commented Feb 26, 2019

Closes #9

nforbus
nforbus previously approved these changes Feb 26, 2019
Copy link

@nforbus nforbus left a comment

Choose a reason for hiding this comment

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

Tested, and it works. Order was;

git fetch
git checkout seedarg/global/wip
git pull (up to date)
cd build -> make
git clone https://github.com/clang-randstruct/testing.git
cd testing
clang poc.c
./reg
./rand

Randomization is working as expected.

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.

It compiles!

I tested the frandstruct -> randstruct changes and it compiled.

Copy link

@jeffreytakahashi jeffreytakahashi left a comment

Choose a reason for hiding this comment

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

I built this and tested it and it looks solid, working as intended.

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.

Looks good except frandstruct :)

@tim-pugh tim-pugh merged commit f5e549d into clang-randstruct:develop Feb 26, 2019
Copy link

@connorkuehl connorkuehl left a comment

Choose a reason for hiding this comment

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

There are a few places where we aren't using the data member random seed engine. We should only seed once (on object creation) and re-use that same engine each time.

@@ -95,7 +97,8 @@ const size_t CACHE_LINE = 64;

SmallVector<FieldDecl *, 64> Bucket::randomize() {
// FIXME use seed

Choose a reason for hiding this comment

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

Delete this comment.

@@ -95,7 +97,8 @@ const size_t CACHE_LINE = 64;

SmallVector<FieldDecl *, 64> Bucket::randomize() {
// FIXME use seed
auto rng = std::default_random_engine{};
std::seed_seq Seq(RandstructSeed.begin(), RandstructSeed.end());
auto rng = std::default_random_engine{Seq};

Choose a reason for hiding this comment

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

Delete this local seed engine and use the data member rng

auto rng = std::default_random_engine{};
SmallVector<Decl *, 64> Randstruct::randomize(SmallVector<Decl *, 64> fields) {
std::seed_seq Seq(RandstructSeed.begin(), RandstructSeed.end());
auto rng = std::default_random_engine{Seq};

Choose a reason for hiding this comment

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

Delete this local seed engine and use the data member rng

@@ -231,7 +237,8 @@ SmallVector<Decl *, 64> perfrandomize(const ASTContext &ctx,
buckets.push_back(std::move(currentBitfieldRun));
}

auto rng = std::default_random_engine{};
std::seed_seq Seq(RandstructSeed.begin(), RandstructSeed.end());
auto rng = std::default_random_engine{Seq};

Choose a reason for hiding this comment

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

Delete this seed engine and use the data member rng

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.

5 participants