Shared Source CLI 2.0 Internals

Shared Source CLI 2.0 Internals

Shared Source CLI 2.0 Internals Joel Pobar, Ted Neward with David Stutz and Geoff Shilling Table of Contents PREFACE ..................................................................................................................................................... 1 Who Should Read This Book ..................................................................................................................... 4 How This Book Is Structured ..................................................................................................................... 4 Online CLI Resources ................................................................................................................................ 6 Acknowledgments ...................................................................................................................................... 6 1 INTRODUCING THE CLI COMPONENT MODEL ......................................................................... 9 The CLI Virtual Execution Environment ..................................................................................................10 A CLI Implementation in Shared Source: Rotor .......................................................................................17 2 GETTING STARTED WITH ROTOR ................................................................................................25 A Simple Component Assembly ...............................................................................................................25 Observing Managed Execution .................................................................................................................36 Looking Ahead ..........................................................................................................................................39 3 USING TYPES TO DESCRIBE COMPONENTS ..............................................................................40 Types and Type Systems ...........................................................................................................................40 More on Value Types ................................................................................................................................53 More on Reference Types..........................................................................................................................58 Type Interoperability .................................................................................................................................65 Using Types in Data-Driven Code ............................................................................................................67 4 EXTRACTING TYPES FROM ASSEMBLIES ..................................................................................71 Type Packaging .........................................................................................................................................71 Application Domains .................................................................................................................................88 Bootstrapping the Assembly Load Process ...............................................................................................90 Securing Against Harmful Assemblies ......................................................................................................94 5 SYNTHESIZING COMPONENTS ......................................................................................................96 The Anatomy of a Component ..................................................................................................................96 Verifying and Compiling CIL .................................................................................................................120 Calling Conventions in Managed Code ...................................................................................................128 Table of Contents 6 GENERICS ...........................................................................................................................................137 Design Approach .....................................................................................................................................138 Implementation ........................................................................................................................................141 Breadth of Changes .................................................................................................................................152 7 RUNTIME TYPE DEFINITION AND EXPLORATION ................................................................157 Reflection API .........................................................................................................................................157 Emitting Components Dynamically ........................................................................................................181 Lightweight Code Generation .................................................................................................................184 8 REGULATING THE EXECUTION ENGINE ..................................................................................192 Threads ....................................................................................................................................................192 Traversing the Execution Engine Stack ...................................................................................................195 Threading and Concurrency ....................................................................................................................203 Synchronizing Concurrent Access to Components .................................................................................219 Handling Component Exceptions ............................................................................................................220 9 MANAGING MEMORY WITHIN THE EXECUTION ENGINE .................................................233 Memory and Resource Management .......................................................................................................234 Organizing and Allocating Dynamic Memory ........................................................................................236 Reclaiming Memory ................................................................................................................................243 Structuring Metadata for Collection ........................................................................................................249 Scheduling Collection .............................................................................................................................251 Finalization ..............................................................................................................................................253 10 INTERLUDE: ENABLING COMPONENT INTEGRATION WITH METADATA ..................257 Altering Metadata Representation ...........................................................................................................257 Transforming Metadata in the CLI ..........................................................................................................258 Metadata in Action ..................................................................................................................................259 APPENDIX A: THE PLATFORM ADAPTATION LAYER...............................................................260 PAL Overview .........................................................................................................................................260 Common Infrastructure ...........................................................................................................................262 Processes and Threads .............................................................................................................................267 Synchronizing Processes and Threads .....................................................................................................273 Implementing Signaling ..........................................................................................................................279 Suspending and Resuming PAL Threads ................................................................................................285 Asynchronous Procedure Calls ................................................................................................................287 Handling Exceptions in the PAL .............................................................................................................287 Managing Memory with the PAL ............................................................................................................295 Exploring the Rest of the PAL ................................................................................................................298 Joining Components to the OS ................................................................................................................301 APPENDIX B: ADD A NEW CIL OPCODE ........................................................................................302 Adding Exponentiation to Rotor ..............................................................................................................302 Table of Contents Shared Source CLI 2.0 Internals Joel Pobar, Ted Neward with David Stutz and Geoff Shilling Preface Version 1.0 of the Microsoft Shared

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    324 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us