Runtime-Declared Asynchronous State Machines for Compact Intermediate Code
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for representing asynchronous functionality in intermediate code result in larger code sizes, leading to increased bandwidth requirements and longer download times, as the runtime compiler lacks visibility into the asynchronous functions and cannot optimize performance effectively.
Innovation Solution
The runtime compiler declares the asynchronous state machine, rather than the source code language compiler, allowing for smaller intermediate code and enabling optimization specific to the environment.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the source code language compiler declares the asynchronous state machine, then the asynchronous functionality is correctly implemented, but the intermediate code size increases leading to larger bandwidth requirements and longer download times
Solution Approach 1:
The patent extracts the asynchronous state machine declaration from the source code language compiler and relocates it to the runtime compiler. This separation allows the intermediate code to contain only minimal representations of asynchronous functions, while the detailed state machine logic is generated later by the runtime compiler, thereby reducing intermediate code size without compromising asynchronous functionality implementation
Solution Approach 2:
The source code language compiler performs preliminary processing by identifying asynchronous functions and creating placeholder representations in the intermediate code, but defers the actual state machine generation to the runtime compiler. This preliminary action reduces intermediate code size while ensuring asynchronous functionality is preserved through the placeholder mechanisms
2Productivity
If the source code language compiler declares the asynchronous state machine, then the asynchronous code is compiled, but the runtime compiler cannot optimize performance specific to the execution environment
Solution Approach 1:
The patent segments the compilation process into two distinct phases: the source code language compiler handles high-level asynchronous function identification and intermediate code generation, while the runtime compiler handles environment-specific state machine generation and optimization. This segmentation allows each compiler to focus on its strengths, maintaining productivity while enabling environment-specific adaptations
Solution Approach 2:
The patent introduces dynamic state machine generation at runtime, where the runtime compiler creates optimized state machines tailored to the specific execution environment. This dynamic approach allows the system to adapt asynchronous functionality to different runtime conditions, improving both productivity and environment-specific optimization capability
3Reliability
If the intermediate code contains complete asynchronous state machine representations, then the asynchronous behavior is preserved, but the code delivery efficiency decreases due to larger size
Solution Approach 1:
The patent uses placeholder copies in the intermediate code that reference the actual asynchronous state machines to be generated at runtime. Instead of embedding complete state machine representations in the intermediate code, the system creates lightweight references that point to runtime-generated equivalents, thereby preserving asynchronous behavior while minimizing intermediate code size and download time
Data Source
Figure 1
Figure 2
Figure 3
AI summary
Representing asynchronous functionality in intermediate code, and then having the runtime compiler, rather than the source code language compiler, declare the corresponding asynchronous state machine. This allows the size of the intermediate code to be smaller thereby facilitating more efficient delivery of the code to end users. Furthermore, the runtime compiler can now use its optimization capability to optimize performance of the asynchronous functionality specific to the actual environment in which the asynchronous work will operate.