Unlock instant, AI-driven research and patent intelligence for your innovation.

Method and device for copying memory

A copying method and a technology of a copying device, which are applied in the field of computers and can solve problems affecting the copying of small and medium bytes

Active Publication Date: 2017-09-08
ALIBABA GRP HLDG LTD
View PDF6 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0010] This solution increases the amount of memory access while avoiding prediction errors. However, since the CPU needs to access MS_ROM, it needs a "warm-up" stage when starting. This stage brings a lot of delay and seriously affects the copying of small and medium bytes.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for copying memory
  • Method and device for copying memory
  • Method and device for copying memory

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0115] Embodiment 1, a memory copy method, such as figure 1 shown, including:

[0116] S101. Determine whether the length L of the memory to be copied is less than the first length threshold, and proceed to step S102 when the length L is less than the first length threshold;

[0117] S102. Among multiple predetermined length intervals, determine a length interval corresponding to the length L;

[0118] S103. Starting from the source address rsi of the memory to be copied, copy min bytes to the min bytes starting from the destination address rdi; start from rsi+L-N bytes, copy N bytes to rdi+L-N In the first N bytes; wherein, the max and min are the upper and lower limit values ​​of the determined length interval respectively; N is a fixed integer greater than or equal to max-min and less than or equal to L.

[0119] Every time a memory copy is performed, the length, source address and destination address of the memory to be copied are determined, and the above length L, sour...

Embodiment 2

[0209] Embodiment 2, a memory replication device, comprising:

[0210] A first judging unit, configured to judge whether the length L of the memory to be copied is less than a first length threshold;

[0211] The second judging unit is configured to, when the judging result of the first judging unit is that the length L is less than the first length threshold, among a plurality of predetermined length intervals, determine a length interval corresponding to the length L;

[0212] The first copying unit is used to start from the source address rsi of the memory to be copied, copy min bytes to the min bytes starting from the destination address rdi; start from rsi+L-N, copy N bytes to rdi In the N bytes starting from +L-N; wherein, the max and min are respectively the upper and lower limit values ​​of the determined length interval; N is a fixed integer, and L≥N≥max-min.

[0213] In an implementation manner of this embodiment, the N is an integer power of 2 that is greater than ...

Embodiment 3

[0232] Embodiment 3. A memory copy method, comprising:

[0233] Judging whether the length L of the memory used to store the data to be copied is less than the first length threshold;

[0234] When the length L is less than the first length threshold, among a plurality of predetermined length intervals, determine a length interval corresponding to the length L;

[0235] The data to be copied is saved in the min bytes starting from the destination address rdi in the memory; the data to be copied is saved in the N bytes starting from rdi+L-N in the memory; wherein, the max and min are determined respectively The upper and lower limits of the length interval; N is a fixed integer, and L≥N≥max-min.

[0236] This embodiment is applicable to the situation of copying data in registers or other storage spaces into memory, such as writing data in a 16-byte register into a 64-byte memory (that is, the 64-byte memory after writing 4 sections of the same data are stored in sequence in t...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

A memory copy method and device; the method includes: judging whether the length L of the memory to be copied is less than a first length threshold; when the length L is less than the first length threshold, in a plurality of predetermined length intervals, determine the length corresponding to the length L interval; start from the source address rsi of the memory to be copied, copy min bytes to the min bytes starting from the destination address rdi; start from rsi+L-N, copy N bytes to rdi+L-N Among the N bytes starting from N; wherein, the max and min are respectively the upper and lower limit values ​​of the determined length interval; N is a fixed integer, and L≥N≥max‑min. This application can improve the performance of memory copying.

Description

technical field [0001] The invention relates to the field of computers, in particular to a method and device for copying memory. Background technique [0002] Applications often use some common operations, such as copying data from one piece of memory to another space, comparing data in two pieces of memory for differences, calculating the length of a string, and so on. [0003] If not improved, it will lead to a large amount of repetitive code between multiple applications, and the overall code size will increase, requiring more memory, causing more instruction cache failures, and performance degradation. Because these operations are frequently used, Amdahl's law requires us to optimize those functions that occupy a large proportion of CPU time, so as to improve the overall performance of the program. Therefore, all frequently operated functions are taken out separately and made into a function library that can be shared by one or more programs, so that all programs can on...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F12/04
Inventor 马凌姚四海张磊
Owner ALIBABA GRP HLDG LTD