-
Notifications
You must be signed in to change notification settings - Fork 28
detect when rearrangement changes the size class #22
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
Comments
@odeke-em do you refer to the size class that runtime use to allocate memory for struct? https://golang.org/src/runtime/mksizeclasses.go |
That's right! Please see also see golang/go#42412 (comment) |
Look cool! So when size class changed, what should we report? Or we will report the actual size class instead of the struct size? |
We should report all of them. Basically: <LINENO_POS>: struct has size 112 (size class <CLASS_SIZE>), rearrange to <REARRANGEMENT> for optimal size |
Also we should make sure that the optimal size suggested is an actual size class. |
For brevity here are the size classes from the Go runtime https://github.com/golang/go/blob/ecc3f5112ebaf23c4b1ac4c5eedfa406d82ecc9a/src/runtime/sizeclasses.go#L6-L73 |
The runtime use diferrent size class to allocate memory. So a struct with size 32 and size 24 are atually consume the same amount of memory, size class 32. So they're not sloppy. Instead, we only report if the rearrangement makes actual change in runtime size class. Fixes #22
The runtime use diferrent size class to allocate memory. So a struct with size 32 and size 24 are atually consume the same amount of memory, size class 32. So they're not sloppy. Instead, we only report if the rearrangement makes actual change in runtime size class. Fixes #22
The runtime use diferrent size class to allocate memory. So a struct with size 32 and size 24 are atually consume the same amount of memory, size class 32. So they're not sloppy. Instead, we only report if the rearrangement makes actual change in runtime size class. Fixes #22
The runtime use diferrent size class to allocate memory. So a struct with size 32 and size 24 are atually consume the same amount of memory, size class 32. So they're not sloppy. Instead, we only report if the rearrangement makes actual change in runtime size class. Fixes #22
Since when we use "go:linkname", we should always run CI with tip to see if it's broken or not. Updates #22
Since when we use "go:linkname", we should always run CI with tip to see if it's broken or not. Updates #22
Coming here from a suggestion from Josh Bleecher Snyder, we should detect when the rearrangement changes the size class of the struct.
The text was updated successfully, but these errors were encountered: