Hostable Compiler Type Inference for Scripting Performance

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Extension programming languages embedded in software applications often degrade runtime performance and fail to detect semantic errors before execution, leading to erroneous calculations due to the interpretation of scripting language code.

Innovation Solution

A hostable compiler is configured to execute within the same process as a host application, utilizing type information from the host application to infer types for expressions in compiled source code, thereby improving performance and error detection by integrating type inference and static typing.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If a scripting language interpreter is embedded into the software application to extend functionality, then additional capabilities may be incorporated quickly and cost-efficiently, but the runtime performance of the software application degrades due to the additional time consumed by the interpreter

Engineering Contradiction:
Improveease of extending functionalityVSAvoidruntime performance
Core Design Contradiction:
Ease of manufactureVSProductivity

Solution Approach 1:

The system dynamically switches between interpreted execution and compiled execution modes. The host application can execute scripting language code either through the interpreter or through pre-compiled native code, allowing optimization of performance-critical sections while maintaining the flexibility of interpretation for other parts.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The scripting language code is divided into segments that can be selectively compiled. The host application identifies performance-critical portions of the script and compiles them separately, while less critical portions continue to run through the interpreter, thus improving overall runtime performance without sacrificing ease of extension.

Inventive Principle:
Principle #1Segmentation

2Adaptability or versatility

If a scripting language interpreter is used to execute extension code, then additional capabilities may be added to the software application, but semantic errors are not detected before execution thereby increasing the likelihood of erroneous calculations

Engineering Contradiction:
Improvecapability to execute extension codeVSAvoiderror detection before execution
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The hostable compiler performs compilation and type checking before the scripting language code is executed. This preliminary action detects semantic errors and type mismatches in advance, preventing erroneous calculations from occurring during runtime while still allowing the application to execute extension code.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The hostable compiler acts as an intermediary between the scripting language code and the host application. It translates the high-level script into optimized native code while performing static type checking, thus mediating between the need for flexible extension code and the requirement for reliable error detection.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Productivity

If a hostable compiler is integrated into the host application to compile scripting language code, then runtime performance is improved through compiled code execution, but the device complexity increases due to the additional compiler component

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

Solution Approach 1:

The hostable compiler is designed to be a multi-functional component that can compile different scripting languages and integrate with various host applications. By creating a universal compiler that handles multiple languages and platforms, the system reduces the need for separate compiler implementations, thereby managing complexity while maintaining performance benefits.

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

4Measurement precision

If type information is exchanged between the host application and hostable compiler through an interface, then type inference accuracy is improved for expressions in compiled code, but the loss of time occurs during data exchange through the interface

Engineering Contradiction:
Improvetype inference accuracyVSAvoidtime for data exchange
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

Type information is extracted from the host application's internal data structures before the compilation process begins. By performing this data extraction and preparation in advance, the system minimizes the time required during actual compilation while ensuring accurate type inference for expressions in the compiled code.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS10521205B2Hostable compiler utilizing type information from a host application
Publication Date: 2019.12.31 MICROSOFT TECHNOLOGY LICENSING LLC
  • US10521205B2 patent drawing
  • US10521205B2 patent drawing
  • US10521205B2 patent drawing

AI summary

A hostable compiler interacts with a host application to enable the host application to execute program code supported by the hostable compiler. The host application and the hostable compiler exchange data through an interface that allows the hostable compiler to receive type information pertaining to data elements used applications executing within the host application process. This type information may then be used by the hostable compiler in the compilation of source code to infer a type for data elements used in the source code that are not declared yet associated with a value of an expression used in an application executed within the host application process.