Static Compilation Metadata Mapping for Dynamic Behavior

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current computer programming 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 generates metadata mappings and trampoline code to support dynamic behavior in a reduced runtime environment, distinguishing between metadata for inspection and method invocation, and using directives to manage runtime behavior characteristics, thereby eliminating the need for JIT compilation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If 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

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

Solution Approach 1:

The patent extracts dynamic behavior support from the runtime environment and relocates it to compile-time processing. Specifically, dynamic dispatch tables and type information are generated during ahead-of-time compilation rather than being provided by the runtime, thereby reducing runtime complexity while maintaining dynamic features

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent performs preliminary generation of dynamic dispatch tables and type metadata during ahead-of-time compilation. This preliminary action prepares all necessary dynamic behavior information before execution, eliminating the need for complex runtime compilation mechanisms

Inventive Principle:
Principle #10Preliminary action

2Adaptability or versatility

If JIT compilation is used to support dynamic behavior, then flexibility and power are provided, but runtime size increases

Engineering Contradiction:
ImproveflexibilityVSAvoidruntime size
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

The patent extracts dynamic behavior support from the runtime environment and relocates it to compile-time processing. Specifically, dynamic dispatch tables and type information are generated during ahead-of-time compilation rather than being provided by the runtime, thereby reducing runtime complexity while maintaining dynamic features

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent performs preliminary generation of dynamic dispatch tables and type metadata during ahead-of-time compilation. This preliminary action prepares all necessary dynamic behavior information before execution, eliminating the need for complex runtime compilation mechanisms

Inventive Principle:
Principle #10Preliminary action

3Quantity of substance

If static compilation is used, then runtime size is reduced, but dynamic behavior support is limited

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

Solution Approach 1:

The patent performs preliminary generation of dynamic dispatch tables and type metadata during ahead-of-time compilation. This preliminary action prepares all necessary dynamic behavior information before execution, eliminating the need for complex runtime compilation mechanisms

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces dynamic dispatch tables as an intermediary data structure that bridges static compilation and dynamic behavior. These tables contain pre-computed type information and method resolutions that enable dynamic dispatch without requiring JIT compilation or large runtime support

Inventive Principle:
Principle #24Intermediary (Mediator)

4Adaptability or versatility

If reflection metadata is included for all types, then complete introspection is enabled, but processing workload and memory usage increase

Engineering Contradiction:
Improveintrospection capabilityVSAvoidprocessing efficiency
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The patent applies local quality by making reflection metadata availability type-specific rather than universal. The compiler analyzes each type and includes reflection metadata only for types that are actually reflected upon at runtime, using heuristics based on type usage patterns, namespace characteristics, and explicit annotations

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent implements partial action by selectively including reflection metadata for only the subset of types that require introspection. This partial inclusion reduces processing workload and memory usage while maintaining complete introspection capability for the necessary types

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentEP3123316B1Supporting dynamic behavior in statically compiled programs
Publication Date: 2020.09.02 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP3123316B1 patent drawingFigure 1~2
  • EP3123316B1 patent drawingFigure 3~5
  • EP3123316B1 patent drawingFigure 6

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.