-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Preallocate jump stubs for dynamic methods #9883
Conversation
kouvel
commented
Mar 1, 2017
•
edited
Loading
edited
- This eliminates the possibility of running into an out-of-memory situation after compiling the method
- The temporary entry points block containing FixupPrecodes is extended for dynamic methods to include sufficient space for jump stubs
- When the target is too far for the FixupPrecode to encode a short relative jump, it instead does a short relative call or jump to the corresponding jump stub, which does an absolute jump to the target
- This eliminates the possibility of running into an out-of-memory situation after compiling the method - The temporary entry points block containing FixupPrecodes is extended for dynamic methods to include sufficient space for jump stubs - When the target is too far for the FixupPrecode to encode a short jump, it instead does a short call or jump to the corresponding jump stub, which does a far jump to the target
src/vm/amd64/cgenamd64.cpp
Outdated
{ | ||
CONTRACTL | ||
{ | ||
THROWS; // emptBackToBackJump may throw (see emitJump) |
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.
emptBackToBackJump [](start = 19, length = 18)
nit: typo: emptBackToBackJump
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.
Fixed
LGTM |
Did you compute/measure the additional size impact of this? Does NGEN store FixupPrecode? What is the size increase, say, of System.Private.CoreLib.ni.dll? Does nidump still work? Did you test on ngen'ed images? |
Since the change only applies to dynamically created methods, my understanding is that it should have no impact on ngen/crossgen. I'll check what you suggested. |
Regarding runtime memory impact, since we were allocating an additional 8 bytes per FixupPrecode, which wasn't being used, after this change the additional impact is 4 bytes per FixupPrecode for a dynamic method (12 bytes per jump stub). |
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.
Looks great!
Looks like it, but it shouldn't be saving any FixupPrecodes for dynamic methods
No change
It should, but while I found the code for it I didn't find info on how to initiate a dump. Could you please point me to some info on this?
No, I can maybe diff the nidump before and after and see if there is anything to test |
Given that ngen images shouldn't include FixupPrecode, I wouldn't worry about it. I normally use "nidump /?" or similar to remind myself of the commands. Maybe it's not built in the open? I haven't looked. |
Fragile ngen images do include FixupPrecode - a lot of them. However, this change have not changed anything near NGen or nidump. |
Preallocate jump stubs for dynamic methods - This eliminates the possibility of running into an out-of-memory situation after compiling the method - The temporary entry points block containing FixupPrecodes is extended for dynamic methods to include sufficient space for jump stubs - When the target is too far for the FixupPrecode to encode a short relative jump, it instead does a short relative call or jump to the corresponding jump stub, which does an absolute jump to the target
Preallocate jump stubs for dynamic methods - This eliminates the possibility of running into an out-of-memory situation after compiling the method - The temporary entry points block containing FixupPrecodes is extended for dynamic methods to include sufficient space for jump stubs - When the target is too far for the FixupPrecode to encode a short relative jump, it instead does a short relative call or jump to the corresponding jump stub, which does an absolute jump to the target Commit migrated from dotnet/coreclr@4bafc10