Static Compilation Metadata Mapping for Dynamic Reflection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing computer program environments face challenges in balancing dynamic and static features, particularly in supporting reflection without relying on Just-In-Time (JIT) compilation and reducing runtime requirements, especially in resource-constrained devices like smartphones and tablets.

Innovation Solution

The approach involves static ahead-of-time compilation that creates mappings between metadata and native code, generates trampoline code for dynamic behavior, and uses runtime behavior characteristics descriptions to manage metadata, distinguishing between reflection and introspection, thereby reducing reliance on JIT compilation and minimizing runtime requirements.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If Just-In-Time (JIT) compilation is used to support dynamic behavior, then dynamic features such as reflection and dynamic dispatch are enabled, but runtime size and complexity increase significantly

Engineering Contradiction:
Improvedynamic behavior supportVSAvoidruntime complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent segments the runtime support for dynamic behavior into distinct components: metadata structures that describe types and members, mapping tables that connect metadata to code locations, and trampoline code that handles dynamic dispatch. This segmentation allows the runtime to provide dynamic features without requiring a large, monolithic JIT compilation infrastructure, thereby reducing runtime complexity while maintaining adaptability.

Inventive Principle:
Principle #1Segmentation

2Adaptability or versatility

If JIT compilation is used to support reflection, then dynamic type inspection and modification are enabled, but the runtime platform becomes larger and more complex

Engineering Contradiction:
Improvereflection capabilityVSAvoidruntime size
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

The patent extracts the essential reflection functionality from the JIT compilation infrastructure. It does this by creating standalone metadata structures that contain type information, member definitions, and mapping data, which can be used for reflection without requiring JIT compilation. This extraction reduces runtime size by removing unnecessary JIT components while preserving reflection capabilities.

Inventive Principle:
Principle #2Taking out (Extraction)

3Quantity of substance

If static compilation is used to reduce runtime requirements, then runtime size is reduced, but supporting dynamic behavior becomes more difficult

Engineering Contradiction:
Improveruntime sizeVSAvoiddynamic behavior support
Core Design Contradiction:
Quantity of substanceVSAdaptability or versatility

Solution Approach 1:

The patent applies preliminary action by pre-computing and embedding metadata structures and mapping tables during static compilation. These metadata structures contain all the information needed for dynamic behavior (type definitions, member information, code location mappings), allowing the statically compiled program to support dynamic features without requiring a large runtime. The preliminary preparation of metadata enables dynamic behavior while keeping runtime size small.

Inventive Principle:
Principle #10Preliminary action

4Adaptability or versatility

If metadata is included to support reflection, then dynamic type inspection is enabled, but the risk of runtime errors increases

Engineering Contradiction:
Improvetype introspection capabilityVSAvoidruntime error risk
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent introduces metadata structures as an intermediary layer between the program code and the reflection operations. The metadata acts as a safe, pre-validated description of types and members, allowing reflection operations to proceed without directly accessing potentially unsafe runtime state. This intermediary metadata layer reduces runtime error risk by providing a controlled interface for type introspection while maintaining full introspection capability.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS9836290B2Supporting dynamic behavior in statically compiled programs
Publication Date: 2017.12.05 MICROSOFT TECHNOLOGY LICENSING LLC
  • US9836290B2 patent drawing
  • US9836290B2 patent drawing
  • US9836290B2 patent drawing

AI summary

Support for dynamic behavior is provided during static compilation while reducing reliance on JIT compilation and large runtimes. A mapping is created between metadata and native code runtime artifacts, such as between type definition metadata and a runtime type description, or between method definition metadata, a runtime type description, and a native code method location, or field definition metadata, a runtime type description, and a field location. A mapping between runtime artifacts may also be created. Some compilation results include trampoline code to support a reflection invocation of an artifact in the reduced runtime support environment, for virtual method calls, call-time bounds checking, calling convention conversion, or compiler-intrinsic methods. Some results support runtime diagnostics by including certain metadata even when full dynamic behavior is not supported.