Dynamic Property Access via Equivalent Type Caching

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In dynamically typed programming languages, efficiently accessing properties in objects is challenging due to the lack of statically known structures, leading to high overhead in execution speeds and increased processor load, as existing optimizations like caching and type checking do not adequately address the variability in type layouts.

Innovation Solution

The implementation of Equivalent Object Type Specialization, which generates direct access code for property access using hard-coded offsets and a single type check, leveraging equivalent type caches and property equivalence records to optimize access across different object types with shared property offsets, allowing for efficient and type-safe access even when objects have different layouts.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional property access methods are used in dynamically typed languages, then type safety is maintained through multiple type checks, but execution speed decreases and processor load increases

Engineering Contradiction:
Improvetype safetyVSAvoidexecution speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent performs type checks in advance during compilation or code generation, determining the types of objects before runtime execution. This preliminary action allows the system to generate optimized direct access code with hard-coded offsets, eliminating the need for repeated type checks during property access operations, thus resolving the contradiction between maintaining type safety and improving execution speed

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates equivalent type caches that store type information and property offset mappings. Instead of performing type checks at every property access, the system copies type information into these caches and uses the cached data to generate direct access code, reducing runtime overhead while maintaining type safety through the cached type information

Inventive Principle:
Principle #26Copying

2Reliability

If multiple type checks are performed to ensure type safety, then reliability is improved, but code complexity and execution overhead increase

Engineering Contradiction:
Improvetype safetyVSAvoidcode complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent extracts type checking operations from the runtime property access path and moves them to compilation or code generation time. By taking out the type checks from the critical runtime path, the system reduces code complexity and execution overhead while maintaining type safety through the extracted and pre-performed type verification

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent introduces equivalent type caches as intermediary structures that store type information and property offset mappings. These caches act as mediators between the type system and property access operations, eliminating the need for complex runtime type checks while preserving type safety through the intermediary cached information

Inventive Principle:
Principle #24Intermediary (Mediator)

3Productivity

If direct access code with hard-coded offsets is generated, then execution speed improves, but adaptability to different object types decreases

Engineering Contradiction:
Improveexecution speedVSAvoidhandling different object types
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The patent performs preliminary analysis during code generation to determine which object types will be accessed and generates equivalent type caches containing type information and property offset mappings for those types. This preliminary action enables the system to generate direct access code with hard-coded offsets that is both fast and adaptable, as the caches contain information for multiple object types

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates equivalent type caches that serve multiple functions: they store type information for type safety verification, provide property offset mappings for direct access code generation, and support multiple different object types. This multi-functionality allows the system to maintain both execution speed through direct access and adaptability to different object types through the universal cache structure

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

Data Source

PatentEP3084597B1Property accesses in dynamically typed programming languages
Publication Date: 2024.09.11 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP3084597B1 patent drawingFigure 1~2
  • EP3084597B1 patent drawingFigure 3
  • EP3084597B1 patent drawingFigure 4~6

AI summary

A code generator may emit a direct access code for accessing a property of an object under conditions which promote type safety in a dynamically typed programming language. The direct access code accesses a value of the property using a hard-coded offset into the object's memory region. In some cases, the direct access code accesses the value after a single type check that guards a sequence of property accesses, including at least one prior sequence member. In some cases, type check code compares an object's type to a designated guard type of an equivalent type cache. An object type may be checked for property-specific access equivalence with types in the equivalent type cache by using a property equivalence record which is associated with the equivalent type cache. When types are not access-equivalent with regard to a property, type safety is preserved by emitting nondirect access code for accessing the property.