runtime icon indicating copy to clipboard operation
runtime copied to clipboard

What information can be candidates for pitching (dropping)?

Open sergign60 opened this issue 8 years ago • 6 comments

We're trying to use Code Pitching feature (dropping unused jitted code) (https://github.com/dotnet/coreclr/pull/10496) for mobile devices. I've found also that EHInfo and GCInfo could be pitched also at the same time. Could you give us some hints, what information (meta) for method could be pitched with code? Thanks in advance CC:@noahfalk @jkotas @janvorli @Dmitri-Botcharnikov @alpencolt

sergign60 avatar Feb 14 '18 16:02 sergign60

I'd expect with some work you should be able to get rid of everything you find in the CodeHeader: the jitted code, EHInfo, GCInfo, and DebugInfo.

LCG doesn't currently delete EHInfo, GCInfo, or DebugInfo and the comments in the code don't give any rationale why not. Its possible this was just an optimization the original authors didn't get time to implement or maybe there are thornier technical problems lurking. Conceptually EHInfo would only be used when handling an exception in a method, GCInfo would be used when the method is on the stack during a GC and DebugInfo is used by a debugger to inspect the method + when the in process System.Diagnostics.StackTrace class sees the method on the stack. Proving the method is not on the stack would theoretically eliminate everything but the debugger. In practice the line might be blurrier and it would require code review to identify how references to those datastructures may have been propagated and used.

noahfalk avatar Feb 15 '18 23:02 noahfalk

LCG doesn't currently delete EHInfo, GCInfo

LCG does delete EHInfo and GCInfo.

jkotas avatar Feb 16 '18 09:02 jkotas

Sorry, I misspoke. I should have said LCG doesn't delete those things at the same time it deletes the code, and the comments don't say why the delete is being delayed, only that it is:

https://github.com/dotnet/coreclr/blob/master/src/vm/codeman.cpp#L3169

    FreeCodeMemory(pHeap, codeStart);

    // We are leaking GCInfo and EHInfo. They will be freed once the dynamic method is destroyed.

    return;

noahfalk avatar Feb 16 '18 09:02 noahfalk

@noahfalk @jkotas Thanks! Just FYI: result for the Tizen "What" application: jitted 286362 (bytes) pitched 157832 (bytes)

sergign60 avatar Feb 16 '18 09:02 sergign60

@sergign60 Can this issue be closed, or is there more info you're looking for?

RussKeldorph avatar Mar 19 '18 13:03 RussKeldorph

Re-open or create new issue if this isn't sufficiently answered.

RussKeldorph avatar Mar 20 '18 14:03 RussKeldorph