Virtual Machine Native Call Stub Generation via Intermediate Representation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current techniques for interfacing dynamically compiled byte code with native libraries in virtual machines are unsatisfactory due to non-optimal performance and the large amount of manual work required to maintain stub generation code across various CPU/OS combinations.

Innovation Solution

A system and method for generating efficient native calls from compiled byte code within a virtual machine using a compiler with a calling convention adaptor that generates MIR code for native calls, which can be compiled into native machine code, thereby eliminating the need for platform-specific knowledge in stub generation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If traditional stub generation techniques are used to interface byte code with native libraries, then platform compatibility is achieved, but performance is non-optimal and maintenance burden increases

Engineering Contradiction:
Improvenative call performanceVSAvoidstub generation code complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent introduces an intermediate representation (IR) as a mediator between byte code and native machine code. The calling convention adaptor transforms byte code calls into IR instructions that represent native calls, which are then compiled to optimized native code. This intermediary layer enables performance optimization while maintaining platform compatibility through the compiler's handling of platform-specific details.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent extracts platform-specific calling convention knowledge from the stub generation process and relocates it to the compiler. By separating the platform-independent byte code compilation from platform-dependent native code generation, the system eliminates the need for manual stub generation maintenance across platforms while preserving optimization opportunities.

Inventive Principle:
Principle #2Taking out (Extraction)

2Adaptability or versatility

If manual stub generation code is maintained across various CPU/OS combinations, then platform compatibility is achieved, but the amount of manual work required increases

Engineering Contradiction:
Improveplatform compatibilityVSAvoidstub generation maintenance effort
Core Design Contradiction:
Adaptability or versatilityVSEase of manufacture

Solution Approach 1:

The patent creates a universal intermediate representation that can represent native calls in a platform-independent manner. The calling convention adaptor generates IR instructions that work across all platforms, and the compiler handles platform-specific transformations. This universal approach maintains adaptability to multiple CPU/OS combinations while eliminating the need for separate stub generation code for each platform.

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

Solution Approach 2:

The system enables self-service by allowing the compiler to automatically generate platform-appropriate native code from the intermediate representation. The compiler inherently knows the target platform's calling conventions and can optimize the generated code accordingly, eliminating the need for external stub generation tools and their associated maintenance burdens.

Inventive Principle:
Principle #25Self-service

3Speed

If byte code is directly translated to native code without intermediate representation, then execution speed is improved, but compiler optimization opportunities are lost

Engineering Contradiction:
Improvebyte code execution speedVSAvoidcompilation process complexity
Core Design Contradiction:
SpeedVSDevice complexity

Solution Approach 1:

The patent applies preliminary action by performing optimizations on the intermediate representation before final native code generation. The compiler can analyze and optimize the IR instructions, applying various optimization techniques that would be difficult or impossible to apply directly to byte code or final machine code. This preliminary optimization phase improves execution speed while managing compilation complexity through structured processing stages.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS8156482B2System and method for efficiently generating native code calls from byte code in virtual machines
Publication Date: 2012.04.10 ORACLE INT CORP
  • US8156482B2 patent drawing
  • US8156482B2 patent drawing
  • US8156482B2 patent drawing

AI summary

A system and method for generation of efficient calls from compiled byte code within a virtual machine (VM) or Java Virtual Machine (JVM) environment. Current techniques used to interface dynamically compiled byte code with native libraries using stubs are unsatisfactory due to non-optimal performance and the large amount of manual work needed to maintain the stub generation code. An embodiment of the present invention addresses this by providing a system and a method for automatic stub generation based on a small set of parameters stored in a ParamInfo structure. In accordance with an embodiment, the system comprises a computer with native libraries; a virtual machine for executing a software application; a memory space for the compiled byte code; and a compiler with a calling convention adaptor that integrates native calls into the high level analysis step of the compilation of byte codes, so that the overhead for the native call is reduced.