-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use smaller data type to represent the counter fields of FunctionBody. #301
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
Conversation
lib/Runtime/Base/FunctionBody.h
Outdated
|
|
||
| // Signed integers need keep the sign when promoting | ||
| SignedFieldsStart = 26, | ||
| SerializationIndex = 26, |
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.
These two are both 26
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.
SignedFieldsStart is a marker that from that point, it saves signed value. maybe I can remove this, instead, use a byte in the structure to save the position -- there're 3 bytes at the beginning is not used.
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.
Oh gotcha, I missed that SignedFieldsStart was a label marking the beginning of special fields.
|
With this and your previous change how much does this shrink FunctionBody down on x64? |
|
Ignoring the separately added data for the pointers and counters. I'm curious about sizeof(FunctionBody) for curiosity's sake. |
|
@ianwjhalliday it reduced from 648 to 384 bytes |
bcb3406 to
3a15ec4
Compare
|
@dotnet-bot test this please |
92ce4fc to
b19ae63
Compare
|
Nice, that is a significant reduction. |
49f445a to
dbffdf4
Compare
dbffdf4 to
106054a
Compare
|
@dotnet-bot test EOL Check please |
| memset(this->m_inlineCaches[i], 0, sizeof(InlineCache)); | ||
| } | ||
| else if(!scriptContext->IsClosed()) | ||
| else if(scriptContext != nullptr && !scriptContext->IsClosed()) |
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.
In what situation can the scriptContext be nullptr?
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.
ah, this is not intentional change. previously in order to solve the issue the when FunctionBody::Cleanup sometimes the scriptContext is already gone, I set this to null. So this is not needed any more because when cleaning up we should not be expanding the structure so should not need the recycler from scriptContext anymore.
let me remove the change. thanks.
106054a to
42257a7
Compare
|
@curtisman as discussed, moved following mutable fields out of the structure. and added Assert in case there's any other fields missed. |
|
LGTM |
remove volatile since we made sure there's not sync issue any more
… FunctionBody. Merge pull request #301 from leirocks:fb_counters_pr Use smaller data type to represent the counter fields of FunctionBody. Most of the counters has value less than 256, use single byte to hold them. And can promote to short or full 32 bit integer when necessary.
Use smaller data type to represent the counter fields of FunctionBody.
Most of the counters has value less than 256, use single byte to hold them. And can promote to short or full 32 bit integer when necessary.