1 / 26

“Whidbey” CLR Internals

Session Code: ARC413. “Whidbey” CLR Internals. Jonathan Keljo jkeljo@microsoft.com Program Manager Microsoft Corporation. Tools. Client Application Model. Web & Service Application Model. Data Systems Application Model. Mobile PC & Devices Application Model. Command Line.

bryony
Download Presentation

“Whidbey” CLR Internals

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Session Code:ARC413 “Whidbey” CLR Internals Jonathan Keljo jkeljo@microsoft.com Program Manager Microsoft Corporation

  2. Tools Client Application Model Web & Service Application Model Data Systems Application Model Mobile PC & Devices Application Model Command Line Compact Framework System.Console Win FS Yukon Mobile PC Optimized Avalon Windows Forms ASP.NET / Indigo NTService System.Data.SqlServer System.Windows.Forms System.Windows System.Storage System.Web System.Windows System.Windows.Forms System.ServiceProcess Communication Data Presentation System.Collaboration System.Search System.Discovery System.Data System.Windows System.Messaging SqlClient DataSet RealTimeEndpoint UI Element Explorer Media Annotations System.DirectoryServices ActiveDirectory TransientDataSession SqlTypes Mapping Documents Controls Animation System.Remoting Monitoring SignalingSession SqlXML ObjectSpaces Text Element Dialogs Controls System.Runtime.Remoting Logging Uddi Media OdbcClient ObjectSpace Shapes SideBar Control Relevance Activities OleDbClient Query Shape Notification Panel Navigation OracleClient Schema Ink Design System.Web.Services System.MessageBus Transport Queue Web.Service System.Storage Port PubSub System.Windows.Forms System.Web.UI Description Item Core Channel Router Forms Page WebControls Discovery Relationship Contact Service Policy Control Control Adaptors Protocols Media Location Peer Group Print Dialog HtmlControls Design Audio Message Design MobileControls Video Document System.Net System.Web Images Event HttpWebRequest NetworkInformation System.Help System.Speech Personalization System.Xml FtpWebListener Sockets System.Drawing Recognition Synthesis Caching Schema Xpath SslClientStream Cache SessionState System.NaturalLanguageServices Serialization Query WebClient Fundamentals Security Base & Application Services Configuration Deployment/Management System.Windows.TrustManagement System.Timers System.Text System.Web.Configuration System.Collections System.Web System.Security System.Globalization System.Design Generic System.MessageBus.Configuration Administration Permissions Authorization System.Web.Security System.Serialization System.IO System.Configuration Management System.ComponentModel Policy AccessControl System.Threading Ports System.Resources System.CodeDom Principal System.Management Credentials System.MessageBus.Security System.Runtime System.Reflection Token Cryptography System.Deployment Serialization InteropServices System.EnterpriseServices System.Diagnostics CompilerServices System.Transactions

  3. 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

  4. template <class T> class Stack { … T Pop() … } Stack <int> Stack <double> Template stack class C++ Compiler Stack <point> Stack<int> … … Stack <double> … … Stack <point> … … … Main program Main program source Executable (x86) C++ Templates

  5. class Stack<T> { … T Pop() … } Stack <T> Template stack class .NET Compiler Main program Stack<int> … … Stack <double> … … Stack <point> … … Executable (IL) Main program source CLR Generics

  6. Generics in IL & Metadata

  7. IL Execution topOfStack topOfStack this._array[topOfStack] this this._array this._array this._array[topOfStack] this._array[topOfStack] this Evaluation Stack

  8. Generics in Metadata

  9. Method (0x6) … Name Signature … Push 20 01 01 13 00 .ctor 20 01 01 08 Pop 20 00 13 00 Push 20 01 01 13 00 … Generic Signatures Param 1 Type is Generic Type Parameter Instance Method (has “this”/”Me”) With 1 Parameter Void Return void Push(T toPush); 01 13 00 20 01 Param 1 is of type T “Calling Convention” # Parameters Return Type Element Type Parameter Types Type Param Index

  10. Generics: Code Generation

  11. Generics – Code Generation

  12. 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

  13. EnC: Editing a Method

  14. EnC – Editing a Method (1)Delta IL & Delta Metadata Delta Metadata (Provided by debugger) Full Metadata (In Running Process) 2050 20a8 0 4 Delta IL 8940 8944

  15. EnC – Editing a Method (2)Remap IL Virtual Execution System x86 Processor Original IL Variables Original x86 .locals init (int32, int32) . . . call Console.ReadLine pop nop ret . . . call FFFFD630 pop ebx pop esi pop edi . . . New IL New x86 .locals init (int32, int32, double) . . . call Console.ReadLine pop . . . call Console.ReadLine pop nop ret . . . call FFFFD630 fild dword … fstp dword … mov ecx, edi . . . call FFFFD630 pop ebx pop esi pop edi

  16. EnC – Editing Within a Call IL Virtual Execution System x86 Processor Original IL Variables Original x86 .locals init (int32, int32) . . . call Console.ReadLine pop nop ret . . . call FFFFD630 pop ebx pop esi pop edi . . . New IL New x86 .locals init (int32, int32, double) . . . call Console.ReadLine pop . . . call Console.ReadLine pop nop ret . . . call FFFFD630 fild dword … fstp dword … mov ecx, edi . . . call FFFFD630 pop ebx pop esi pop edi

  17. EnC: Editing a Class

  18. EnC – Editing a Class (1)Delta Metadata Delta Metadata (Provided by debugger) Full Metadata (In Running Process)

  19. EnC – Editing a Class (2)Extending Existing Instances

  20. Keeping Things SaneRuntime 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

  21. Shameless Plug • Language Implementers’ Lunch • Thursday 11:30-1:30 • Programming Languages & Tools Track Lounge

  22. Community ResourcesGet 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: • http://pdcbloggers.net

  23. Resources • Books • The Common Language Infrastructure Annotated Standard. ISBN 0-3211-5493-2 • Inside Microsoft .NET IL Assembler. ISBN 0-7356-1547-0 • Essential .NET Volume 1. ISBN 0-201-73411-7 • Shared Source CLI Essentials. ISBN 0-596-00351-X

  24. Questions?

  25. © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

More Related