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

Fix Issue 6580 - scoped classes are aligned incorrectly #570

Merged
merged 1 commit into from May 9, 2012

Conversation

denis-sh
Copy link
Contributor

@denis-sh denis-sh commented May 4, 2012

Not sure if forAlignmentOnly will work on every compiler but can't invent anything better.

@@ -3087,9 +3087,27 @@ unittest
return result;
}

private template maxAlignmentType(U...) if(isTypeTuple!U) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Place braces on their own lines.

@9rnsr
Copy link
Contributor

9rnsr commented May 7, 2012

Auto tester shows an error in Windows platform.
http://d.puremagic.com/test-results/pull.ghtml?runid=152118

@denis-sh
Copy link
Contributor Author

denis-sh commented May 7, 2012

  • Place braces on their own lines.

  • Please add original test case that is in bugzilla.

  • Please add issue number as a comment.

Changed.

Auto tester shows an error in Windows platform.
http://d.puremagic.com/test-results/pull.ghtml?runid=152118

So I have missed something. Interesting...

@denis-sh
Copy link
Contributor Author

denis-sh commented May 7, 2012

Damn! It passes now, it's very bad... I'll play with autotester a bit because I can't reproduce the failure on my Win32 PC.

@denis-sh
Copy link
Contributor Author

denis-sh commented May 7, 2012

OK. 38e55e021f65b02ed431fef2e029152fc8a56061 fails at line 3174 (test results).
This is dmd heisenbug aka Issue 2278.

So here is the question: should scoped be aligned as buggy as structs with hope Issue 2278 will be fixed? Personally I think it should be more clever and align its content properly with the cost of alignsize bytes.

And what to do with structs? Should Phobos has aligned template for SIMD instructions? Or is there already some support in recently added SIMD intrinsics?

@denis-sh
Copy link
Contributor Author

denis-sh commented May 7, 2012

Done. scoped is smarter now. Moving Scoped!T instance to a location with other misalignment will now result in trying to read/write invalid (because of shift) data.

}
alias Scoped_payload this;
alias m_payload this;
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't remove Scoped_ prefixes. They need to avoid conflicts with T's members.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Sorry.
Looks like for current dmd even private store has to be Scoped_store...

@9rnsr
Copy link
Contributor

9rnsr commented May 9, 2012

OK. In general, class objects are allocated in gc heap and aligned correctly.
So adjusting alignments in scoped is enough valuable and useful.

9rnsr added a commit that referenced this pull request May 9, 2012
Fix Issue 6580 - scoped classes are aligned incorrectly
@9rnsr 9rnsr merged commit 84218d3 into dlang:master May 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants