Map Objects for Dynamic Property Access in Object-Oriented Languages
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Dynamic object-oriented programming languages face performance bottlenecks due to slow dynamic lookup operations when accessing object properties, as they often rely on time-consuming dictionary-lookup mechanisms.
Innovation Solution
The system employs map objects to facilitate fast property access by associating objects with memory regions and using map objects to store field mappings, allowing for efficient access and extension of object properties at runtime, with hierarchical organization and inline caching to optimize performance.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If dictionary-lookup operations are used to access object properties in dynamic object-oriented programming languages, then flexibility to define additional properties at runtime is maintained, but performance deteriorates due to time-consuming lookup operations
Solution Approach 1:
The patent segments the property access mechanism into multiple components: a map object that stores field mappings, a memory region that holds property values, and a hierarchical structure of map objects. This segmentation allows the system to avoid full dictionary lookups by directly accessing pre-computed field mappings in the map object, thereby improving performance while maintaining runtime flexibility.
Solution Approach 2:
The patent performs preliminary actions by pre-computing and storing field mappings in map objects before property access occurs. The map objects are constructed in advance with the correct field offsets and memory locations, so that during runtime, property access can directly use these pre-computed mappings without performing time-consuming dictionary lookups. This preliminary preparation resolves the contradiction by maintaining flexibility while improving performance.
2Productivity
If map objects with field mappings are used to access object properties, then performance improves by avoiding dictionary lookups, but device complexity increases due to hierarchical map object structures
Solution Approach 1:
The patent applies universality by designing map objects that serve multiple functions: they store field mappings, provide hierarchical inheritance support, enable runtime property definition, and facilitate cache optimization. This multi-functionality reduces the need for separate specialized structures, thereby managing complexity while achieving performance improvements.
Solution Approach 2:
The patent uses nesting by organizing map objects in a hierarchical structure where parent map objects contain mappings for common properties and child map objects extend them with additional properties. This nested arrangement allows the system to reuse parent mappings for inherited properties, reducing the total number of mappings needed and managing complexity through structured organization.
3Adaptability or versatility
If additional properties are defined for objects during execution, then adaptability is improved, but access time increases due to dynamic nature of property definitions
Solution Approach 1:
The patent performs preliminary action by pre-computing field mappings and storing them in map objects before runtime property access occurs. When properties are defined during execution, their field mappings are pre-calculated and stored in the appropriate map object, allowing subsequent access to use these pre-computed mappings directly without dynamic computation during access, thus reducing access time while maintaining adaptability.
Solution Approach 2:
The patent uses copying by creating map objects that replicate the field mapping structure from parent objects. When additional properties are defined during execution, the system copies the existing map object structure and adds the new property mappings, allowing efficient access to both inherited and newly defined properties without re-computing the entire property structure during access.
Data Source
AI summary
One embodiment of the present invention provides a system that uses map objects to access object properties for a program written in a dynamic object-oriented programming language, thereby facilitating property access for languages that allow additional properties to be defined for objects at runtime. During operation, the system receives an object of an object type. This object is associated with a memory region and a given map object (from a set of map objects associated with the given object type) that describes how properties of the object are mapped to fields in the memory region. When receiving a request to access a property of the object, the system determines whether the given map object includes a field mapping for the property. If so, the system accesses a field in the memory region associated with the property using the field mapping.


