Thursday, April 28, 2005

Method Slot Table and MethodDesc

Embedded within the MethodTable is a table of slots that point to the respective method descriptors (MethodDesc), enabling the behavior of the type.

The Method Slot Table is created based on the linearized list of implementation methods laid out in the following order: Inherited virtuals, Introduced virtuals, Instance Methods, and Static Methods. The ClassLoader walks through the metadata of the current class, parent class, and interfaces, and creates the method table.

Method Descriptor (MethodDesc) is an encapsulation of method implementation as the CLR knows it. A MethodDesc is generated as a part of the class loading process and initially points to Intermediate Language (IL). Each MethodDesc is padded with a PreJitStub, which is responsible for triggering JIT compilation.

The method table slot entry actually points to the stub instead of the actual MethodDesc data structure. This is at a negative offset of 5 bytes from the actual MethodDesc and is part of the 8-byte padding every method inherits. The 5 bytes contain instructions for a call to the PreJitStub routine. Upon the first invocation, a call to the JIT compilation routine is made. After the compilation is complete, the 5 bytes containing the call instruction will be overwritten with an unconditional jump to the JIT-compiled x86 code.

CodeOrIL before JIT compilation contains the Relative Virtual Address (RVA) of the method implementation in IL. This field is flagged to indicate that it is IL. The CLR updates this field with the address of the JITed code after on-demand compilation.

Again all the notes above are taken from the article JIT and Run: Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects by Hanu Kommalapati and Tom Christian.

2 Comments:

At 5:11 PM, Blogger Unknown said...

Clouis vuitton outlet, ugg boots, ray ban sunglasses, oakley sunglasses, louis vuitton outlet, longchamp pas cher, prada outlet, polo ralph lauren outlet, nike outlet, chanel handbags, louboutin outlet, longchamp outlet, louis vuitton, nike air max, cheap oakley sunglasses, longchamp outlet, jordan shoes, louis vuitton, nike free, tiffany and co, tory burch outlet, prada handbags, replica watches, nike roshe run, longchamp, louboutin, air max, ralph lauren pas cher, christian louboutin outlet, replica watches, louis vuitton, nike air max, kate spade outlet, louboutin pas cher, nike free, oakley sunglasses, sac longchamp, oakley sunglasses, polo ralph lauren outlet, louboutin shoes, uggs on sale, ray ban sunglasses, ray ban sunglasses, burberry, gucci outlet, oakley sunglasses, tiffany jewelry, ugg boots, air jordan pas cher, michael kors

 
At 5:16 PM, Blogger Unknown said...

mont blanc, nike air max, babyliss, mcm handbags, louboutin, herve leger, ghd, hollister, celine handbags, lancel, new balance, nike trainers, valentino shoes, nfl jerseys, reebok shoes, soccer shoes, oakley, vans shoes, p90x workout, soccer jerseys, nike huarache, converse outlet, nike roshe, abercrombie and fitch, bottega veneta, north face outlet, beats by dre, birkin bag, instyler, gucci, mac cosmetics, chi flat iron, ferragamo shoes, insanity workout, ralph lauren, nike air max, jimmy choo shoes, longchamp, wedding dresses, asics running shoes, vans, hollister, timberland boots, iphone cases, baseball bats, hollister, giuseppe zanotti, north face outlet, ray ban, lululemon

 

Post a Comment

<< Home