Segmented Constant Pool Cache Resolution in JVM

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing approaches to resolving segmented constant pools in a Java Virtual Machine (JVM) environment are computationally burdensome, leading to slow performance and increased overhead, particularly during class loading and system startup, especially on resource-constrained devices.

Innovation Solution

The method involves allocating a constant pool cache for each specialization, assigning owners to each segment, maintaining a list of specializations with access to each segment, and copying resolved entries to the specialization's cache, with the JVM retrieving resolved entries from the owner's cache at runtime, thereby reducing the need for tree walks and index adjustments.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If a cache is allocated for each CP segment with bounds checking and synchronization, then constant pool resolution correctness is ensured, but computational overhead increases and performance deteriorates

Engineering Contradiction:
Improveconstant pool resolution correctnessVSAvoidresolution performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The constant pool is divided into multiple segments, each with its own cache and owner specialization. This segmentation allows parallel resolution operations on different segments without requiring global synchronization, thus maintaining correctness while improving performance.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

An owner specialization is designated for each constant pool segment to act as the intermediary responsible for resolving that segment. Other specializations can access the owner's cache directly without synchronization overhead, eliminating the need for bounds checking and synchronization while ensuring correctness through the owner's authoritative resolution.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If tree walks and index adjustments are performed for each constant pool lookup, then accurate segment identification is achieved, but computational time increases

Engineering Contradiction:
Improvesegment identification accuracyVSAvoidlookup time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The constant pool segments are pre-organized with designated owners and cached results are pre-computed by the owner specialization. This preliminary organization eliminates the need for runtime tree walks and index adjustments, as lookups can directly access the pre-positioned cache entries.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

Resolved constant pool entries are copied from the owner's cache to the accessing specialization's cache. This copying mechanism allows direct access to resolved values without requiring the accessing specialization to perform tree walks or index calculations to identify the correct segment.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS11221867B2Resolution of segmented constant pools
Publication Date: 2022.01.11 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11221867B2 patent drawing
  • US11221867B2 patent drawing
  • US11221867B2 patent drawing

AI summary

Resolving segmented constant pools in a virtual machine managed runtime. An embodiment includes allocating, using one or more processors of a computing device, for each specialization created in a class of specializations, a constant pool (CP) cache, assigning an owner to each segment of constant pools, maintaining, in a memory of the computing device, a list of specializations in the class, and copying, upon determining that a CP segment entry visible to the specialization is resolved in the owner, the entry to a specializations cache of the memory. An embodiment includes assigning a new specialized CP segment as an owner of that CP segment and adding a new entry associated with the new specialization to a template class owners table, retrieving, based on looking for entry at runtime, a slot pointed to in the owners table and resolving the CP entry in the constant pool cache of the owner.