Complex Constants in Virtual Machine Constant Tables

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current constant tables and loading processes are limited to specific types of values natively supported by the run-time environment, making it difficult to efficiently handle and optimize complex constant values such as complex numbers, tuples, and aggregates, as the designer cannot anticipate all possible types of constant values needed by software developers.

Innovation Solution

The implementation of complex constants in the constant table, allowing arbitrary types to be supported, where a compiler analyzes source code to identify candidates for complex constants, and generates bytecode or hardware-level instructions to optimize their representation and loading, using metafactory methods to cache and reuse complex values, thereby reducing redundant computations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If constant tables are tailored to specific types of values natively supported by the run-time environment, then the run-time environment can fine-tune the handling of those constants and develop optimizations specific to a particular type of value, but it becomes impossible to anticipate every type of constant value that could be useful to software developers and limits flexibility

Engineering Contradiction:
Improveflexibility to support arbitrary types of constant valuesVSAvoidcomplexity of the constant table structure and loading process
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent creates a universal constant table entry structure that can represent multiple types of values (primitives, strings, class references, method references, and complex aggregate types) through a unified format. The entry includes a tag byte indicating the type and fields that can represent different data structures depending on the tag value, allowing the same structure to serve multiple purposes without requiring type-specific table structures.

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

Solution Approach 2:

The constant table entry is segmented into distinct components: a tag byte identifying the type of constant, type information fields, and value fields. This segmentation allows the run-time environment to process different types of constants through type-specific handling logic while maintaining a unified table structure, resolving the contradiction between universality and complexity.

Inventive Principle:
Principle #1Segmentation

2Quantity of substance

If the run-time environment creates separate instantiations for each constant value usage, then each variable can independently reference its constant, but this duplicates memory usage and causes needlessly duplicated work

Engineering Contradiction:
Improvememory usage efficiencyVSAvoidease of constant value management and reference tracking
Core Design Contradiction:
Quantity of substanceVSEase of operation

Solution Approach 1:

The patent implements constant pooling where identical constant values are merged into a single instantiation in the constant table. Multiple variables referencing the same constant value all point to the same constant table entry, eliminating redundant memory usage. The run-time environment can safely share the constant instance across multiple variables since constants are immutable.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

Instead of creating separate instantiations for each constant usage, the system creates a single copy in the constant table and uses references to that copy throughout the program. This copying approach reduces memory consumption while maintaining the ability to track and manage constant values efficiently through the constant pool structure.

Inventive Principle:
Principle #26Copying

3Productivity

If complex constant values are handled without special optimization, then the run-time environment can execute programs, but redundant computations occur and execution efficiency is reduced

Engineering Contradiction:
Improveexecution efficiency of programsVSAvoidtime spent on redundant computations
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent performs preliminary analysis during compilation to identify constant values in the source code and pre-processes them into constant table entries with appropriate tags and type information. This preliminary action allows the run-time environment to efficiently load and reuse constant values without performing redundant computations during execution, as the constant nature of values is already established and optimized in the constant table.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS10540148B2Complex constants
Publication Date: 2020.01.21 ORACLE INT CORP
  • US10540148B2 patent drawing
  • US10540148B2 patent drawing
  • US10540148B2 patent drawing

AI summary

In an approach, a virtual machine identifies, within a set of instructions, an instruction to load a constant; identifies, based on the instruction to load the constant, a first entry in a data structure that identifies a particular constant type of the one or more constant types, wherein the first entry specifies at least constant data and a first set of instructions for assembling a value or partial value from the constant data; executes the first set of instructions to assemble the value or the partial value from the constant data; and stores a particular value or a reference to the particular value onto a run-time data structure used to pass values or references between sets of instructions executing in a run-time environment, wherein the particular value is based on the value or the particular value assembled from the constant data.