Download presentation
Presentation is loading. Please wait.
1
“Whidbey” CLR Internals
11/12/ :39 PM Session Code: ARC413 “Whidbey” CLR Internals Jonathan Keljo Program Manager Microsoft Corporation © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
2
11/12/ :39 PM Tools Client Application Model Web & Service Application Model Data Systems Application Model Mobile PC & Devices Application Model Command Line Compact Framework Avalon Windows Forms ASP.NET / Indigo Win FS Yukon System.Console Mobile PC Optimized System.Web System.Storage System.Data.SqlServer System.Windows.Forms System.Windows NT Service System.Windows System.Windows.Forms System.ServiceProcess Presentation Data Communication System.Windows System.Search System.Data System.Messaging System. Discovery System.Collaboration UI Element Explorer Media Annotations SqlClient DataSet System.DirectoryServices RealTimeEndpoint Documents Controls Animation SqlTypes Mapping Active Directory TransientDataSession Monitoring System.Remoting Text Element Dialogs Controls SqlXML ObjectSpaces SignalingSession Logging System.Runtime.Remoting Uddi Shapes SideBar Control OdbcClient ObjectSpace Media Shape Notification Panel Relevance OleDbClient Query Activities Ink Navigation Design OracleClient Schema System.Web.Services System.MessageBus Web.Service Transport Queue System.Storage System.Windows.Forms System.Web.UI Port PubSub Item Core Description Forms Page WebControls Discovery Channel Router Relationship Contact Control Control Adaptors Service Policy Media Location Protocols Print Dialog HtmlControls Design Peer Group Audio Message Design MobileControls Video Document System.Net Images Event System.Web System.Help System.Speech HttpWebRequest NetworkInformation System.Xml Personalization FtpWebListener Sockets System.Drawing Recognition Synthesis Caching Schema Xpath SslClientStream Cache System.NaturalLanguageServices Serialization Query SessionState WebClient Fundamentals Base & Application Services Security Configuration Deployment/Management System.Timers System.Text System.Collections System.Windows. TrustManagement System.Web.Configuration System.Globalization System.Design System.Security System.Web Generic System.MessageBus.Configuration Administration System.Serialization System.IO System.Web. Security Authorization Permissions System.ComponentModel System.Configuration Management System.Threading Ports AccessControl Policy System.CodeDom System.Resources System.Message Bus.Security Credentials Principal System.Management System.Runtime System.Reflection Cryptography Token System.Deployment Serialization InteropServices System.EnterpriseServices System.Diagnostics CompilerServices System.Transactions © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
3
Frameworks (BCL, WinFX, etc.)
11/12/ :39 PM The Big Picture IDE Debugger Editor Compiler Source Files Frameworks (BCL, WinFX, etc.) EXE (IL) CLR JIT Loader GC Metadata Exceptions Interop Threading Remoting Security Debugging © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
4
C++ Templates … Stack <int> <double> <point> Main
11/12/ :39 PM C++ Templates template <class T> class Stack { … T Pop() … } Template stack class Stack <int> <double> <point> … Main program Executable (x86) C++ Compiler Stack<int> … … Stack <double> … Stack <point> … Main program source © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
5
CLR Generics Stack <T> Main program class Stack<T> { …
11/12/ :39 PM CLR Generics class Stack<T> { … T Pop() … } Template stack class .NET Compiler Stack <T> Main program Executable (IL) Stack<int> … … Stack <double> … Stack <point> … Main program source © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
6
Generics in IL & Metadata
11/12/ :39 PM Generics in IL & Metadata © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
7
IL Execution IL (Source line “T retval = _array[topOfStack]”) ldarg.0
11/12/ :39 PM IL Execution IL (Source line “T retval = _array[topOfStack]”) ldarg.0 ldfld !0[] class GenericsDemo.GenericStack<!0>::_array ldloc.0 ldelem !0 stloc.1 Arguments [0] this Locals [0] topOfStack [1] null topOfStack topOfStack this._array[topOfStack] this._array[topOfStack] this._array[topOfStack] this._array this._array this this Evaluation Stack © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
8
GenericParamConstraint (0x2c)
11/12/ :39 PM Generics in Metadata TypeDef (0x2) … Name Field List Method GenericStack Method (0x6) … Name Signature Param List .ctor Pop Push Param (0x8) … Name initialSize toPush GenericParam (0x2a) Number … Owner Name T Field (0x4) … Name Signature _array 06 1d 13 00 _depth 06 08 GenericParamConstraint (0x2c) Owner Constraint System.Object … © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
9
Param 1 Type is Generic Type Parameter
11/12/ :39 PM Generic Signatures … Push Pop .ctor Signature Name Method (0x6) Param (0x8) … Name initialSize toPush Push Param 1 Type is Generic Type Parameter Instance Method (has “this”/”Me”) With 1 Parameter Void Return void Push(T toPush); 20 01 01 13 Param 1 is of type T 00 “Calling Convention” # Parameters Return Type Element Type Parameter Types Type Param Index © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
10
Generics: Code Generation
11/12/ :39 PM Generics: Code Generation © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
11
Generics – Code Generation
11/12/ :39 PM Generics – Code Generation MethodTable _array _depth 2 … Stack <int> MethodTable x86 .ctor <int> 4 2 … x86 Pop <int> … Stack<object> MethodTable x86 Push <int> MethodTable _array _depth 5 … x86 .ctor <object> MethodTable _array _depth 7 x86 Pop <object> … Stack<Form> MethodTable … x86 Push <object> © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
12
Frameworks (BCL, WinFX, etc.)
11/12/ :39 PM The Big Picture IDE Debugger Editor Compiler Source Files Frameworks (BCL, WinFX, etc.) EXE (IL) CLR JIT Loader GC Metadata Exceptions Interop Threading Remoting Security Debugging © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
13
EnC: Editing a Method 11/12/2018 12:39 PM
© Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
14
EnC – Editing a Method (1) Delta IL & Delta Metadata
11/12/ :39 PM EnC – Editing a Method (1) Delta IL & Delta Metadata Delta Metadata (Provided by debugger) Full Metadata (In Running Process) Method (0x6) RVA … Name 4 PrintStatistics Method (0x6) RVA … Name 2050 Main 20a8 PrintStatistics INV EnCLog (0x1e) Token FuncCode … EnCMap (0x1f) Token … 2050 Complete Original IL . Other Data 20a8 Delta Header IL Header for PrintStatistics nop ldc.i4.0 stloc.1 . 4 Delta IL 8940 8944 Delta IL © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
15
EnC – Editing a Method (2) Remap
11/12/ :39 PM EnC – Editing a Method (2) Remap IL Virtual Execution System x86 Processor Original IL Variables Original x86 Stack … i sum Registers … numbers .locals init (int32, int32) . call Console.ReadLine pop nop ret numbers i sum . call FFFFD630 pop ebx pop esi pop edi avg avg New IL New x86 .locals init (int32, int32, double) . call Console.ReadLine pop nop ret . call FFFFD630 fild dword … fstp dword … mov ecx, edi pop ebx pop esi pop edi © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
16
EnC – Editing Within a Call
11/12/ :39 PM EnC – Editing Within a Call IL Virtual Execution System x86 Processor Original IL Variables Original x86 Stack … i sum Registers … numbers .locals init (int32, int32) . call Console.ReadLine pop nop ret numbers i sum . call FFFFD630 pop ebx pop esi pop edi vars for ReadLine . avg avg New IL New x86 .locals init (int32, int32, double) . call Console.ReadLine pop nop ret . call FFFFD630 fild dword … fstp dword … mov ecx, edi pop ebx pop esi pop edi © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
17
EnC: Editing a Class 11/12/2018 12:39 PM
© Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
18
EnC – Editing a Class (1) Delta Metadata
11/12/ :39 PM EnC – Editing a Class (1) Delta Metadata Delta Metadata (Provided by debugger) Full Metadata (In Running Process) Field (0x4) … Name Signature _avg 06 0d _max 06 08 TypeDef (0x2) … Name Field List StatBuilder EnCLog (0x1e) Token Func Code 2 … EnCMap (0x1f) Token … FieldPtr (0X3) Token … Field (0x4) … Name Signature _numbers _sum 06 08 _avg 06 0d _max 06 08 © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
19
EnC – Editing a Class (2) Extending Existing Instances
11/12/ :39 PM EnC – Editing a Class (2) Extending Existing Instances SyncBlock MethodTable _numbers _sum 500 SyncBlock MethodTable _numbers _sum 33 … SyncBlock MethodTable _numbers _sum 101 _max 8 _avg 5.5 © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
20
Keeping Things Sane Runtime Power vs. Language Legality
11/12/ :39 PM Keeping Things Sane Runtime Power vs. Language Legality Can do all kinds of crazy things with CLR’s support Left to the languages to decide what edits make sense Lots of potential work here EnC-friendly codegen Exception handling Managing cascading effects of edits © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
21
Shameless Plug Language Implementers’ Lunch Thursday 11:30-1:30
11/12/ :39 PM Shameless Plug Language Implementers’ Lunch Thursday 11:30-1:30 Programming Languages & Tools Track Lounge © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
22
Community Resources Get Your Questions Answered!
11/12/ :39 PM Community Resources Get Your Questions Answered! Newsgroups: microsoft.private.whidbey.clr Architecture & Infrastructure Lounge: 309 Foyer connect with Microsoft infrastructure product teams, and PDC 2003 Speakers PDC Weblogs: © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
23
11/12/ :39 PM Resources Books The Common Language Infrastructure Annotated Standard. ISBN Inside Microsoft .NET IL Assembler. ISBN Essential .NET Volume 1. ISBN Shared Source CLI Essentials. ISBN X © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
24
11/12/ :39 PM Questions? © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
25
© 2003-2004 Microsoft Corporation. All rights reserved.
11/12/ :39 PM © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
26
11/12/ :39 PM © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.