Hosted Pre-Compilation System for Managed Code

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current solutions for pre-compiling managed code in virtual execution environments are cumbersome, as ahead-of-time compilers like NGen lack access to configuration settings, leading to performance and resource usage issues due to manual and tedious processes.

Innovation Solution

A hosted pre-compilation system that allows the host to trigger ahead-of-time compilation at runtime, choosing which modules to compile, where to persist images, and when to regenerate them, with APIs for validation and compilation control, enabling pre-compilation within hosted environments.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If NGen is used to pre-compile managed code, then performance and memory utilization are improved, but the process becomes manual and tedious due to lack of access to configuration settings

Engineering Contradiction:
Improvepre-compilation efficiencyVSAvoidoperation simplicity
Core Design Contradiction:
ProductivityVSEase of operation

Solution Approach 1:

The host application serves as an intermediary between the NGen compiler and the configuration settings. The host provides the compiler with access to configuration data through structured interfaces, enabling automatic pre-compilation without manual intervention while maintaining security and control boundaries.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system performs preliminary actions by automatically detecting when pre-compilation is needed and initiating the process before the managed code is executed. The host application schedules and triggers NGen compilation in advance, ensuring optimized code is ready when required without manual user action.

Inventive Principle:
Principle #10Preliminary action

2Productivity

If pre-compilation is performed in hosted environments, then performance matches non-hosted environments, but the system complexity increases due to need for intercepting module loads and validating images

Engineering Contradiction:
Improveexecution performanceVSAvoidsystem complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The host application implements a universal pre-compilation framework that handles multiple functions: intercepting module load requests, validating configuration settings, triggering NGen compilation, and managing the compilation lifecycle. This multi-functional approach consolidates complexity into a single host-based system rather than requiring separate components.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The system implements feedback mechanisms where the host application monitors module load events and configuration changes, dynamically triggering pre-compilation when needed. The runtime provides feedback signals to the host about compilation status and image validity, enabling automatic adjustment without manual intervention.

Inventive Principle:
Principle #23Feedback

3Reliability

If NGen images are regenerated when invalidated, then reliability is maintained, but time is lost due to frequent regeneration commands

Engineering Contradiction:
Improveimage validityVSAvoidregeneration time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The host application performs preliminary validation of configuration settings and module dependencies before triggering NGen compilation. By detecting invalidation conditions in advance and scheduling regeneration proactively rather than reactively, the system minimizes time loss while maintaining image validity.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system implements self-service mechanisms where the runtime automatically monitors for image invalidation and notifies the host application. The host then autonomously decides when regeneration is needed and initiates the process without external intervention, reducing time loss through automated detection and response.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS8924922B2Pre-compiling hosted managed code
Publication Date: 2014.12.30 MICROSOFT TECHNOLOGY LICENSING LLC
  • US8924922B2 patent drawing
  • US8924922B2 patent drawing
  • US8924922B2 patent drawing

AI summary

A hosted pre-compilation system is described herein that provides a way to enable ahead-of-time compilation for managed code running inside a host. The host triggers ahead-of-time compilation at application runtime, after any configuration settings are available. The host can choose which modules to compile, when to compile them, and where to persist the generated images. Upon detecting a module load, the host can trigger pre-compilation, provide the loader an existing pre-compiled image of the module, or do nothing. The runtime/platform validates the integrity of any host-supplied pre-compiled image and provides application programming interfaces (APIs) to inform the host when an image becomes invalid and fails to load. The platform also provides APIs to let the host trigger compilation of binaries at any time relevant to the host, and to generate the images either synchronously or in a background process.