CN114217808B - Programming language pointer type Cache attribute expansion method - Google Patents

Programming language pointer type Cache attribute expansion method Download PDF

Info

Publication number
CN114217808B
CN114217808B CN202110398337.2A CN202110398337A CN114217808B CN 114217808 B CN114217808 B CN 114217808B CN 202110398337 A CN202110398337 A CN 202110398337A CN 114217808 B CN114217808 B CN 114217808B
Authority
CN
China
Prior art keywords
cache
attribute
pointer
setting
statement
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110398337.2A
Other languages
Chinese (zh)
Other versions
CN114217808A (en
Inventor
方燕飞
李雁冰
董恩铭
文延华
于康
杨小川
刘齐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuxi Jiangnan Computing Technology Institute
Original Assignee
Wuxi Jiangnan Computing Technology Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuxi Jiangnan Computing Technology Institute filed Critical Wuxi Jiangnan Computing Technology Institute
Priority to CN202110398337.2A priority Critical patent/CN114217808B/en
Publication of CN114217808A publication Critical patent/CN114217808A/en
Application granted granted Critical
Publication of CN114217808B publication Critical patent/CN114217808B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/441Register allocation; Assignment of physical memory space to logical memory space

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention discloses a programming language pointer type Cache attribute expansion method, which is based on the following configuration: expanding a pointer type Cache attribute, wherein the Cache attribute has two values of cached and uncached, and the Cache attribute is initialized, so that an initial value is allowed to be set for the pointer variable Cache attribute when the pointer variable is declared; setting a Cache attribute, namely allowing the Cache attribute value of a pointer variable to be dynamically set and modified in a program statement; the Cache write hints segment sub-attribute is set to indicate that write operations will be performed on the specified address space immediately; the private section sub-attribute of the Cache is set, and the scope is a following for, while, do-while, if statement or a composite statement bracketed by { }, which indicates that the access to the specified address space is private. The invention is convenient for programmers to improve the program access efficiency and reduce the power consumption of the Cache component.

Description

Programming language pointer type Cache attribute expansion method
Technical Field
The invention relates to a programming language pointer type Cache attribute expansion method, and belongs to the technical field of programming language design.
Background
The pointer type is a basic data type in programming languages such as a C language, and accessing data through the pointer is a common data access mode.
The use of a weakly consistent memory such as an SPM as a cache can reduce the chip area and power consumption, and is used in large amounts in the field of high performance, embedded and the like, but the manner in which the SPM is completely controlled by a user program increases the burden of programmers. The SPM is allowed to be dynamically configured into a hardware Cache according to the program requirement and dynamically determines whether data enter the Cache in the program running process, so that the SPM becomes a new trend of Cache structure development, and the balance between usability and power consumption can be realized. The existing programming language pointer type has no Cache attribute and cannot be well adapted to a new storage structure.
Disclosure of Invention
The invention aims to provide a programming language pointer type Cache attribute expansion method which is convenient for programmers to improve program memory access efficiency and reduce power consumption of Cache parts.
In order to achieve the above purpose, the invention adopts the following technical scheme: the programming language pointer type Cache attribute expansion method is provided, and is based on the following configuration:
Expanding a pointer type Cache attribute, wherein the Cache attribute has two values of cached and uncached, and accessing data through a pointer with the value of cached attribute, so that the data can enter the Cache in the accessing process; accessing the data through a pointer with a value of uncached attribute, and enabling the data not to enter the Cache;
initializing the Cache attribute, and allowing an initial value to be set for the Cache attribute of the pointer variable when the pointer variable is declared;
setting a Cache attribute, namely allowing the Cache attribute value of a pointer variable to be dynamically set and modified in a program statement;
The Cache sub-attribute setting specifically comprises:
setting a Cache write hint segment attribute, and performing write hint on a specified space in the use of a program execution statement to indicate that write operation is to be performed on the specified address space immediately;
Setting a private section sub attribute of the Cache, wherein the scope is a following for, while, do-while, if statement or a composite statement which is bracketed by { }, and indicating that the access to the designated address space is private;
The programming method based on the above configuration comprises the following steps:
S1, initializing Cache attributes of pointer variables when the pointer variables are declared;
s2, dynamically setting a Cache attribute value of a pointer variable according to a memory access mode in a program execution statement;
S3, setting a Cache write hint segment sub attribute for the write-only accessed data, and optimizing the write-only access performance;
s4, setting a sub attribute of a private section of the Cache for the private access data, and optimizing the performance of the private access.
The further improved scheme in the technical scheme is as follows:
1. in the above scheme, in the Cache attribute initialization configuration, when the pointer variable is declared, the Cache attribute value of the pointer data type is allowed to be initialized.
2. In the above scheme, in the Cache attribute setting, the Cache attribute value of the pointer variable allows dynamic setting and modification in the program according to the need.
Due to the application of the technical scheme, compared with the prior art, the invention has the following advantages:
According to the method for expanding the pointer type Cache attribute of the programming language, according to the condition that whether data access in the novel Cache structure is optional or not, the pointer type Cache attribute in the programming language is expanded, a simple and flexible Cache using mode is provided for programmers, the programmers can conveniently improve the program access and storage efficiency, reduce the power consumption of Cache parts, reduce the programming complexity of the programmers on the novel Cache structure, and improve the usability of the novel Cache structure.
Drawings
FIG. 1 is a schematic diagram of an overall structure of the pointer type Cache attribute extended by the present invention.
Detailed Description
Examples: the invention provides a programming language pointer type Cache attribute expansion method, which is based on the following configuration:
Expanding a pointer type Cache attribute, wherein the Cache attribute has two values of cached and uncached, and accessing data through a pointer with the value of cached attribute, so that the data can enter the Cache in the accessing process; accessing the data through a pointer with a value of uncached attribute, and enabling the data not to enter the Cache;
initializing the Cache attribute, and allowing an initial value to be set for the Cache attribute of the pointer variable when the pointer variable is declared;
setting a Cache attribute, namely allowing the Cache attribute value of a pointer variable to be dynamically set and modified in a program statement;
The Cache sub-attribute setting specifically comprises:
setting a Cache write hint segment attribute, and performing write hint on a specified space in the use of a program execution statement to indicate that write operation is to be performed on the specified address space immediately;
Setting a private section sub attribute of the Cache, wherein the scope is a following for, while, do-while, if statement or a composite statement which is bracketed by { }, and indicating that the access to the designated address space is private;
The programming method based on the above configuration comprises the following steps:
S1, initializing Cache attributes of pointer variables when the pointer variables are declared;
s2, dynamically setting a Cache attribute value of a pointer variable according to a memory access mode in a program execution statement;
S3, setting a Cache write hint segment sub attribute for the write-only accessed data, and optimizing the write-only access performance;
s4, setting a sub attribute of a private section of the Cache for the private access data, and optimizing the performance of the private access.
In the Cache attribute initialization configuration, the Cache attribute value of the pointer data type is allowed to be initialized when the pointer variable is declared.
In the Cache attribute setting, the Cache attribute value of the pointer variable allows dynamic setting and modification in the program according to the requirement.
Further explanation of the above embodiments is as follows:
The Cache attribute of the invention is used as a global attribute of a pointer type, acts in the life cycle of the whole pointer variable, and allows the dynamic modification of the Cache attribute.
The pointer-type Cache attribute has two values, cached and uncached: accessing data through a pointer with a value of cached attribute, wherein the data can enter a Cache in the accessing process; and accessing the data through the pointer with the value of uncached attribute, and directly entering the register from the main memory without entering the Cache. The Cache attribute value of the pointer variable defaults to uncached, namely, under the condition that special description is not made, the data access through the pointer does not enter the Cache.
To further optimize the memory access performance of the Cache, the Cache attributes may also include multiple sub-attributes, such as a Cache write hint segment, a Cache private segment, and so on. The Cache write hint section indicates that the subsequent access behavior of the program is that only write operation is performed on the section of memory space, and the effect of setting the write hint section is that the Cache and the section of memory space establish a mapping relation, but data in the section of memory are not read into the Cache, so that the frequency of entering the Cache from a main memory can be reduced, and the power consumption can be reduced; the private section of the Cache indicates private access to the section space, and on the storage structure of the private Cache of the multi-core shared memory, the private section can avoid fine-granularity mask writing which is necessary to solve the problem of false sharing, increase the granularity of writing data from the Cache into the memory, and reduce the writing time.
The Cache attribute description method comprises two types of Cache attribute initialization and Cache attribute setting, wherein the Cache attribute setting is divided into cached setting and uncached setting. The Cache attribute description is realized in a compiling indication form, and the specific compiling indication format is as follows:
1. Cache attribute initialization
#pragma cache cached/uncached
The declaration statement must be followed by a pointer variable declaration statement, and the Cache attribute value of the pointer variable representing the declaration of the subsequent statement is cached or uncached.
2. Setting Cache attributes
#pragma cache cached/uncached [ptr]
The command type statement is used in the program execution statement, the parameter is a pointer variable name, and the Cache attribute value for setting the parameter is cached or uncached.
3. Cache child attributes
(1) Cache write hint segment
#pragma cache write_hint [A, (start:end)]
A command type statement, used in a program execution statement, implies writing to a specified space, indicating that a write operation will be performed immediately to the specified address space. The parameters are a tuple of group names or start and end addresses, indicating write hints to the specified space.
(2) Private section of Cache
#pragma cache private_section [A, (start:end))]
The private_section clause is bound with for, while, do-while, if statement or { } bracketed compound statement, and the scope is the following for, while, do-while, if statement or { } bracketed compound statement. The Cache private section attribute is set, indicating that access to the specified address space is private. The parameters are the array name or the binary set consisting of the start address and the end address, and represent that the private area is the whole array or the memory area from start to end. The private segment attribute of the Cache is a local attribute and is only valid in the scope.
When the programming language pointer type Cache attribute expansion method is adopted, the situation that whether data access in a novel Cache structure is optional or not enters the Cache is aimed at, and through expanding the pointer type Cache attribute in the programming language, a simple and flexible Cache use mode is provided for programmers, so that the programmers can conveniently improve program access efficiency, reduce power consumption of Cache components, reduce programming complexity of the programmers on the novel Cache structure, and improve usability of the novel Cache structure.
The above embodiments are provided to illustrate the technical concept and features of the present invention and are intended to enable those skilled in the art to understand the content of the present invention and implement the same, and are not intended to limit the scope of the present invention. All equivalent changes or modifications made in accordance with the spirit of the present invention should be construed to be included in the scope of the present invention.

Claims (3)

1. A programming language pointer type Cache attribute expansion method is characterized by comprising the following steps:
Expanding a pointer type Cache attribute, wherein the Cache attribute has two values of cached and uncached, and accessing data through a pointer with the value of cached attribute, so that the data can enter the Cache in the accessing process; accessing the data through a pointer with a value of uncached attribute, and enabling the data not to enter the Cache;
initializing the Cache attribute, and allowing an initial value to be set for the Cache attribute of the pointer variable when the pointer variable is declared;
setting a Cache attribute, namely allowing the Cache attribute value of a pointer variable to be dynamically set and modified in a program statement;
The Cache sub-attribute setting specifically comprises:
setting a Cache write hint segment attribute, and performing write hint on a specified space in the use of a program execution statement to indicate that write operation is to be performed on the specified address space immediately;
Setting a private section sub attribute of the Cache, wherein the scope is a following for, while, do-while, if statement or a composite statement which is bracketed by { }, and indicating that the access to the designated address space is private;
The programming method based on the above configuration comprises the following steps:
S1, initializing Cache attributes of pointer variables when the pointer variables are declared;
s2, dynamically setting a Cache attribute value of a pointer variable according to a memory access mode in a program execution statement;
S3, setting a Cache write hint segment sub attribute for the write-only accessed data, and optimizing the write-only access performance;
s4, setting a sub attribute of a private section of the Cache for the private access data, and optimizing the performance of the private access.
2. The method for expanding the attribute of the pointer type Cache of the programming language according to claim 1, wherein the method comprises the following steps: in the Cache attribute initialization configuration, the Cache attribute value of the pointer data type is allowed to be initialized when the pointer variable is declared.
3. The method for expanding the attribute of the pointer type Cache of the programming language according to claim 1, wherein the method comprises the following steps: in the Cache attribute setting, the Cache attribute value of the pointer variable allows dynamic setting and modification in the program according to the requirement.
CN202110398337.2A 2021-04-14 2021-04-14 Programming language pointer type Cache attribute expansion method Active CN114217808B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110398337.2A CN114217808B (en) 2021-04-14 2021-04-14 Programming language pointer type Cache attribute expansion method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110398337.2A CN114217808B (en) 2021-04-14 2021-04-14 Programming language pointer type Cache attribute expansion method

Publications (2)

Publication Number Publication Date
CN114217808A CN114217808A (en) 2022-03-22
CN114217808B true CN114217808B (en) 2024-04-30

Family

ID=80695815

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110398337.2A Active CN114217808B (en) 2021-04-14 2021-04-14 Programming language pointer type Cache attribute expansion method

Country Status (1)

Country Link
CN (1) CN114217808B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733432A (en) * 2017-04-14 2018-11-02 阿里巴巴集团控股有限公司 The implementation method of private method, call method and its device under programmed environment
CN112416313A (en) * 2019-08-23 2021-02-26 无锡江南计算技术研究所 Compiling method supporting large integer data type and operator
CN112579059A (en) * 2019-09-27 2021-03-30 无锡江南计算技术研究所 Compiling method supporting finite field data type and operator

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7062761B2 (en) * 2001-07-10 2006-06-13 Micron Technology, Inc. Dynamic arrays and overlays with bounds policies
US7127710B2 (en) * 2002-06-24 2006-10-24 Intel Corporation Identifying pure pointers to disambiguate memory references
US7380086B2 (en) * 2003-12-12 2008-05-27 International Business Machines Corporation Scalable runtime system for global address space languages on shared and distributed memory machines

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733432A (en) * 2017-04-14 2018-11-02 阿里巴巴集团控股有限公司 The implementation method of private method, call method and its device under programmed environment
CN112416313A (en) * 2019-08-23 2021-02-26 无锡江南计算技术研究所 Compiling method supporting large integer data type and operator
CN112579059A (en) * 2019-09-27 2021-03-30 无锡江南计算技术研究所 Compiling method supporting finite field data type and operator

Also Published As

Publication number Publication date
CN114217808A (en) 2022-03-22

Similar Documents

Publication Publication Date Title
US20200319980A1 (en) Persistent memory transactions with undo logging
US7533246B2 (en) Application program execution enhancing instruction set generation for coprocessor and code conversion with marking for function call translation
CN112650539B (en) Heterogeneous many-core processor-oriented dynamic link operation support method
Rodchenko et al. MaxSim: A simulation platform for managed applications
CN114217808B (en) Programming language pointer type Cache attribute expansion method
Siddique et al. Lmstr: Local memory store the case for hardware controlled scratchpad memory for general purpose processors
US6671843B1 (en) Method for providing user definable algorithms in memory BIST
Krylov et al. The evolution of garbage collection in v8: google's javascript engine
CN113986775B (en) Page table item generation method, system and device in RISC-V CPU verification
JPH02292648A (en) Multiplex virtual storage system and address controller
CN114201444A (en) Method, medium, program product, system and apparatus for storage management
Hu et al. Exploring architectural implications to boost performance for in-nvm b+-tree
Xu et al. Jsnvm: supporting data persistence in javascript using non-volatile memory
Chen et al. A quantitative evaluation of persistent memory hash indexes
Li et al. A NUMA-aware Key-Value Store for Hybrid Memory Architecture
CN114217937A (en) Compiler support method for alleviating false sharing problem
KR0127101B1 (en) Object-oriented database system
Buhr et al. μ Database: A Toolkit for Constructing Memory Mapped Databases
CN114218137A (en) Redundant cache elimination method
Tasos SHAPES: easy and high-level memory layouts
Greenspan et al. Persistent Memory Objects: Fast and Easy Crash Consistency for Persistent Memory
Bartoli et al. Application-controlled memory management in a single address space environment
CN115203068A (en) SFR (Small form-factor response) access method of 8051 kernel
CN116225340A (en) Data read-write method of distributed virtual memory system and distributed virtual memory system
WO2009095917A1 (en) A system and method for responding to virtual memory addresses

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant