NetInverse Developers Blog

May 2, 2009
Category: CLR — Tags: , , , , — admin @ 12:23 am

Precode

In .Net v2.x Precode is used to do the similar thing like Prepad.

Prepad

In .Net v1.x MethodDesc has a Prepad which contains code to call Prestub (before jitting) or jitted code.

typedef struct MethodDesc {
#ifdef _DEBUG

    LPCSTR         m_pszDebugMethodName;
    LPSTR          m_pszDebugClassName;
    LPSTR          m_pszDebugMethodSignature;
    PVOID          m_pDebugEEClass;
    PVOID          m_pDebugMethodTable;

#ifdef STRESS_HEAP
    PVOID          m_GcCover;
#else
    DWORD_PTR       m_DebugAlignPad;
#endif

    unsigned short  m_iPrestubCalls;
    unsigned short  m_iSharedSlots;
    unsigned short  m_iDirectCalls;

    unsigned short  m_DebugAlignPad2;
#endif

    DWORD_PTR      m_CodeOrIL;         // pointer to code
    WORD           m_wSlotNumber;      // entry in VTable
    WORD           m_wFlags;           // IL vs native, static vs instance ...
} MethodDesc;

When you use SOS command !dumpmd, if IsJitted is “yes,” you can run !U on the m_CodeOrIL pointer to see a disassembly of the JITTED code.

Prestub

In a CLR MethodTable, a method points to a Prestub or Jitted code. Prestub traps first calls on methods so it can JIT generate native code for them.

©2009 NetInverse. All rights reserved. Powered by WordPress