Variable Inference for Dynamic Language Transcompilation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The challenge lies in efficiently transcompiling dynamic language program codes into native language codes due to dynamic typing and dynamic name binding, which complicates variable type determination and affects transcompilation efficiency and accuracy.

Innovation Solution

A variable inference system and method that divide software programs into basic blocks, calculate variable type inputs, generations, and kills, and determine outputs, using data flow and lattice structures to infer variable types across blocks, effectively handling dynamic typing and name binding.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If dynamic language program codes are transcompiled into native language program codes, then execution efficiency is improved, but variable type determination becomes difficult due to dynamic typing and dynamic name binding

Engineering Contradiction:
Improveexecution efficiencyVSAvoidvariable type determination difficulty
Core Design Contradiction:
ProductivityVSDifficulty of detecting and measuring

Solution Approach 1:

The patent performs variable type inference during the transcompilation process by analyzing the dynamic language program code before native code generation. It divides the code into basic blocks and calculates variable type inputs, generations, kills, and outputs in advance, determining variable types before the actual execution occurs. This preliminary analysis resolves the difficulty of variable type determination while enabling efficient native code generation.

Inventive Principle:
Principle #10Preliminary action

2Manufacturing precision

If variable type inference is performed during transcompilation, then transcompilation accuracy is improved, but transcompilation time increases

Engineering Contradiction:
Improvetranscompilation accuracyVSAvoidtranscompilation time
Core Design Contradiction:
Manufacturing precisionVSLoss of time

Solution Approach 1:

The patent divides the transcompilation process into basic blocks and performs variable type inference on each block separately. It calculates variable type inputs, generations, kills, and outputs for each basic block independently, then combines the results. This segmentation allows the inference process to be optimized and parallelized, improving accuracy while controlling the overall transcompilation time.

Inventive Principle:
Principle #1Segmentation

3Measurement precision

If the software program is divided into basic blocks for variable type inference, then variable type inference accuracy is improved, but system complexity increases

Engineering Contradiction:
Improvevariable type inference accuracyVSAvoidsystem complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent implements a self-contained variable type inference system that automatically divides the program into basic blocks and performs type analysis without requiring external intervention. The system calculates variable type inputs, generations, kills, and outputs using internal data flow analysis, making the complexity management self-service rather than requiring additional external tools or manual processes.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS9747087B2Variable inference system and method for software program
Publication Date: 2017.08.29 INSTITUTE FOR INFORMATION INDUSTRY
  • US9747087B2 patent drawing
  • US9747087B2 patent drawing
  • US9747087B2 patent drawing

AI summary

A variable inference system and a variable inference method for a software program are provided. The variable inference system and method calculate a first variable type output corresponding to an unknown variable for a plurality of first basic blocks of a software program. The variable inference system and method calculate a second variable type input corresponding to the unknown variable for a second basic block of the software program. The variable inference system and method calculate a second variable type generation when the second basic block includes a primitive instruction corresponding to the unknown variable. The variable inference system and method calculate a second variable type kill. The variable inference system and method calculate a second variable output corresponding to the unknown variable for the second basic block according to the second variable type input, the second variable type generation and the second variable type kill.