Source Code Storage Mapping via Section Attributes
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current multi-tier storage systems require complex configuration for each variable and function, leading to increased development workload and maintenance costs due to the need for separate mapping relationships, which is inefficient and labor-intensive.
Innovation Solution
A storage space mapping method that parses source code to establish a mapping relationship between functions and variables and storage area identifiers defined at the file or folder level, allowing automatic mapping and reducing the need for individual configurations, thereby simplifying the implementation of multi-tier storage and lowering costs.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If separate configuration is performed for each variable and function to establish mapping relationships, then storage space mapping precision is improved, but device complexity and development workload increase significantly
Solution Approach 1:
The patent merges the configuration of multiple variables and functions into a unified section attribute configuration. Instead of configuring each symbol individually, the system allows configuring an entire section (e.g., `.l1.data`, `.l2.data`) that automatically applies to all symbols within that section, thereby reducing configuration complexity while maintaining mapping precision.
Solution Approach 2:
The section attribute configuration mechanism serves multiple functions simultaneously: it defines storage location, specifies memory tier, and applies to multiple symbols at once. This universal configuration approach eliminates the need for separate individual mappings while achieving the same or better mapping precision through hierarchical section-based organization.
2Manufacturing precision
If separate mapping relationships are established for each variable and function, then storage allocation accuracy is improved, but development workload and maintenance costs increase
Solution Approach 1:
The system performs preliminary organization of symbols into sections during the compilation process. By pre-grouping variables and functions into logical sections based on their usage patterns and requirements, the system enables automatic storage allocation without requiring manual configuration for each symbol, thereby improving development efficiency while maintaining allocation accuracy.
Solution Approach 2:
The compiler automatically generates the mapping relationships between symbols and storage locations based on the section attributes defined in the source code. This self-service mechanism eliminates the need for manual configuration of each variable and function, significantly reducing development workload and maintenance costs while preserving storage allocation accuracy through automated parsing and mapping.
3Measurement precision
If manual insertion of directives is performed for each variable to specify storage location, then mapping accuracy is improved, but ease of operation deteriorates
Solution Approach 1:
The section attribute acts as an intermediary mechanism between the developer's high-level storage requirements and the compiler's low-level allocation process. By defining sections with desired storage characteristics at the source code level, developers can specify storage locations without manually inserting directives for each variable, improving ease of operation while maintaining mapping accuracy through the intermediary section-based abstraction.
Data Source
Figure 1~3
Figure 4
AI summary
Embodiments of the present invention provide a storage space mapping method and apparatus. The method includes: parsing source code, so as to acquire a home file and/or a home folder of each function and/or variable in the source code; acquiring a mapping relationship between the home file and a storage area identifier and/or between the home folder and a storage area identifier, and establishing, according to the mapping relationship, a mapping relationship between each function and/or variable and the storage area identifier; and mapping, according to a mapping relationship between the storage area identifier and storage space, each function and/or variable to the storage space. According to the storage space mapping method and apparatus provided in the embodiments of the present invention, development workload and maintenance costs of storage space mapping can be greatly reduced.