Per-Selector Dispatch Cache for Method Call Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional method call operations in dynamically-typed and statically-typed object-oriented languages face inefficiencies due to slow runtime searches for target functions, leading to high memory consumption and discarded information in global caches, especially in polymorphic call sites.

Innovation Solution

Implementing a per-selector dispatch cache system that maps call sites to dispatch caches based on method selectors, using a global cache with per-selector caches indexed by selector identification, allowing for hash lookups to quickly determine if a target function exists, and dynamically adjusting cache sizes based on polymorphism.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If a global cache is used to store target functions for dynamic dispatch, then method call operations can be performed, but memory consumption increases and lookup speed decreases

Engineering Contradiction:
Improvemethod call operation speedVSAvoidmemory consumption
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

The global cache is segmented into multiple per-selector caches, each dedicated to a specific method selector. This segmentation allows the system to store only relevant target functions for each selector rather than maintaining a single large global cache, reducing overall memory consumption while enabling faster targeted lookups.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a new dimension of organization by indexing caches based on method selectors rather than using a flat global structure. This selector-based indexing creates a hierarchical dimension that improves lookup efficiency by directly routing to the appropriate cache partition.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Reliability

If runtime searches are performed in receiver class and super-classes for target functions, then correct method dispatch is achieved, but operation speed becomes too slow for optimized language implementation

Engineering Contradiction:
Improvemethod dispatch correctnessVSAvoidruntime search speed
Core Design Contradiction:
ReliabilityVSSpeed

Solution Approach 1:

The system performs preliminary actions by pre-computing and storing target function mappings in per-selector caches during compilation or initialization. This eliminates the need for runtime searches through class hierarchies, as the correct target function is already identified and cached based on the method selector and receiver class combination.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The per-selector cache acts as an intermediary between the method selector and the target function. Instead of directly searching through class hierarchies at runtime, the system uses the cache as a mediator that quickly resolves the selector to the appropriate target function, maintaining correctness while dramatically improving speed.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Speed

If per-selector caches are implemented with hash lookups, then lookup speed increases, but cache management complexity increases

Engineering Contradiction:
Improvelookup speedVSAvoidcache management complexity
Core Design Contradiction:
SpeedVSDevice complexity

Solution Approach 1:

The hash lookup mechanism provides self-service by automatically computing hash values from method selectors and directly mapping them to the appropriate cache entries. This automated hashing eliminates the need for complex manual cache management or hierarchical search algorithms, achieving fast lookups while keeping management simple through the natural properties of hash functions.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS9201797B1Per-selector dispatch
Publication Date: 2015.12.01 GOOGLE LLC
  • US9201797B1 patent drawing
  • US9201797B1 patent drawing
  • US9201797B1 patent drawing

AI summary

Aspects of the subject technology relate to a computer-implemented process, including steps for compiling a first method call at a first call site in code of an object-oriented language, wherein the first call site is associated with a first selector, referencing a global cache comprising a plurality of per-selector caches, wherein each of the per-selector caches is indexed based on a corresponding selector identification and identifying a first per-selector cache, from among the plurality of per-selector caches, using the first selector. In certain aspects, the process can further include steps for invoking a method on a first object by performing a lookup in the first per-selector cache using a class associated with the first object to determine if a first target function exists in the first per-selector cache. Systems and computer readable media are also provided.