CN116931944A - Data storage method, device, computer equipment and storage medium - Google Patents

Data storage method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116931944A
CN116931944A CN202210374157.5A CN202210374157A CN116931944A CN 116931944 A CN116931944 A CN 116931944A CN 202210374157 A CN202210374157 A CN 202210374157A CN 116931944 A CN116931944 A CN 116931944A
Authority
CN
China
Prior art keywords
data
current
address
constant
current data
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.)
Pending
Application number
CN202210374157.5A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210374157.5A priority Critical patent/CN116931944A/en
Publication of CN116931944A publication Critical patent/CN116931944A/en
Pending legal-status Critical Current

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
    • G06F8/4434Reducing the memory space required by the program code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system

Abstract

The application relates to a data storage method, a data storage device, computer equipment and a storage medium. Relates to the field of data storage, comprising: determining current data from the current data sequence in a front-to-back order; if the current initial storage address does not meet the address alignment condition of the current data, searching the alignment filling address interval which meets the current data from the current data sequence, and filling data which meets the address alignment condition when the current initial storage address is stored; if the filling data is found, storing the filling data from the current initial storage address, removing the filling data from the current data sequence, and updating the current initial storage address; if the current initial storage address meets the address alignment condition of the current data after updating, the current data is stored from the current initial storage address, the current data is removed from the current data sequence, and the current initial storage address is updated. The method can improve the utilization rate of the storage resources.

Description

Data storage method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of data storage technologies, and in particular, to a data storage method, apparatus, computer device, and storage medium.
Background
With the development of computer technology, computer programs are becoming more and more widely used. A Computer Program (Computer Program) is a set of instructions that a Computer can recognize and execute, running on a Computer. Products implemented by computer programs are increasing, such as social software, shopping software, and payment software.
The computer program needs to be compiled by a compiler to generate an executable file before being executed by the computer. Since a computer program generally includes many constants, the constants need to be compiled when the computer program is compiled.
In the conventional constant compiling method, constants are stored in a storage space, and then the constants stored in the storage space are compiled. However, when the conventional constant compiling method stores constants into the memory space, more memory space is wasted due to the need for address-aligned memory, resulting in a lower utilization of memory resources.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data storage method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the utilization of storage resources.
In one aspect, the present application provides a data storage method. The method comprises the following steps: determining current data from the current data sequence in a front-to-back order; the data in the current data sequence are arranged according to the reading frequency; under the condition that the current initial storage address does not meet the address alignment condition of the current data, searching alignment filling address intervals which meet the current data from the current data sequence according to the sequence from front to back, and filling data which meet the address alignment condition when the current initial storage address is stored; the alignment filling address interval is an interval between a current alignment storage address and the current initial storage address, and the current alignment storage address is an idle storage address which is nearest to the current initial storage address and accords with the address alignment condition of the current data; if the filling data is found, storing the filling data from the current initial storage address, removing the filling data from the current data sequence, and updating the current initial storage address; if the current initial storage address meets the address alignment condition of the current data after updating, the current data is stored from the current initial storage address, the current data is removed from the current data sequence, the current initial storage address is updated, and the current data is determined from the current data sequence according to the sequence from front to back.
On the other hand, the application also provides a data storage device. The device comprises: the data determining module is used for determining current data from the current data sequence according to the sequence from front to back; the data in the current data sequence are arranged according to the reading frequency; the data searching module is used for searching aligned filling address intervals which accord with the current data from the current data sequence according to the sequence from front to back under the condition that the current initial storage address does not meet the address alignment condition of the current data, and filling data which meet the address alignment condition when the current initial storage address is stored; the alignment filling address interval is an interval between a current alignment storage address and the current initial storage address, and the current alignment storage address is an idle storage address which is nearest to the current initial storage address and accords with the address alignment condition of the current data; the address updating module is used for storing the filling data from the current initial storage address if the filling data is found, removing the filling data from the current data sequence and updating the current initial storage address; and the data storage module is used for storing the current data from the current initial storage address if the current initial storage address meets the address alignment condition of the current data after updating, removing the current data from the current data sequence, updating the current initial storage address and returning to the step of determining the current data from the current data sequence according to the sequence from front to back.
In some embodiments, the data lookup module is further to: searching target data which accords with the alignment filling address interval of the current data from the current data sequence according to the sequence from front to back; and under the condition that the target data is found, if the current initial storage address meets the address alignment condition of the target data, determining the target data as filling data.
In some embodiments, the data lookup module is further to: searching data with the storage size smaller than or equal to the alignment filling address interval of the current data from the current data sequence according to the sequence from front to back; if so, determining the searched data as target data which accords with the alignment filling address interval of the current data.
In some embodiments, the data storage device further includes a condition satisfaction determination module for determining an alignment fill address interval for the current data based on a current starting storage address and an address alignment condition for the current data; and under the condition that the alignment filling address interval does not meet the address interval requirement, determining that the current initial storage address does not meet the address alignment condition of the current data.
In some embodiments, the data storage device is further configured to: and if the filling data is removed from the current data sequence, after the current initial storage address is updated, the current initial storage address does not meet the address alignment condition of the current data, returning to the step of searching the filling data which meets the alignment filling address interval of the current data and meets the address alignment condition when the current initial storage address is stored from the current data sequence according to the sequence from front to back.
In some embodiments, the data storage device is further configured to: if the filling data is not found, updating the current initial storage address to the current aligned storage address, and storing the current data from the current initial storage address; and removing the current data from the current data sequence, updating the current initial storage address, and returning to the step of determining the current data from the current data sequence according to the sequence from front to back.
In some embodiments, the data storage device is further configured to: and under the condition that the target data which accords with the alignment filling address interval of the current data is not found or the current initial storage address does not meet the address alignment condition of each searched target data, determining that the filling data is not found.
In some embodiments, the data storage device is further configured to: storing the current data from the current initial storage address under the condition that the current initial storage address meets the address alignment condition of the current data; and removing the current data from the current data sequence, updating the current initial storage address, and returning to the step of determining the current data from the current data sequence according to the sequence from front to back.
In some embodiments, the data storage device is further configured to: acquiring each constant data in a target program, and counting the reading frequency corresponding to each constant data; arranging the obtained constant data according to the sequence from high to low of the reading frequency, and determining the constant sequence obtained by arrangement as a current data sequence; determining a constant table initial storage address of a constant table corresponding to the target program as a current initial storage address;
the data storage module is further configured to: storing the current constant data into the constant table from the current initial storage address to compile the constant data in the target program based on the constant table.
In some embodiments, the data storage module is further to: storing current constant data into the constant table from a current start memory address, and determining the current start memory address as a start memory address of the current constant data in the constant table; and establishing an address corresponding relation between the current constant data and a starting storage address of the current constant data in the constant table.
In some embodiments, the data storage module is further to: determining an initial storage address of constant data in the constant table based on the address correspondence of the constant data in the target program; and reading the constant data based on the initial storage address of the constant data in the constant table, and compiling the read constant data.
On the other hand, the application also provides computer equipment. The computer device comprises a memory storing a computer program and a processor implementing the steps of the data storage method described above when the processor executes the computer program.
In another aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the data storage method described above.
In another aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of the data storage method described above.
The above data storage method, apparatus, computer device, storage medium, and computer program product, determining current data from a current data sequence in a front-to-back order; the data in the current data sequence are arranged according to the reading frequency; under the condition that the current initial storage address does not meet the address alignment condition of the current data, searching the alignment filling address interval which accords with the current data from the current data sequence according to the sequence from front to back, and meeting the filling data of the address alignment condition when the current initial storage address is stored; aligning and filling address intervals, wherein the interval between a current aligned storage address and a current initial storage address is the interval between the current aligned storage address and the current initial storage address, and the current aligned storage address is an idle storage address which is nearest to the current initial storage address and accords with the address alignment condition of current data; if the filling data is found, storing the filling data from the current initial storage address, removing the filling data from the current data sequence, and updating the current initial storage address; if the current initial storage address meets the address alignment condition of the current data after updating, the current data is stored from the current initial storage address, the current data is removed from the current data sequence, the current initial storage address is updated, and the current data is determined from the current data sequence according to the sequence from front to back. Therefore, in the process of storing the data in the current data sequence according to the high-low order of the reading frequency, when the alignment filling address interval exists due to the requirement of meeting the address alignment requirement, namely, the storage area needs to be skipped (interval) due to the requirement of meeting the address alignment requirement, the data meeting the requirement after the current data is filled into the skipped (interval) storage area, so that the storage area which is separated due to the address alignment requirement is fully utilized, and the utilization rate of storage resources is improved.
Drawings
FIG. 1 is a diagram of an application environment for a data storage method in some embodiments;
FIG. 2 is a flow chart of a method of data storage in some embodiments;
FIG. 3 is a diagram of data storage effects in some embodiments;
FIG. 4 is a diagram of data storage effects in some embodiments;
FIG. 5 is a diagram of data storage effects in some embodiments;
FIG. 6 is a diagram of data storage effects in some embodiments;
FIG. 7 is a flow chart of a method of data storage in some embodiments;
FIG. 8 is a block diagram of the structure of a data storage device in some embodiments;
FIG. 9 is an internal block diagram of a computer device in some embodiments;
FIG. 10 is an internal block diagram of a computer device in some embodiments.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The data storage method provided by the embodiment of the application can be applied to an application environment shown in figure 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on the cloud or other servers.
Specifically, a compiler may be installed on the terminal 102, and the terminal 102 may further include a source program, where the compiler is configured to compile the source program. The terminal 102 may obtain each constant in the source program through the compiler, form each obtained constant into a constant set, arrange the constants in the constant set according to the reading frequency of the constant in the source program to obtain a constant sequence, determine the constant sequence as a current data sequence, in the case that the current initial storage address does not meet the address alignment requirement of the current data, search the current data sequence for the aligned padding address interval conforming to the current data and the padding data meeting the address alignment condition when the current initial storage address is stored according to the front-to-back order, align the padding address interval, be the interval between the current aligned storage address and the current initial storage address, the current aligned storage address be the idle storage address closest to the current initial storage address and conforming to the address alignment condition of the current data, if the padding data is found, storing the padding data from the current starting storage address and removing the padding data from the current data sequence, updating the current starting storage address, if the current starting storage address after the updating meets the address alignment condition of the current data, storing the current data from the current starting storage address and removing the current data from the current data set, updating the current starting storage address, returning to the step of determining the current data from the current data sequence according to the sequence from front to back, thereby storing each constant in the source program, and arranging the stored constants as a whole according to the reading frequency, and in the process of storing the current data, when an alignment padding address interval exists due to the need to meet the address alignment requirement, when the current data is required to be stored at a position which is spaced from the current initial storage address by the alignment filling address, the data which is required to be met after the current data is filled into the spaced storage area, so that the storage area which is required to be spaced due to the address alignment is fully utilized, the utilization rate of storage resources is improved, the stored constants are enabled to have the effect of being arranged according to the frequency, the storage of the data with higher reading frequency presents an aggregation effect, and the reading efficiency of the stored data is improved.
When compiling the constant in the source program, the terminal 102 may read the constant from the storage space storing the constant, so as to compile the constant and obtain the executable file. The terminal 102 may send the generated executable file to the server 104, and the server 104 may store the executable file or send the executable file to other devices.
The terminal 102 may be, but not limited to, various desktop computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligence platforms, and the like. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein.
Cloud storage (cloud storage) is a new concept that extends and develops in the concept of cloud computing, and a distributed cloud storage system (hereinafter referred to as a storage system for short) refers to a storage system that integrates a large number of storage devices (storage devices are also referred to as storage nodes) of various types in a network to work cooperatively through application software or application interfaces through functions such as cluster application, grid technology, and a distributed storage file system, so as to provide data storage and service access functions for the outside.
In some embodiments, as shown in fig. 2, a data storage method is provided, which may be executed by a terminal or a server, or may be executed by the terminal and the server together, where the method is applied to the terminal 102 in fig. 1, and is described as an example, and includes the following steps:
step 202, determining current data from a current data sequence according to the sequence from front to back; the data in the current data sequence are arranged according to the reading frequency.
Wherein the data may be any data type of data. The data type includes, but is not limited to, at least one of integer (int), single precision floating point type (float), long (long integer data type), double precision floating point type (double), etc.
The data in the current data sequence is the data that needs to be stored, and the current data sequence may be changed continuously, for example, after storing a certain data in the current data sequence, the data is deleted from the current data sequence, so that the data in the current data sequence is reduced continuously.
The data in the current data sequence may be arranged in order of reading frequency from high to low, for example, the current data sequence is {1.0,3.0,2.0}, the reading frequency of data "1.0" is greater than the reading frequency of data "3.0", and the reading frequency of data "3.0" is greater than the reading frequency of data "2.0". Of course, the data in the current data sequence may be arranged in order of the reading frequency from low to high.
The reading frequency of the data characterizes the number of times the data is read, and the greater the number of times the data is read, the greater the reading frequency. For example, the data in the current data sequence may be constants in the source program. The read frequency of a constant may be characterized by the number of times the constant is accessed in the source program, the greater the read frequency that represents the constant. The read frequency may also be referred to as the frequency being accessed. For example, the source program includes a constant "1.0" and "2.0", the number of times the constant "1.0" is accessed in the source program is 10000, and the number of times the constant "2.0" is accessed in the source program is 10, and then it is possible to determine that the reading frequency of the constant "1.0" is 10000, and determine that the reading frequency of the constant "2.0" is 10. Where a constant refers to a fixed number of operands or parameters in the program. Constants may also be referred to as constant data. A source program refers to an uncompiled text file written according to a certain programming language specification, and is a series of human-readable computer language instructions.
The compiling may be implemented by a compiler, which is the core of a dynamic compiling system, which may be a system in a virtual machine. A Virtual Machine (VM) virtualizes a computer mainly by a software (or assisted with a small amount of hardware support) method, and the Virtual instruction set supported by the computer is a Virtual Machine instruction set. The virtual machine relies on a local physical machine, and simulation execution is performed on the local machine on a given virtual machine instruction sequence through an execution engine of the virtual machine. The execution engine of the virtual machine includes an interpreter. The interpreter takes instructions, instruction dispatch, operand fetching and execution in units of one virtual machine instruction. Dynamic compilation systems may also be incorporated into virtual machines. The compiler compiles the native CPU (central processing unit ) instruction sequence in units of a set of consecutive virtual machine instruction sequences (basic blocks, functions or methods), called a native method, and then directly executes the compiled native method by hardware. The compiler has higher performance than the interpreter because it eliminates the repeated instruction fetching and instruction dispatching processes, and optimizes at the time of translation. Since the compiler is dynamically compiled during the running of the program, the compiler may also be referred to as a dynamic compiler.
Specifically, the terminal may determine the current data from the current data sequence in the order from front to back, and may select one current data at a time, that is, the terminal may determine the first data in the current data sequence as the current data, where the first data refers to the data arranged in the first bit in the current data sequence. Since the data in the current data sequence is arranged according to the reading frequency, when the current data sequence is arranged according to the order of the reading frequency from high to low, the current data is the data with the highest reading frequency in the current data sequence, and when the current data sequence is arranged according to the order of the reading frequency from low to high, the current data is the data with the lowest reading frequency in the current data sequence. Thus, when data is stored, the data is stored in the storage space according to the read frequency. The storage space includes, but is not limited to, at least one of memory, cache, disk, etc.
In some embodiments, the current data sequence may be determined according to constants in the source program, for example, the terminal may acquire the constants in the source program during compiling the source program, form a constant set, and arrange the constants in the constant set according to the reading frequency, for example, from high to low according to the reading frequency, or from low to high according to the reading frequency, so as to obtain the constant sequence. When the constants in the constant set are stored, the constant sequence is determined as an initial current data sequence, and current data is determined from the current data sequence according to the order of the reading frequency so as to store the current data in the storage space.
Step 204, searching for the aligned filling address interval which accords with the current data from the current data sequence according to the sequence from front to back under the condition that the current initial storage address does not meet the address alignment condition of the current data, and filling data which meets the address alignment condition when the current initial storage address is stored; the address interval is filled in, the interval between the current aligned storage address and the current initial storage address is used as the current aligned storage address, and the current aligned storage address is the idle storage address which is nearest to the current initial storage address and accords with the address alignment condition of the current data.
The storage address is used for identifying a storage unit in a storage space, the storage space comprises a plurality of storage units, the storage unit has the functions of storing data and reading and writing the data, and the function of reading and writing the data refers to the function of writing the data into the storage unit and the function of reading the data from the storage unit.
Each memory cell corresponds to a memory address, and the memory addresses of different memory cells are different. The unit of the memory address may be bytes (Byte), for example, the memory address is 0x1000000 (bytes), and 0x1000000 is data expressed in hexadecimal form. The storage addresses of the storage units are determined according to the positions of the storage units in the storage space, the storage space can be understood as a storage unit sequence formed by sequentially arranging a plurality of storage units, the storage addresses of the storage units are sequentially increased, and the storage addresses are smaller when the arrangement is earlier, for example, when the storage capacity of the storage units is 1 byte, the storage addresses can be sequentially increased by taking a single byte as an increment, the single byte refers to one byte, for example, for a block storage area in the storage space, the storage area comprises 5 storage units, the 5 storage units are sequentially arranged in the storage area, the storage address of the first storage unit in the storage area is 0x1000000, and the storage address of the ith storage unit is 0x1000000+i, and i is any one of 2,3,4 and 5. The storage capacity refers to the storage size of a storage unit, and the unit of the storage capacity may be a byte, for example, if the storage capacity of the storage unit is 1 byte, it means that the storage size of the storage unit is 1 byte.
The current start memory address refers to a memory address of a start when data is currently stored, and the current start memory address is changed, for example, may be increased, for example, the current start memory address is 0x1000000 (bytes), and when data with a memory size of 4 bytes is stored from the current start memory address, the current start memory address is changed to 0x 1000000+4=0x1000004 (bytes) after the data is stored. The storage size of data refers to the size of storage resources that need to be occupied to store the data.
The initial current initial storage address can be designated or preset according to needs, for example, the data storage method provided by the application can be applied to a scene of compiling a source program, in the scene, the initial current data sequence can be a constant sequence, the initial current initial storage address can be the initial storage address of a constant table in a storage space, and the constant table (constant table) is used for assisting a compiler to compile constants and is a table structure consisting of the constants. Wherein the compiler is used to automatically convert the source program into a program of target machine instructions, the process of converting is called "compiling". The compiler includes a dynamic compiler and a static compiler. A dynamic compiler refers to a compiler that compiles during program execution, and so a dynamic compiler may also be referred to as a JIT (just-in-time) compiler. Static compiler means a compiler that compiles before the program runs, including but Not limited to gcc (GNU Compiler Collection) compiler, GNU is a free operating system named from GNU's Not Unix-! Is a recursive abbreviation of (c).
To support hardware efficient access to data in a storage space, such as a memory, the starting memory address of the constant table in the storage space may be address aligned conditions including the starting memory address being divided by a first preset pair Ji Da by a whole, that is, the starting memory address of the constant table in the storage space is an integer multiple of a first preset alignment size including, but not limited to, any one of 4 bytes, 8 bytes, 32 bytes, or 64 sections. For example, when the first preset pair Ji Daxiao is 32 bytes, the storage address 0x1000000 may be designated as the start storage address of the constant table in the storage space, the constant is stored from the start storage address, and the start storage address of the stored constant in the storage space is recorded. In order to support efficient hardware access to data in memory, the data needs to be stored according to certain constraints. In general, if the starting memory address at which data is stored is divisible by the size of the data (in bytes), the data is stored as address aligned, otherwise address unaligned
Each data may correspond to an address alignment condition, which may include the storage address divided by a second preset pair Ji Da, which may include, but is not limited to, any of 4 bytes, 8 bytes, 32 bytes, or 64 bytes, and the first preset pair Ji Daxiao may be the same or different from the second preset pair. The second preset alignment size may be determined according to a storage size of the current data, for example, the second preset alignment size may be equal to the storage size of the current data, where the storage size of the current data refers to a number of storage units required for storing the current data, for example, a storage capacity of each storage unit is 1 byte, and the storage size of the current data is 4 bytes, which indicates that 4 storage units are required for storing the current data. If the storage address is divided by the second designated storage address, determining that the current data stored from the storage address meets the address alignment condition, otherwise, determining that the current data stored from the storage address does not meet the address alignment condition.
Under the condition that the current initial storage address does not meet the address alignment condition of the current data, the current data corresponds to an alignment filling address interval, the alignment filling address interval is an interval between the current alignment storage address and the current initial storage address, and the current alignment storage address is a free storage address which is nearest to the current initial storage address and meets the address alignment condition of the current data. Since data is stored in the direction in which the memory address increases, the current aligned memory address can also be understood as: in the direction in which the memory address increases, the memory address is the memory address closest to the current starting memory address and which meets the address alignment condition of the current data. The data conforming to the alignment fill address interval of the current data may be data having a memory size less than or equal to the alignment fill address interval. In the case where the current start storage address satisfies the address alignment condition of the current data, if the current data is stored from the current start storage address, the storage of the current data is address aligned. For example, if the current data is 3.0,1.0 and the storage size is 8 bytes, the address alignment condition of 3.0 is an integer multiple of the current start storage address of 8 bytes, the current start storage address is 0x1000004, since the current start storage address 0x1000000 does not meet the address alignment condition of 3.0, and the storage address nearest to 0x1000004 and being an integer multiple of 8 is 0x1000008, the current data corresponds to an interval between 0x1000008 and 0x1000004, i.e., 4 bytes, and if 0x1000000 to 0x1000003 stores 1.0 of 4 bytes, the area corresponding to the aligned pad address interval is as the diagonal area in fig. 3.
The padding data is data which accords with the alignment padding address interval of the current data in the current data sequence and satisfies the address alignment condition when the current initial storage address is stored. The address alignment condition is satisfied when the current starting memory address is stored, which means that the current starting memory address satisfies the address alignment condition of the padding data. For example, data "2.0" conforms to the aligned pad address interval of the current data, and the current starting memory address satisfies the address alignment condition of data "2.0", then data "2.0" belongs to the pad data.
Specifically, the terminal may determine whether the current initial storage address satisfies the address alignment condition of the current data, and if not, search, in the sequence from front to back, for the aligned filler address interval that matches the current data, and if so, the filler data that satisfies the address alignment condition when the current initial storage address is stored.
In some embodiments, the address alignment condition of the current data may include the storage address being divided by a second preset pair Ji Da by a whole, the second preset alignment size including, but not limited to, any of 4 bytes, 8 bytes, 32 bytes, or 64 sections. The terminal may determine an alignment fill address interval of the current data based on the current starting memory address and an address alignment condition of the current data. Specifically, the terminal may calculate a remainder obtained by dividing the current start memory address by the second preset alignment size, calculate a difference between the second preset pair Ji Da and the obtained remainder, and calculate a remainder obtained by dividing the difference by the second preset alignment size, and determine the remainder as the alignment fill address interval of the current data. For example, the alignment pad address interval may be calculated using the formula pad= (align- (cur% align))%align, where pad represents the alignment pad address interval, align represents a second preset alignment size, and cur represents the current starting memory address. For example, when the current initial storage address is 0x1000004 and the second preset pair Ji Da is 8 bytes, the terminal may calculate using the formula padding= (8- (0 x 1000004%8))%8=4, and determine that the aligned pad address interval corresponding to the current data is 4 bytes. The storage area corresponding to the aligned fill address interval corresponding to the current data may be referred to as an aligned fill space, and the aligned fill address interval may also be referred to as an aligned fill space size.
In some embodiments, the terminal may determine whether the current starting memory address satisfies an address alignment condition of the current data based on the alignment fill address interval of the current data. Specifically, under the condition that the alignment filling address interval of the current data is 0, determining that the current initial storage address meets the address alignment condition of the current data, otherwise, determining that the current initial storage address does not meet the address alignment condition of the current data.
In some embodiments, the terminal may search for data in accordance with the aligned fill address interval of the current data from the current data sequence in the order from front to back, and when searching, determine whether the current initial storage address satisfies the address alignment condition of the searched data, if yes, determine the searched data as the fill data, and if not, continue searching for the next data in accordance with the aligned fill address interval of the current data from the current data sequence.
In some embodiments, since the current data is determined from the current data sequence in a front-to-back order, the current data is the first data in the current data sequence, and thus when searching for filler data from the current data sequence, the search may be started from the data arranged in the second bit in the current data sequence. Specifically, the terminal may determine whether the second data in the current data sequence is padding data, and if not, then determine whether the next data is padding data. When judging whether the data is the padding data, whether the data accords with the alignment padding address interval of the current data or not can be judged first, and if so, whether the address alignment condition is met when the current initial storage address stores the data or not (namely, whether the current initial storage address meets the address alignment condition of the data or not) is judged. Or, whether the address alignment condition is satisfied when the current initial storage address stores the data can be judged first, and whether the data accords with the alignment filling address interval of the current data can be judged again when the address alignment condition is satisfied. Alternatively, it may be determined simultaneously whether the alignment fill address interval of the current data is met and whether the address alignment condition is satisfied at the time of the current start memory address storage.
If the padding data is found, the padding data is stored from the current starting storage address, and removed from the current data sequence, and the current starting storage address is updated, step 206.
Specifically, if the padding data is found, the terminal determines the current start storage address as the start storage address of the padding data, and stores the padding data in a storage area with a storage capacity equal to the storage size of the padding data from the current start storage address. For example, if the storage size of the padding data is 4 bytes and the current initial storage address is 0x1000004, the padding data is padded into the storage area identified by the storage addresses 0x1000004 to 0x 1000007.
In some embodiments, after storing the padding data, the terminal may remove the padding data from the current data sequence, thereby completing the update of the current data sequence, e.g., the current data sequence is {3.0,2.0,4.0}, the padding data is 2.0, then 2.0 is removed from {3.0,2.0,4.0}, and the current data sequence is updated to {3.0,4.0}.
In some embodiments, after storing the padding data, the terminal updates the current initial storage address, specifically, the terminal calculates the current initial storage address before updating and performs a summation operation with the storage size of the padding data, and determines the result of the summation operation as the updated current initial storage address, thereby implementing updating of the current initial storage address, for example, the current initial storage address before updating is 0x1000004, the storage size of the padding data is 4 bytes, and then the current initial storage address is updated to 0x1000004+4=0x 1000008.
In some embodiments, after storing the padding data, before updating the current start storage address, the terminal may determine the current start storage address as the start storage address of the padding data in the storage space, and store the padding data corresponding to the start storage address of the padding data in the storage space.
Step 208, if the current initial storage address meets the address alignment requirement of the current data after updating, storing the current data from the current initial storage address, removing the current data from the current data sequence, updating the current initial storage address, and returning to the step of determining the current data from the current data sequence according to the sequence from front to back.
Specifically, after updating the current initial storage address, the terminal may determine whether the current initial storage address meets an address alignment requirement of the current data, and if so, store the current data from the current initial storage address, and remove the current data from the current data sequence, so as to complete updating of the current data sequence. As described above, the current data sequence is updated to {3.0,4.0} after the padding data is removed, the current start storage address is updated to 0x1000004+4=0x 1000008, the current data is 3.0,3.0 in {3.0,4.0} to be 8 bytes, and since 0x1000008 satisfies the address alignment condition of the current data, 3.0 can be stored from 0x 1000008.
In some embodiments, after storing the current data, the terminal updates the current starting storage address, specifically, the terminal calculates the current starting storage address before updating and performs a summation operation with the storage size of the current data, and determines the result of the summation operation as the updated current starting storage address, thereby implementing updating of the current starting storage address, for example, the current starting storage address before updating is 0x1000008, the storage size of the current data is 8 bytes, and then the current starting storage address is updated to 0x1000008+8=0x 1000010.
In some embodiments, after storing the current data, the terminal may remove the current data from the current data sequence to complete the update of the current data sequence, e.g., 3.0 in {3.0,4.0}, 3.0 from {3.0,4.0}, to update the current data sequence to {4.0}.
In some embodiments, after storing the current data, before updating the current start storage address, the terminal may determine the current start storage address as the start storage address of the current data in the storage space, and store the current data corresponding to the start storage address of the current data in the storage space.
In some embodiments, after updating the current data sequence and updating the current starting memory address, the terminal further includes data in the current data sequence, and the step of determining the current data from the current data sequence is performed in a front-to-back order.
The current data sequence is a constant sequence {1.0,3.0,2.0,4.0} exemplified by {1.0,3.0,2.0,4.0} which is a sequence obtained by arranging the constant sequences according to the reading frequency, a constant table can be constructed by storing the constant sequences in the memory, the storage size of 1.0 is 4 bytes, the storage size of 3.0 is 8 bytes, the storage size of 2.0 is 4 bytes, the storage size of 4.0 is 8 bytes, the address alignment conditions of 1.0,3.0,2.0, and 4.0 are integer multiples of the current start storage address, for example, the address alignment condition of 1.0 is integer multiples of the current start storage address of 4 bytes. If the current initial storage address is 0x1000000, first, it is determined that the current data is 1.0, since 0x1000000 is an integer multiple of 4, 0x1000000 satisfies an address alignment condition of 1.0, 1.0 is stored to a position of 0x1000000 to 0x1000003, 1.0 is removed from the current data sequence, the new current data sequence is {3.0,2.0,4.0}, the current initial storage address is updated to 0x100004, and it is determined that the new current data is 3.0, since 0x1000004 is not an integer multiple of 8, but a storage address which is closest to 0x1000004 and is an integer multiple of 8 is 0x1000008, an alignment filling address interval of the current data is 4 bytes, if 3.0 is directly stored, it is required to be stored from 0x1000008, so that an area of 0x1000004-0x1000007 is wasted, and 0x1000004-0x1000007 is an alignment filling area corresponding to the alignment filling address interval, as shown in fig. 4, a memory table is built up simply according to the order of the read-out frequency in the front. It can be seen from the figure that 8 bytes of memory are wasted. In the present application, 3.0 is not directly stored. But searches for padding data that can be stored in the area of 0x1000004-0x1000007 from data that is not yet stored after 3.0, since the storage size of 2.0 is an integer multiple of less than the aligned padding address interval (4 bytes) of the current data, and 0x1000004 is 4, 0x1000004 meets the address alignment condition of 2.0, 2.0 is taken as padding data, since the storage size of 2.0 is 4 bytes, which is just equal to the aligned padding address interval (4 bytes) of the current data, 2.0 is stored in the area of 0x1000004 to 0x1000007, and the current address is updated to 0x1000008, 2.0 is removed from the current data sequence {3.0,2.0,4.0} to obtain a new current data sequence {3.0,4.0}, then the current data is updated to 3.0, since 0x1000008 is an integer multiple of 8, 3.0 is stored in the area of 0x1000008 to 0x100000F, and the current data is stored in the area of 0x 100043 to 0x100000F, and the current address { 52.52 is not shown in the whole number of 0.01748, and the current data sequence { 52.48 is removed from the current data sequence { 52.52 } is a constant value of 3.0. As can be seen by comparing fig. 4 and fig. 5, the waste of storage resources caused by alignment filling is reduced in fig. 5, and the utilization rate of the storage resources is improved.
In the data storage method, the current data is determined from the current data sequence according to the sequence from front to back; and searching for the filling data which meets the alignment filling address interval of the current data and meets the address alignment condition when the current initial storage address is stored in the current data sequence according to the sequence from front to back under the condition that the current initial storage address does not meet the address alignment condition of the current data, storing the filling data from the current initial storage address and removing the filling data from the current data sequence if the filling data is searched, updating the current initial storage address, storing the current data from the current initial storage address and removing the current data from the current data sequence if the current initial storage address meets the address alignment condition of the current data after updating, updating the current initial storage address, and returning to the step of determining the current data from the current data sequence according to the sequence from front to back. Since the interval between the current aligned storage address and the current initial storage address is the interval between the current aligned storage address and the current initial storage address, and the current aligned storage address is the free storage address which is nearest to the current initial storage address and meets the address alignment condition of the current data, if the current data is directly stored, the storage area corresponding to the aligned filling address interval needs to be stored at the storage address which is spaced from the current initial storage address interval, and the filling data is stored before the current data is stored, so that the waste of storage resources can be reduced, namely, in the process of storing the data in the current data sequence according to the high-low order of the reading frequency, when the aligned filling address interval exists, namely, in the case that the storage space needs to be skipped due to the fact that the address alignment requirement needs to be met, the data meeting the requirement after the current data is filled into the storage area which needs to be skipped (interval), and the utilization rate of the storage resources is improved while the data is mainly stored according to the high-low frequency of the reading. And the data is mainly stored according to the reading frequency, so that the data with higher reading frequency is stored in an aggregation manner, and the data reading efficiency is improved.
Of course, the data may be stored in a storage size, for example, if it is desired to store 1.0,2.0,3.0,4.0 of 4 constants, wherein 1.0 is accessed at 10000,3.0, 1000,2.0 is accessed at 10,4.0, 1,1.0 is accessed at 4 bytes, 2.0 is stored at 4 bytes, 3.0 is stored at 8 bytes, and 4.0 is stored at 8 bytes. If the data are stored in order of the storage size from large to small, the stored effect diagram is shown in fig. 6. However, this approach mixes the high frequency constant with the low frequency constant, and has no aggregation effect, resulting in lower data reading efficiency.
In some embodiments, looking up padding data from the current data sequence that matches the aligned padding address interval of the current data and satisfies the address alignment condition when the current starting memory address is stored in a front-to-back order includes: searching target data which accords with the alignment filling address interval of the current data from the current data sequence according to the sequence from front to back; and under the condition that the target data is found, if the current initial storage address meets the address alignment condition of the target data, determining the target data as filling data.
The target data are data which are searched from the current data sequence according to the sequence from front to back and are aligned with the current data to fill the address interval. Since the current data is determined from the current data sequence in the order from front to back, the current data is the first data in the current data sequence, so that when the padding data is searched from the current data sequence, the searching can be started from the data arranged in the second bit in the current data sequence.
Specifically, under the condition that the terminal finds out the target data, the terminal judges whether the current initial storage address meets the address alignment condition of the target data, and if the current initial storage address meets the address alignment condition of the target data, the terminal determines the target data as the filling data.
In some embodiments, the terminal compares the storage size of the second bit of data in the current data sequence with the alignment fill address interval of the current data, determines the data as target data if the storage size of the data is equal to or smaller than the alignment fill address interval of the current data, and otherwise compares the storage size of the next bit of data in the current data sequence with the alignment fill address interval of the current data until the target data is obtained or remains unseen if the data in the current data sequence is traversed.
In this embodiment, the target data corresponding to the aligned filling address interval of the current data is searched from the current data sequence in the order from front to back, if the current initial storage address meets the address alignment condition of the target data in the case of searching the target data, the target data is determined to be the filling data, so that only if the target data is searched, whether the address alignment condition is met is determined, the number of times of determining whether the address alignment condition is met is reduced, and time and computer resources are saved.
In some embodiments, looking up target data from the current data sequence that corresponds to the aligned fill address interval of the current data in a front-to-back order includes: searching data with the storage size smaller than or equal to the alignment filling address interval of the current data from the current data sequence according to the sequence from front to back; if so, determining the searched data as target data which accords with the alignment filling address interval of the current data.
Specifically, the terminal may compare the storage size of the data with the alignment fill address interval of the current data starting from the data of the second bit of the current data sequence, and determine the data as the target data in the case that the storage size of the data is less than or equal to the alignment fill address interval of the current data.
In this embodiment, the data with the storage size smaller than or equal to the alignment filling address interval of the current data is searched from the current data sequence in the order from front to back, if the data is searched, the searched data is determined to be the target data which accords with the alignment filling address interval of the current data, so that not only is the current initial storage address ensured to meet the address alignment requirement of the filling data, but also the storage size of the filling data is ensured to be smaller than or equal to the alignment filling address interval of the current data, so that the filling data is ensured to be stored in the storage area corresponding to the alignment filling address interval of the current data, and the filling data is substantially stored in the skipped storage area when the current data is stored in the process of storing the filling data, thereby reducing the waste of storage resources and improving the utilization rate of the storage resources.
In some embodiments, the step of determining that the current starting memory address does not satisfy the address alignment condition for the current data is as follows: determining an alignment filling address interval of the current data based on the current initial storage address and an address alignment condition of the current data; and under the condition that the alignment filling address interval does not meet the address interval requirement, determining that the current initial storage address does not meet the address alignment condition of the current data.
Wherein the address alignment condition of the current data includes the storage address being divided by the second preset pair Ji Da by a small integer. Address interval requirements include alignment fill address interval equal to 0.
Specifically, the terminal may determine a second preset alignment size based on an address alignment condition of the current data, calculate a remainder obtained by dividing the current start storage address by the second preset alignment size, calculate a difference between the second preset pair Ji Da small and the obtained remainder, and determine the calculated difference as an alignment fill address interval of the current data.
In some embodiments, the terminal may compare the alignment filling address interval of the current data with 0, and if the alignment filling address interval of the current data is the same as 0, determine that the current starting storage address meets the address alignment condition of the current data, and otherwise determine that the current starting storage address does not meet the address alignment condition of the current data.
In this embodiment, based on the current initial storage address and the address alignment condition of the current data, the alignment filling address interval of the current data is determined, and under the condition that the alignment filling address interval does not meet the address interval requirement, it is determined that the current initial storage address does not meet the address alignment condition of the current data, thereby rapidly determining whether the current initial storage address meets the address alignment condition of the current data, and improving the computing efficiency.
In some embodiments, the method further comprises: if the filling data is removed from the current data sequence, after the current initial storage address is updated, the current initial storage address does not meet the address alignment condition of the current data, returning to the step of searching the filling data which meets the alignment filling address interval of the current data and meets the address alignment condition when the current initial storage address is stored from the current data sequence according to the sequence from front to back.
Specifically, if the current initial storage address still does not meet the address alignment condition of the current data after the padding data is removed from the current data sequence and the current initial storage address is updated, the aligned padding address interval of the current data may be determined again based on the current initial storage address and the address alignment condition of the current data, the padding data may be searched again, and the searched padding data may be padded into the memory area corresponding to the aligned padding address interval of the current data. Since the first data of the current data sequence is still the current data after the padding data is removed from the current data sequence, the searching can be started from the second bit data of the updated current data sequence when the padding data is searched again.
It should be noted that, as the padding data is stored, the aligned padding address interval of the current data is continuously reduced, that is, after each time the padding data is stored, the aligned padding address interval of the current data needs to be determined again according to the latest current initial storage address.
In this embodiment, if the current initial storage address does not satisfy the address alignment condition of the current data after the padding data is removed from the current data sequence and the current initial storage address is updated, the step of searching the padding data which conforms to the alignment padding address interval of the current data and satisfies the address alignment condition when the current initial storage address is stored in the current data sequence is returned according to the sequence from front to back, so that the padding data can be searched for multiple times before the current initial storage address is updated to the storage address which satisfies the address alignment condition of the current data, so as to fill as many storage areas which need to be skipped when the current data is stored due to the address alignment requirement of the current data, thereby reducing the waste of storage resources and improving the utilization ratio of the storage resources.
In some embodiments, the method further comprises: if the filling data is not found, updating the current initial storage address to the current aligned storage address, and storing the current data from the current initial storage address; the current data is removed from the current data sequence and the current starting memory address is updated, returning to the step of determining the current data from the current data sequence in a front-to-back order.
Specifically, the terminal may determine the current aligned storage address based on the current starting storage address and the aligned fill address interval of the current data. The terminal can increase the alignment filling address interval of the current data on the basis of the current initial storage address to obtain the current alignment storage address, and the terminal can perform summation operation on the current initial storage address and the alignment filling address interval of the current data, and determine the result of the summation operation as the current alignment storage address.
In some embodiments, after obtaining the current aligned storage address, the terminal updates the current start storage address to the current aligned storage address, stores the current data from the current start storage address after updating, and removes the current data from the current data sequence.
In some embodiments, after storing the current data and updating the current start memory address to the current aligned memory address, the terminal may update the current start memory address based on the memory size of the current data, specifically, the terminal may perform a summation operation on the current start memory address and the memory size of the current data to obtain a summation operation address, update the current start memory address to the summation operation address, and after updating, continue to store the data in the current data sequence, thereby returning to the step of determining the current data from the current data sequence in the order from front to back.
In some embodiments, the stored data is removed from the current data sequence after the data in the current data sequence is stored, so that the data in the current data sequence is continuously reduced until the data is reduced without any data. Therefore, before returning to the step of determining the current data from the current data sequence in the front-to-rear order, the terminal may determine whether there is any data in the current data sequence, and in the case of determining that there is data in the current data sequence, return to the step of determining the current data from the current data sequence in the front-to-rear order. In the event that it is determined that no data is present in the current data sequence, it is determined that the storing of the data is completed.
In this embodiment, if the padding data is not found, the current initial storage address is updated to the current aligned storage address, the current data is stored from the current initial storage address, the current data is removed from the current data sequence, the current initial storage address is updated, and the step of determining the current data from the current data sequence in the order from front to back is returned. And when the filling data is not found, storing the current data from the storage address meeting the address alignment requirement of the current data, thereby ensuring that the current data is stored in the address alignment.
In some embodiments, the method further comprises: and determining that the filling data is not found under the condition that the target data which accords with the alignment filling address interval of the current data is not found or the current initial storage address does not meet the address alignment condition of each target data which is found.
Specifically, in the case that the target data of the aligned pad address interval conforming to the current data is not found, the terminal determines that the pad data is not found.
In some embodiments, if for each target data found, the current starting storage address does not satisfy the address alignment condition for that target data, then it is determined that filler data has not been found.
In this embodiment, under the condition that the target data conforming to the aligned filling address interval of the current data is not found or the current initial storage address does not meet the address alignment condition of each found target data, it is determined that the filling data is not found, so that the filling data conforms to the aligned filling address interval of the current data, the current initial storage address meets the address alignment condition of the filling data, and the accuracy of data searching is improved.
In some embodiments, the method further comprises: storing the current data from the current initial storage address under the condition that the current initial storage address meets the address alignment condition of the current data; the current data is removed from the current data sequence and the current starting memory address is updated, returning to the step of determining the current data from the current data sequence in a front-to-back order.
Specifically, under the condition that the current initial storage address meets the address alignment condition of the current data, the current data is stored from the current initial storage address, and because the data in the current data sequence is arranged according to the reading frequency, and the current data is determined from the current data sequence according to the sequence from front to back, the current data is the first data in the current data sequence, namely the data with the highest reading frequency or the data with the lowest reading frequency, so that under the condition that the current initial storage address meets the address alignment condition of the current data, the current data is stored from the current initial storage address, the effect of storing the data according to the sequence of the reading frequency can be realized on the whole, the data with higher reading frequency can be stored together as much as possible, the locality of the access storage space is enhanced, and the efficiency of reading the data in the storage space is improved.
In this embodiment, when the current initial storage address satisfies the address alignment condition of the current data, the current data is stored from the current initial storage address; the current data is removed from the current data sequence, the current initial storage address is updated, and the step of determining the current data from the current data sequence according to the sequence from front to back is returned, so that the efficiency of reading the data in the storage space is improved.
In some embodiments, the current data is current constant data; the determining of the current data from the current data sequence further comprises, in a front-to-back order: acquiring each constant data in the target program, and counting the reading frequency corresponding to each constant data respectively; arranging the obtained constant data according to the sequence from high to low of the reading frequency, and determining the constant sequence obtained by arrangement as a current data sequence; determining a constant table initial storage address of a constant table corresponding to the target program as a current initial storage address; storing the current data from the current starting memory address includes: the current constant data is stored in the constant table from the current start memory address to compile the constant data in the target program based on the constant table.
The target program may be any source program, and the constant data may be simply called constant. A constant refers to a fixed number of operands or parameters in the program. The constant table is for storing constant data in the target program. The constant table start memory address refers to the start memory address of the constant table in the memory space, i.e., constant data in the target program is stored from the constant table start memory address. The compilation of constants is an important element of compiler design and implementation, and constant tables are the core components used by modern compilers to support the compilation of constants.
Specifically, in order to facilitate compiling the constant data in the target program, the terminal may extract each constant data from the target program, count the number of times each constant data is accessed in the target program, determine the counted number of times as a reading frequency of the constant data, arrange each constant data in order from high to low according to the reading frequency of the constant data, and determine the sequence obtained by arrangement as the original current data sequence.
In some embodiments, in order to compile constant data in a target program, a terminal may construct a constant table corresponding to the target program, and in the process of constructing the constant table corresponding to the target program, determine a constant table start storage address, determine the constant table start storage address as a current start storage address, and store each constant data in a constant sequence from the current start storage address according to the data storage manner provided by the present application, so as to construct the constant table. After the constant table is constructed, the terminal can compile constant data in the target program based on the constructed constant table. That is, the constant used in the program is stored in the constant table in advance, the corresponding address in the constant table is recorded, and the content of the corresponding address in the constant table is directly loaded when the constant is accessed.
In this embodiment, the current constant data is stored in the constant table from the current initial storage address, so that the constant data in the target program is compiled based on the constant table, so that the constant data in the constant table is stored from high to low in overall according to the reading frequency, and the data with higher reading frequency is stored in an aggregated manner, so that the efficiency of reading the constant data in the compiling process is improved, the compiling efficiency is improved, and due to the filling effect of the filling data, the storage resources consumed by the constant table are improved, and the utilization rate of the storage resources is improved.
In some embodiments, storing the current constant data into the constant table from the current starting memory address includes: storing the current constant data into the constant table from the current initial storage address, and determining the current initial storage address as the initial storage address of the current constant data in the constant table; and establishing an address corresponding relation between the current constant data and the initial memory address of the current constant data in the constant table.
Specifically, the address correspondence is a correspondence between data and addresses. For the current constant data "1.0", if the current initial storage address is 0x1000000, the terminal may store "1.0" to the constant table from 0x1000000, determine 0x1000000 as the initial storage address of "1.0" in the constant table, and establish a correspondence between 0x1000000 and "1.0".
In this embodiment, an address correspondence between the current constant data and the initial storage address of the current constant data in the constant table is established, so that the positions of the constant data in the target program in the constant table are recorded, and the efficiency of reading the constant data from the constant table is improved.
In some embodiments, compiling constant data in the target program based on the constant table includes: determining an initial storage address of constant data in a constant table based on an address correspondence of the constant data in the target program; and reading the constant data based on the initial storage address of the constant data in the constant table, and compiling the read constant data.
Specifically, for the constant data "1.0" in the target program, if the address correspondence of the constant data "1.0" is the correspondence between the storage addresses 0x1000000 and "1.0", it can be determined that the initial storage address of the constant data "1.0" in the constant table of the target program is 0x1000000, so that the constant data "1.0" can be obtained by reading from the storage unit corresponding to 0x 1000000.
In this embodiment, based on the address correspondence of the constant data in the target program, the initial storage address of the constant data in the constant table is determined, the constant data is read based on the initial storage address of the constant data in the constant table, and the read constant data is compiled, so that the efficiency of reading the constant data from the constant table is improved.
The application also provides an application scene which is a constant compiling scene and applies the data storage method. Specifically, the method may be executed by a terminal or a server, and may also be executed by the terminal and the server together, and the method is applied to the terminal for example, and as shown in fig. 7, the scenario in which the data storage method is applied to constant compilation may include three processing procedures, namely, a constant table construction initialization phase, a constant table construction main phase and an alignment filling processing phase. The constant table construction initialization stage may include the following step 702, where the constant table construction initialization stage is used to complete the initialization preparation of the constant table construction, and the most important step is to arrange all constants to be processed into a queue (sequence) from large (high) to small (low) according to the access frequency. After the ordering, the constant of high-frequency access and the constant of low-frequency access are mutually isolated, so that the locality of constant access can be enhanced, and the constant access efficiency is improved. The constant table construction master phase includes steps 704 through 710 and steps 726 through 730, and the alignment fill process phase involves steps 712 through 724. And if the constant table construction main stage finds that additional alignment filling needs to be introduced into the constant table during execution, entering an alignment filling processing stage, and returning to the constant table construction main stage to continue execution after the alignment filling processing stage is finished. In the alignment fill processing phase, an attempt is made to find an unprocessed constant (i.e., an unprocessed constant that satisfies the constraint, for filling the additional alignment fill space that the main phase is about to introduce in the constant table construction. The alignment fill process stage may reduce the waste of additional alignment fill space, thereby reducing the storage space required by the constant volume table.
As shown in fig. 7, the application of the data storage method in the application scenario is as follows:
step 702, obtaining a constant set to be compiled in a source program and an access frequency of each constant in the constant set, arranging the constants in the constant set according to the order of the access frequency from high to low to obtain a constant sequence, determining a starting storage address of the constant table in a storage space according to an address alignment condition of the constant table, and determining the starting storage address of the constant table in the storage space as a current free address of the constant table.
The method comprises the steps that a compiler is operated in a terminal, a constant set is a constant in a source program, and the compiler on the terminal obtains the constant set to be compiled by scanning the source program. Assuming that attribute information of constants to be compiled in a source program is shown in table 1, it can be seen from table 1 that there are 4 constants. The 4 constants are 1.0,2.0,3.0 and 4.0, respectively, and the constant set is {1.0,2.0,3.0,4.0}.
TABLE 1
Both float and double in Table 1 represent data types, float represents single precision floating point numbers, and storing float type data requires 4 bytes (bytes). Double represents a Double-precision floating point number, and 8 bytes are required to store Double-type data. size refers to the number of bytes that need to be occupied to store a constant. Each constant corresponds to an align, and the constant's address alignment condition is that the starting memory address is an integer multiple of the align. The frequency of access in table 1 is expressed by the number of times of access, for example, the constant value of 1.0 is accessed 10000 times.
The compiler in the terminal can acquire the access frequency of the constant, as in table 1, constant 1.0 is accessed 10000 times, constant 2.0 is accessed 10 times, constant 3.0 is accessed 1000 times, and constant 4.0 times is accessed 1 time. For a dynamic compiler, the access frequency of the corresponding constant can be directly obtained from the virtual machine, and for a static compiler, the access frequency of the constant can be obtained in a statistical manner by executing a plurality of standard benchmark (benchmark test program) programs in advance.
For example, constants in the constant set {1.0,2.0,3.0,4.0} are arranged in accordance with the access frequency, resulting in a constant sequence c= {1.0,3.0,2.0,4.0}.
Under the condition that the access frequencies corresponding to the constants are the same, the constant can be arranged according to the size of the storage space required for storing the constants, for example, the constant is arranged from large to small, i.e. the larger the occupied storage space is, the earlier the ordering is.
For example, the address alignment condition of the constant table includes that the initial memory address of the constant table is an integer multiple of the first preset alignment size, and the initial memory address of the constant table in the memory space may be determined according to the address alignment condition of the constant table, so that the memory of the constant table is address-aligned. For example, the first preset pair Ji Daxiao is 32 bytes, the start memory address base=0x1000000, and the unit of address is byte. 0x in 0x1000000 represents 1000000 hexadecimal data, hexadecimal 0x1000000 corresponds to hexadecimal 16777216, namely, the initial storage address is the position corresponding to 16777216 bytes in the storage space, and 16777216 is an integer multiple of 32.
The compiler will normally explicitly specify an alignment attribute of the initial storage address of the constant table, where the alignment attribute refers to a first preset alignment size specified in the address alignment condition of the constant table, and for example, if the alignment attribute of the constant table is aligned by 32 bytes or aligned by 64 bytes, it indicates that the first preset pair Ji Daxiao is 32 bytes or 64 bytes.
For example, if the initial memory address base=0x1000000, the current free address of the constant table may be expressed by cur, and cur=0x1000000 may be set. The current free address represents the current starting memory address described above.
Step 704, determining whether the constant sequence is empty, if not, executing step 706, and if so, executing step 732.
Wherein, the constant sequence is non-null, which means that there is data in the constant sequence. The constant sequence being null means that there is no data in the constant sequence. For example, when the constant sequence c= {1.0,3.0,2.0,4.0}, the constant sequence is not null.
Step 706, determining the first constant in the constant sequence as the current constant data, and recording the storage size of the current constant data.
For example, the constant sequence c= {1.0,3.0,2.0,4.0}, the current constant data is represented by con, and since the first constant in the constant sequence c= {1.0,3.0,2.0,4.0} is 1.0, the current constant data con is set to 1.0, that is, con=1.0, and since the storage size of the first constant 1.0 is 4 bytes, the storage size (size) of the current constant data con is also 4 bytes. The storage size is indicated by size.
Since the constants in the constant sequence are arranged in order of the access frequency from large to small, the first constant in the constant sequence is the constant with the highest access frequency in the constant sequence. The storage size of the constant can be obtained directly from the compiler according to the type of the constant, for example, the storage size (size) of the int (integer) type is typically 4 bytes, and the storage size (size) of the double (double precision floating point type) type is typically 8 bytes. It should be noted that, in this embodiment, after the constants in the constant sequence are stored, the terminal removes the stored constants from the constant sequence, so that the constant sequence is continuously changed, and the constants in the constant sequence are continuously reduced.
Step 708, determining an alignment pad address interval for the current constant data based on the current free address and the address alignment requirement for the current constant data.
The aligned pad address interval may also be referred to as an aligned pad space size, which is in bytes. For example, the alignment padding space size is represented by padding, and when the alignment padding space size corresponding to the constant to be stored is calculated, the alignment padding address interval of the current constant data can be calculated by the formula padding= (align- (cur% align))%align. For example, align=4, cur=0x1000000, then padding= (4- (0x1000000%4))%4=0.
The first preset alignment size may be a constant storage size, so that the first preset alignment size in the address alignment requirement of the constant can be directly obtained from the compiler according to the type of the constant to be stored. For example, it is generally required that the int and float types are aligned by 4 bytes, the long and double types are aligned by 8 bytes, and so on.
Step 710, determining whether the alignment pad address interval of the current constant data is 0, if so, executing step 730, otherwise, executing step 712.
Step 712, determining whether there is a next constant, if so, executing step 714, and if not, executing step 726.
Step 714, obtaining the next constant from the constant sequence, obtaining the candidate constant, and obtaining the storage size of the candidate constant.
Step 716, determining whether the storage size of the candidate constant is less than or equal to the alignment pad address interval of the current constant data, if so, executing step 718, and if not, executing step 712.
Step 718, determining an alignment fill address interval for the candidate constant based on the current free address and the address alignment requirement for the candidate constant.
For example, an address alignment condition of a candidate constant is obtained, the alignment pad address interval of the candidate constant is represented by tmp_padding, and the address alignment condition of the candidate constant includes that the current free address is an integer multiple of tmp_align. tmp_align represents the storage size of the candidate constant, and the address alignment condition for storing the candidate constant can be directly obtained from the compiler (i.e., tmp_align is directly determined) according to the data type of the candidate constant. The terminal may calculate the alignment pad address interval tmp_padding for the candidate constant using the formula tmp_padding= (tmp_align- (cur% tmp_align))%tmp_align.
Step 720, determining whether the alignment pad address interval of the candidate constant is 0, if so, executing step 730, otherwise, executing step 712.
Step 722, store the candidate constant from the current free address and determine the current free address as the starting memory address of the candidate constant in memory space.
The initial storage address of the candidate constant in the storage space refers to the initial storage address of the candidate constant in the storage space. For example, the candidate constant is 1.0, cur=0x1000000, since padding corresponding to 1.0 is 0, 0x1000000 is determined as a start storage position (in bytes) in the storage space of 1.0, and since the storage size of 1.0 is 4 bytes, 1.0 is stored to a storage area of 4 bytes in length from 0x1000000, and the start storage address of the storage area is 0x1000000.
Step 724, deleting the candidate constant from the constant sequence, updating the current free address by using the storage size of the candidate constant, and returning to step 704.
For example, 1.0 is deleted from the constant sequence c= {1.0,3.0,2.0,4.0} and the constant sequence is updated to c= {3.0,2.0,4.0}.
For example, when the current free address is cur=0x1000000 (bytes), and the storage size of the candidate constant 1.0 is 4 bytes, the current space address is updated to cur=0x1000000+4=0x1000004.
Step 726, increasing the alignment filling address interval of the current constant data based on the current free address, as an updated current free address, storing the current constant data from the updated current free address, and determining the updated current free address as the initial storage address of the current constant data in the storage space.
Step 728, deleting the current constant data from the constant queue, updating the current free address based on the deleted current constant data storage size, and returning to step 704.
Step 730, storing the current constant data from the current free address, determining the current free address as the initial storage address of the current constant data in the storage space, deleting the current constant data from the constant queue, updating the current free address based on the storage size of the deleted current constant data, and returning to step 704.
In step 732, constant table construction is complete.
In this embodiment, a configuration scheme of a constant table is designed, constants are stored according to the access frequency, so that the locality of constant access is realized, and when the current initial storage address does not meet the address alignment condition of the constant to be stored, data storage is performed from the current initial storage address by using data meeting requirements after the constant to be stored, so that the storage resources wasted by additional alignment filling are reduced, not only can the high-efficiency access of the constant be realized (realized by using the locality of constant access), but also the storage space required by the constant table is reduced (realized by reducing the additional alignment filling). The data storage method provided by the application can be applied to constant compilation of a compiler, for example, the method can be applied to design and realization of constant compilation of a dynamic compiler.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a data storage device for realizing the above related data storage method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the data storage device provided below may be referred to above as limitation of the data storage method, and will not be repeated here.
In some embodiments, as shown in FIG. 8, there is provided a data storage device comprising: a data determination module 802, a data lookup module 804, an address update module 806, and a data storage module 808, wherein:
a data determining module 802, configured to determine current data from the current data sequence in a front-to-back order; the data in the current data sequence are arranged according to the reading frequency;
a data searching module 804, configured to search, in order from front to back, from the current data sequence for filling data that matches the aligned filling address interval of the current data and meets the address alignment condition when the current initial storage address is stored, if the current initial storage address does not meet the address alignment condition of the current data; aligning and filling address intervals, wherein the interval between a current aligned storage address and a current initial storage address is the interval between the current aligned storage address and the current initial storage address, and the current aligned storage address is an idle storage address which is nearest to the current initial storage address and accords with the address alignment condition of current data;
an address updating module 806, configured to store the padding data from the current initial storage address if the padding data is found, remove the padding data from the current data sequence, and update the current initial storage address;
And the data storage module 808 is configured to store the current data from the current start storage address if the current start storage address satisfies the address alignment condition of the current data after updating, remove the current data from the current data sequence, update the current start storage address, and return to determining the current data from the current data sequence in the order from front to back.
In some embodiments, the data lookup module is further to: searching target data which accords with the alignment filling address interval of the current data from the current data sequence according to the sequence from front to back; and under the condition that the target data is found, if the current initial storage address meets the address alignment condition of the target data, determining the target data as filling data.
In some embodiments, the data lookup module is further to: searching data with the storage size smaller than or equal to the alignment filling address interval of the current data from the current data sequence according to the sequence from front to back; if so, determining the searched data as target data which accords with the alignment filling address interval of the current data.
In some embodiments, the data storage device further includes a condition satisfaction determination module for determining an alignment fill address interval for the current data based on the current starting storage address and an address alignment condition for the current data; and under the condition that the alignment filling address interval does not meet the address interval requirement, determining that the current initial storage address does not meet the address alignment condition of the current data.
In some embodiments, the data storage device is further to: if the filling data is removed from the current data sequence, after the current initial storage address is updated, the current initial storage address does not meet the address alignment condition of the current data, returning to the step of searching the filling data which meets the alignment filling address interval of the current data and meets the address alignment condition when the current initial storage address is stored from the current data sequence according to the sequence from front to back.
In some embodiments, the data storage device is further to: if the filling data is not found, updating the current initial storage address to the current aligned storage address, and storing the current data from the current initial storage address; the current data is removed from the current data sequence and the current starting memory address is updated, returning to the step of determining the current data from the current data sequence in a front-to-back order.
In some embodiments, the data storage device is further to: and determining that the filling data is not found under the condition that the target data which accords with the alignment filling address interval of the current data is not found or the current initial storage address does not meet the address alignment condition of each target data which is found.
In some embodiments, the data storage device is further to: storing the current data from the current initial storage address under the condition that the current initial storage address meets the address alignment condition of the current data; the current data is removed from the current data sequence and the current starting memory address is updated, returning to the step of determining the current data from the current data sequence in a front-to-back order.
In some embodiments, the data storage device is further to: acquiring each constant data in the target program, and counting the reading frequency corresponding to each constant data respectively; arranging the obtained constant data according to the sequence from high to low of the reading frequency, and determining the constant sequence obtained by arrangement as a current data sequence; determining a constant table initial storage address of a constant table corresponding to the target program as a current initial storage address;
the data storage module is also for: the current constant data is stored in the constant table from the current start memory address to compile the constant data in the target program based on the constant table.
In some embodiments, the data storage module is further to: storing the current constant data into the constant table from the current initial storage address, and determining the current initial storage address as the initial storage address of the current constant data in the constant table; and establishing an address corresponding relation between the current constant data and the initial storage address of the current constant data in the constant table.
In some embodiments, the data storage module is further to: determining an initial storage address of constant data in a constant table based on an address correspondence of the constant data in the target program; and reading the constant data based on the initial storage address of the constant data in the constant table, and compiling the read constant data.
The various modules in the data storage device described above may be implemented in whole or in part in software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In some embodiments, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 9. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing data involved in the data storage method. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a data storage method.
In some embodiments, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 10. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a data storage method. The display unit of the computer equipment is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device, wherein the display screen can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on a shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structures shown in fig. 9 and 10 are merely block diagrams of portions of structures associated with aspects of the application and are not intended to limit the computer device to which aspects of the application may be applied, and that a particular computer device may include more or fewer components than those shown, or may combine certain components, or may have a different arrangement of components.
In some embodiments, a computer device is provided, comprising a memory in which a computer program is stored, and a processor which implements the steps of the data storage method described above when the computer program is executed.
In some embodiments, a computer readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the data storage method described above.
In some embodiments, a computer program product is provided comprising a computer program which, when executed by a processor, implements the steps of the data storage method described above.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (15)

1. A method of data storage, the method comprising:
determining current data from the current data sequence in a front-to-back order; the data in the current data sequence are arranged according to the reading frequency;
under the condition that the current initial storage address does not meet the address alignment condition of the current data, searching alignment filling address intervals which meet the current data from the current data sequence according to the sequence from front to back, and filling data which meet the address alignment condition when the current initial storage address is stored; the alignment filling address interval is an interval between a current alignment storage address and the current initial storage address, and the current alignment storage address is an idle storage address which is nearest to the current initial storage address and accords with the address alignment condition of the current data;
If the filling data is found, storing the filling data from the current initial storage address, removing the filling data from the current data sequence, and updating the current initial storage address;
if the current initial storage address meets the address alignment condition of the current data after updating, the current data is stored from the current initial storage address, the current data is removed from the current data sequence, the current initial storage address is updated, and the current data is determined from the current data sequence according to the sequence from front to back.
2. The method of claim 1, wherein the looking up padding data from the current data sequence that matches the aligned padding address interval of the current data and satisfies an address alignment condition when the current starting memory address is stored in a front-to-back order comprises:
searching target data which accords with the alignment filling address interval of the current data from the current data sequence according to the sequence from front to back;
and under the condition that the target data is found, if the current initial storage address meets the address alignment condition of the target data, determining the target data as filling data.
3. The method of claim 2, wherein the looking up the target data from the current data sequence in a front-to-back order that matches the aligned fill address interval of the current data comprises:
searching data with the storage size smaller than or equal to the alignment filling address interval of the current data from the current data sequence according to the sequence from front to back;
if so, determining the searched data as target data which accords with the alignment filling address interval of the current data.
4. The method of claim 1, wherein the step of determining that the current starting memory address does not satisfy the address alignment condition of the current data is as follows:
determining an alignment filling address interval of the current data based on the current initial storage address and an address alignment condition of the current data;
and under the condition that the alignment filling address interval does not meet the address interval requirement, determining that the current initial storage address does not meet the address alignment condition of the current data.
5. The method according to claim 1, wherein the method further comprises:
and if the filling data is removed from the current data sequence, after the current initial storage address is updated, the current initial storage address does not meet the address alignment condition of the current data, returning to the step of searching the filling data which meets the alignment filling address interval of the current data and meets the address alignment condition when the current initial storage address is stored from the current data sequence according to the sequence from front to back.
6. The method of claim 5, wherein the method further comprises:
if the filling data is not found, updating the current initial storage address to the current aligned storage address, and storing the current data from the current initial storage address;
and removing the current data from the current data sequence, updating the current initial storage address, and returning to the step of determining the current data from the current data sequence according to the sequence from front to back.
7. The method of claim 6, wherein the method further comprises:
and under the condition that the target data which accords with the alignment filling address interval of the current data is not found or the current initial storage address does not meet the address alignment condition of each searched target data, determining that the filling data is not found.
8. The method according to claim 1, wherein the method further comprises:
storing the current data from the current initial storage address under the condition that the current initial storage address meets the address alignment condition of the current data;
and removing the current data from the current data sequence, updating the current initial storage address, and returning to the step of determining the current data from the current data sequence according to the sequence from front to back.
9. The method of claim 1, wherein the current data is current constant data; the step of determining the current data from the current data sequence according to the sequence from front to back further comprises the following steps:
acquiring each constant data in a target program, and counting the reading frequency corresponding to each constant data;
arranging the obtained constant data according to the sequence from high to low of the reading frequency, and determining the constant sequence obtained by arrangement as a current data sequence;
determining a constant table initial storage address of a constant table corresponding to the target program as a current initial storage address;
the storing the current data from the current starting memory address includes:
storing the current constant data into the constant table from the current initial storage address to compile the constant data in the target program based on the constant table.
10. The method of claim 9, wherein storing the current constant data into the constant table from the current starting memory address comprises:
storing current constant data into the constant table from a current start memory address, and determining the current start memory address as a start memory address of the current constant data in the constant table;
And establishing an address corresponding relation between the current constant data and a starting storage address of the current constant data in the constant table.
11. The method of claim 9, wherein compiling constant data in the target program based on the constant table comprises:
determining an initial storage address of constant data in the constant table based on the address correspondence of the constant data in the target program;
and reading the constant data based on the initial storage address of the constant data in the constant table, and compiling the read constant data.
12. A data storage device, the device comprising:
the data determining module is used for determining current data from the current data sequence according to the sequence from front to back; the data in the current data sequence are arranged according to the reading frequency;
the data searching module is used for searching aligned filling address intervals which accord with the current data from the current data sequence according to the sequence from front to back under the condition that the current initial storage address does not meet the address alignment condition of the current data, and filling data which meet the address alignment condition when the current initial storage address is stored; the alignment filling address interval is an interval between a current alignment storage address and the current initial storage address, and the current alignment storage address is an idle storage address which is nearest to the current initial storage address and accords with the address alignment condition of the current data;
The address updating module is used for storing the filling data from the current initial storage address if the filling data is found, removing the filling data from the current data sequence and updating the current initial storage address;
and the data storage module is used for storing the current data from the current initial storage address if the current initial storage address meets the address alignment condition of the current data after updating, removing the current data from the current data sequence, updating the current initial storage address and returning to the step of determining the current data from the current data sequence according to the sequence from front to back.
13. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 11 when the computer program is executed.
14. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 11.
15. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 11.
CN202210374157.5A 2022-04-11 2022-04-11 Data storage method, device, computer equipment and storage medium Pending CN116931944A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210374157.5A CN116931944A (en) 2022-04-11 2022-04-11 Data storage method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210374157.5A CN116931944A (en) 2022-04-11 2022-04-11 Data storage method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116931944A true CN116931944A (en) 2023-10-24

Family

ID=88386711

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210374157.5A Pending CN116931944A (en) 2022-04-11 2022-04-11 Data storage method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116931944A (en)

Similar Documents

Publication Publication Date Title
CN110399104B (en) Data storage method, data storage device, electronic apparatus, and storage medium
US7146613B2 (en) JAVA DSP acceleration by byte-code optimization
US20120185822A1 (en) Web browsing apparatus and method through storing and optimizing javascript® code
CN113569508B (en) Database model construction method and device for data indexing and access based on ID
CN112783912B (en) Data processing method, device, computer equipment and storage medium
CN110908707A (en) Resource packaging method, device, server and storage medium
CN114663272B (en) Image processing method and electronic equipment
CN114253553A (en) Data processing method and device
CN113918602A (en) Data caching method and device and electronic equipment
CN112860412B (en) Service data processing method and device, electronic equipment and storage medium
US11030714B2 (en) Wide key hash table for a graphics processing unit
CN115617594B (en) Method, apparatus, storage medium, and program product for generating incentive information
CN111414527A (en) Similar item query method and device and storage medium
CN116931944A (en) Data storage method, device, computer equipment and storage medium
JP2018132900A (en) Storage method, storage device and storage program
CN116010345A (en) Method, device and equipment for realizing table service scheme of flow batch integrated data lake
CN110908996A (en) Data processing method and device
CN114817657A (en) To-be-retrieved data processing method, data retrieval method, electronic device and medium
CN114490727A (en) High-dimensional vector searching method for target database and related equipment
CN114218261A (en) Data query method and device, storage medium and electronic equipment
CN112883044A (en) Data processing method and device for database and computer readable medium
CN111475535A (en) Data storage and access method and device
CN104615499A (en) Picture processing method based on Android platform
WO2024016789A1 (en) Log data query method and apparatus, and device and medium
CN116414378A (en) Page packaging method, page loading method and device based on WeexSDK frame

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40098072

Country of ref document: HK