This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Relationship to Managed Metadata-driven Execution
Metadata describes code by describing the types that the code defines and the types that it references externally. The compiler produces the metadata when the code is produced. Enough information is stored in the metadata to:
- Manage code execution – not just load and execute, but also memory management and execution state inspection.
- Administer the code – Installation, resolution, and other services
- Reference types in the code – Importing into other languages and tools as well as scripting and automation support.
The Virtual Object System assumes that the execution environment is metadata-driven. Using metadata allows the NGWS runtime to support:
- Multiple execution models - The metadata also allows the execution environment to deal with a mixture of interpreted, JITted, native and legacy code and still present uniform services to things like debuggers or profilers, consistent exception handling and unwinding, reliable code access security, and efficient memory management.
- Auto support for services - Since the metadata is available at execution time, the execution environment and the base runtime libraries can automatically supply support for reflection, automation, inter-op with existing Unmanaged COM applications, and inter-op with existing unmanaged native code with little or no effort on the part of the programmer.
- Better optimization – Using metadata references instead of physical offsets, layouts, and sizes allows the execution engine to optimize the physical layouts of members and dispatch tables. In addition, this allows the generated code to be optimized to match the particular CPU or environment.
- Reduced binding brittleness – Using metadata references also reduces the constraints on what constitutes binary compatibility between implementations, thereby reducing version to version brittleness and/or build order/phase breakage.
- Flexible deployment resolution - Since we can have metadata for both the reference and the definition of a type, more robust and flexible deployment and resolution mechanisms are possible. Resolution boils down to answering the question: by looking in the appropriate set of places, find the implementation that best satisfies these requirements for use in this context. There are five pieces of information in the foregoing. Two items are made available via metadata (requirements and context). The others come from the application packaging and deployment story (where to look, how to find an implementation, and how to decide the best match).