Information processing method, information processing device, and program

WO2026100330A1PCT designated stage Publication Date: 2026-05-15PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD
Filing Date
2025-10-17
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing technologies are unable to effectively reduce the storage area occupied during program execution, resulting in a large amount of unused storage space in the storage system.

Method used

By analyzing the program's access operation patterns, the program was modified to allocate the storage area as a shared area and use it for storing different variables at different times, thus avoiding the reuse of the storage area.

Benefits of technology

It effectively reduces the amount of storage space occupied and optimizes the use of storage resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2025036709_15052026_PF_FP_ABST
    Figure JP2025036709_15052026_PF_FP_ABST
Patent Text Reader

Abstract

In an information processing method according to the present invention, determination is made regarding whether or not a predetermined access operation to memory is to be performed (S12), and when determination is made that the predetermined access operation is to be performed, a processing subject program (P1) is modified (S13). In step (S13), the processing subject program (P1) is modified such that one region reserved by the execution of the processing subject program (P1) is reserved as a shared region for a first variable and a second variable, and the shared region is accessed at mutually different timings for each of processing using the first variable and processing using the second variable. The predetermined access operation is an operation in which, following a final access to a first region for the first variable, access to a second region for the second variable is performed for the first time.
Need to check novelty before this filing date? Find Prior Art

Description

Information Processing Method, Information Processing Apparatus, and Program

[0001] The present disclosure relates to information processing for programs and memories.

[0002] For example, Patent Document 1 discloses a data storage system that stores input data. This data storage system includes data storage means and data storage control means. The data storage means has a data storage area including a fixed-length storage area and a variable-length storage area. The data storage control means determines which of the fixed-length storage area and the variable-length storage area to store the data in according to the data length of the input data.

[0003] Japanese Patent Application Laid-Open No. 2001-325145

[0004] However, in the information processing method used in the data storage system disclosed in Patent Document 1 above, there is a problem that it is difficult to effectively suppress the area secured in the memory by the execution of the program. That is, in order to improve the processing speed, the data storage system performs processing using a memory pool. As a result, in this data storage system, when the program is executed, a large area is secured in the memory in a lump in advance. The large area in advance is the above-mentioned fixed-length storage area, variable-length storage area, etc. From such a large area, the actually used area is allocated. Therefore, since a large area is secured, an unnecessary area may be secured for the execution of the program.

[0005] The present disclosure solves the above problems and provides an information processing method and the like that can effectively suppress the area secured in the memory by the execution of the program.

[0006] To solve the above problems, an information processing method according to one aspect of the present disclosure is an information processing method executed by a computer, which obtains a processing target program that defines the allocation of a first area in memory for a first variable, the allocation of a second area in memory for a second variable, and processing using the first variable and the second variable, respectively, determines whether a predetermined access operation to the memory is performed by the execution of the processing target program by analyzing the processing target program, and if it is determined that the predetermined access operation is performed, modifies the processing target program to output a modified program, and modifies the processing target program such that one area allocated by the execution of the processing target program is allocated as a shared area for the first variable and the second variable, and the shared area is accessed at different timings for processing using the first variable and processing using the second variable, respectively, and the predetermined access operation is an operation in which the first access is performed after the last access of one or more accesses to the first area performed for processing using the first variable has been performed.

[0007] These comprehensive or specific embodiments may be implemented as devices, systems, integrated circuits, or recording media such as computer-readable CD-ROMs (Compact Disc Read-Only Memory), or as any combination of devices, systems, methods, integrated circuits, computer programs, and recording media. Furthermore, the recording media may be non-temporary recording media.

[0008] According to this disclosure, the amount of memory allocated by program execution can be effectively reduced.

[0009] Further advantages and effects of one aspect of this disclosure will be made apparent from the specification and drawings. Such advantages and / or effects are provided by several embodiments and features described in the specification and drawings, but not all of them are necessarily provided in order to obtain one or more identical features.

[0010] Figure 1 is a diagram showing an example configuration of the information processing system in the embodiment. Figure 2 is a diagram illustrating the state of the memory provided in the user device in the embodiment. Figure 3 is a block diagram showing an example configuration of the user device in the embodiment. Figure 4 is a block diagram showing an example configuration of the pattern providing device in the embodiment. Figure 5 is a block diagram showing an example configuration of the analysis device in the embodiment. Figure 6 is a diagram showing an example of judgment pattern data and correction pattern data in case C1 of the embodiment. Figure 7 is a diagram showing an example of judgment pattern data and correction pattern data in case C2 of the embodiment. Figure 8 is a diagram showing an example of judgment pattern data and correction pattern data in case C2' of the embodiment. Figure 9 is a diagram showing an example of judgment pattern data and correction pattern data in case C3 of the embodiment. Figure 10 is a diagram showing an example of judgment pattern data and correction pattern data in case C3' of the embodiment. Figure 11 is a diagram showing an example of judgment pattern data and correction pattern data in case C4 of the embodiment. Figure 12 is a diagram showing an example of judgment pattern data and correction pattern data in case C4' of the embodiment. Figure 13 is a sequence diagram showing an example of the processing operation of the user device, analysis device, and pattern providing device in the embodiment. Figure 14 is a flowchart showing an example of the correction process by the analysis device in the embodiment. Figure 15 is a flowchart showing an example of the processing operation of the analysis unit and the correction execution unit included in the analysis device in the embodiment. Figure 16 is a block diagram showing an example of the configuration of the analysis device in modified example 1 of the embodiment. Figure 17 is a flowchart showing an example of the processing operation of the analysis device and the correction execution unit in modified example 1 of the embodiment. Figure 18 is a diagram illustrating the determination by the analysis device in modified example 2 of the embodiment. Figure 19 is a flowchart showing an example of the processing operation of the analysis unit and the correction execution unit included in the analysis device in modified example 3 of the embodiment. Figure 20 is a diagram showing an example of determination pattern data and correction pattern data in modified example 4 of the embodiment.Figure 21 is a flowchart showing an example of the processing operation of the analysis unit and the modification execution unit included in the analysis device in modified example 5 of the embodiment.

[0011] An information processing method according to a first aspect of this disclosure is an information processing method executed by a computer, which obtains a processing target program that defines the allocation of a first area in memory for a first variable, the allocation of a second area in memory for a second variable, and processing using the first variable and the second variable, respectively, determines whether a predetermined access operation to the memory is performed by the execution of the processing target program by analyzing the processing target program, and if it is determined that the predetermined access operation is performed, modifies the processing target program to output a modified program, wherein the modification of the processing target program is such that one area allocated by the execution of the processing target program is allocated as a shared area for the first variable and the second variable, and the shared area is accessed at different timings for processing using the first variable and processing using the second variable, respectively, and the predetermined access operation is an operation in which the first access is performed after the last access of one or more accesses to the first area performed for processing using the first variable has been performed.

[0012] As a result, if it is determined that a predetermined access operation will occur, the program to be processed is modified to be optimized. In other words, when such an access operation occurs, the period during which one or more accesses to the first area occur does not overlap with the period during which one or more accesses to the second area occur. Therefore, in such cases, it is possible to modify the program to be processed so that, for example, the larger of the first and second areas is reserved as a shared area for the first and second variables. Thus, in the first embodiment, the program to be processed is modified as described above, and the modified program is output. As a result, when the modified program is executed, both the first and second areas are not reserved, and for example, only one of the first and second areas is reserved as a shared area. In other words, that one area is reused. This effectively reduces the amount of memory allocated in memory by the execution of the modified program. Furthermore, since the amount of memory allocated in memory is reduced by modifying or optimizing the program to be processed, it can also be said that modifying or optimizing the program to be processed is memory optimization.

[0013] Furthermore, in the information processing method relating to the second aspect of this disclosure, in determining whether or not the predetermined access operation is performed, it is possible to determine whether or not the processing pattern, which is a pattern of processing performed by the execution of the program to be processed, matches one of the one or more determination patterns in which the predetermined access operation is performed. The second aspect may be dependent on the first aspect.

[0014] As a result, if the processing pattern matches a determination pattern, it is determined that a predetermined access operation will be performed, and if the processing pattern does not match any of the determination patterns, it is determined that a predetermined access operation will not be performed. Therefore, it is possible to easily determine whether or not the access operation will be performed, that is, to analyze the program being processed.

[0015] Furthermore, in the information processing method according to the third aspect of this disclosure, the determination pattern includes processing by a first function and processing by a second function, the processing by the first function includes the allocation of the second area, the second function is then called, the processing by the called second function includes the allocation of the first area, the first area is accessed one or more times, and the processing by the first function may further include one or more accesses to the second area after the processing by the second function has finished. The third aspect may be dependent on the second aspect. The determination pattern of the third aspect is, for example, the determination pattern of case C1 described later.

[0016] This allows us to appropriately determine, by using the aforementioned predetermined access operation, whether or not the target program can be optimized, by using the determination pattern.

[0017] Furthermore, in the information processing method according to the fourth aspect of this disclosure, the modified program is defined to perform processing by a modified first function and processing by a modified second function, the modified first function allocates the shared area, the modified second function is then called, and the called modified second function accesses the shared area one or more times for processing using the first variable, and the modified first function may further access the shared area one or more times for processing using the second variable after the processing by the modified second function has finished. Note that the fourth aspect may be dependent on the third aspect. The modified program of the fourth aspect is, for example, the modified program of case C1 described later.

[0018] This makes it possible to appropriately optimize the program to be processed that exhibits a processing pattern matching the determination pattern of the third embodiment.

[0019] Furthermore, in the information processing method according to the fifth aspect of this disclosure, the determination pattern may involve the allocation of the second area, then the allocation of the first area, then one or more accesses to the first area, and then one or more accesses to the second area. The fifth aspect may be subordinate to the second aspect. The determination pattern of the fifth aspect is, for example, the determination pattern of case C2' described later.

[0020] This allows us to appropriately determine, by using the aforementioned predetermined access operation, whether or not the target program can be optimized, by using the determination pattern.

[0021] Furthermore, in the information processing method according to the sixth aspect of this disclosure, the determination pattern may include processing by a first function and processing by a second function, the processing by the first function may include the allocation of the second area, the second function may be called, the processing by the called second function may include the allocation of the first area, the first area may be accessed one or more times, and the second area may be accessed one or more times. The sixth aspect may be subordinate to the second aspect. The determination pattern of the sixth aspect is, for example, the determination pattern of case C2 described later.

[0022] This allows us to appropriately determine, by using the aforementioned predetermined access operation, whether or not the target program can be optimized, by using the determination pattern.

[0023] Furthermore, in the information processing method according to the seventh aspect of this disclosure, the modified program is defined to perform processing by a modified first function and processing by a modified second function, wherein the processing by the modified first function involves the allocation of the shared area, the modified second function is then called, and the processing by the called modified second function involves one or more accesses to the shared area for processing using the first variable, and then one or more accesses to the shared area for processing using the second variable. The seventh aspect may be dependent on the sixth aspect. The modified program of the seventh aspect is, for example, the modified program of case C2 described later.

[0024] This makes it possible to appropriately optimize the program to be processed that shows a processing pattern matching the determination pattern of the sixth embodiment.

[0025] Furthermore, in the information processing method according to the eighth aspect of this disclosure, the determination pattern may involve the allocation of the first area, followed by one or more accesses to the first area, followed by the allocation of the second area, followed by one or more accesses to the second area. The eighth aspect may be subordinate to the second aspect. The determination pattern of the eighth aspect is, for example, the determination pattern of case C3' described later.

[0026] This allows us to appropriately determine, by using the aforementioned predetermined access operation, whether or not the target program can be optimized, by using the determination pattern.

[0027] Furthermore, in the information processing method according to the ninth aspect of this disclosure, the modified program may define that the shared area is secured, then one or more accesses to the shared area are made for processing using the first variable, and then one or more accesses to the shared area are made for processing using the second variable. The ninth aspect may be dependent on the fifth or eighth aspect. The modified program of the ninth aspect is, for example, the modified program in case C2' or case C3' described later.

[0028] This makes it possible to appropriately optimize the processing target program that shows a processing pattern that matches the determination pattern of the fifth or eighth aspect.

[0029] Furthermore, in the information processing method according to the tenth aspect of this disclosure, the determination pattern may include processing by a first function and processing by a second function, the first function may include the allocation of the first area, one or more accesses to the first area, the second function may be called, and the second function may include the allocation of the second area, one or more accesses to the second area. The tenth aspect may be subordinate to the second aspect. The determination pattern of the tenth aspect is, for example, the determination pattern of case C3 described later.

[0030] This allows us to appropriately determine, by using the aforementioned predetermined access operation, whether or not the target program can be optimized, by using the determination pattern.

[0031] Furthermore, in the information processing method according to the 11th aspect of this disclosure, the modified program is defined to perform processing by a modified first function and processing by a modified second function, wherein the processing by the modified first function involves allocating the shared area, then accessing the shared area one or more times for processing using the first variable, then calling the modified second function, and the processing by the called modified second function may involve accessing the shared area one or more times for processing using the second variable. Note that the 11th aspect may be dependent on the 10th aspect. Also, the modified program of the 11th aspect is, for example, the modified program of case C3 described later.

[0032] This makes it possible to appropriately optimize the program to be processed that shows a processing pattern matching the determination pattern of the tenth embodiment.

[0033] Furthermore, in the information processing method according to the twelfth aspect of this disclosure, in the determination pattern, the first area is secured, then one or more accesses to the first area are made, then the second area is secured, then one or more accesses to the second area are made, then one or more new accesses to the first area are made, and the value of the first variable stored in the first area may differ between the period during which one or more accesses to the first area are made and the period during which one or more new accesses to the first area are made. Note that the twelfth aspect may be dependent on the second aspect. Also, the determination pattern of the twelfth aspect is, for example, the determination pattern of case C4' described later.

[0034] This allows us to appropriately determine whether the predetermined access operation described above is performed, that is, whether the program being processed can be optimized, by using this determination pattern. For example, if one or more accesses to the first area, one or more accesses to the second area, and one or more accesses to the first area are performed in that order, the predetermined access operation described above will not be performed. However, if the value of the first variable stored in the first area differs between one or more accesses to the first area performed before one or more accesses to the second area and one or more accesses to the first area performed afterward, the predetermined access operation described above will be performed. In other words, the last of the one or more accesses to the first area performed earlier can be treated as the final access to the first area. In the determination pattern of the twelfth embodiment, it is specified that the value of the first variable stored in the first area differs before and after one or more accesses to the second area. Therefore, by using this determination pattern, we can appropriately determine whether the program being processed can be optimized.

[0035] Furthermore, in the information processing method according to the 13th aspect of this disclosure, the modified program is defined as follows: the shared area is secured; then, one or more accesses to the shared area are made for processing using the first variable; then, one or more accesses to the shared area are made for processing using the second variable; and then, one or more accesses to the shared area are made for new processing using the first variable. The value of the first variable stored in the shared area may differ between the period during which one or more accesses to the shared area are made for processing using the first variable and the period during which one or more accesses to the shared area are made for new processing using the first variable. Note that the 13th aspect may be dependent on the 12th aspect. Also, the modified program of the 13th aspect is, for example, the modified program of case C4' described later.

[0036] This makes it possible to appropriately optimize the program to be processed that shows a processing pattern matching the determination pattern of the twelfth embodiment.

[0037] Furthermore, in the information processing method according to the 14th aspect of this disclosure, the determination pattern includes processing by a first function and processing by a second function, the first function's processing includes the allocation of the first area, then one or more accesses to the first area, then the second function is called, the second function's processing includes the allocation of the second area, then one or more accesses to the second area, and the first function's processing includes, after the processing by the second function has finished, one or more new accesses to the first area, and the value of the first variable stored in the first area may differ between the period during which one or more accesses to the first area are performed and the period during which one or more new accesses to the first area are performed. Note that the 14th aspect may be dependent on the second aspect. Also, the determination pattern of the 14th aspect is, for example, the determination pattern of case C4 described later.

[0038] As a result, similar to the twelfth embodiment, by using the determination pattern, it is possible to appropriately determine whether or not the predetermined access operation described above is performed, that is, whether or not the program to be processed can be optimized.

[0039] Furthermore, in the information processing method according to the 15th aspect of this disclosure, the modified program is defined to perform processing by a modified first function and processing by a modified second function, the modified first function allocates the shared area, then accesses the shared area one or more times for processing using the first variable, then the modified second function is called, the modified second function calls, and the modified second function, after its execution, accesses the shared area one or more times for processing using the second variable, and the modified first function further accesses the shared area one or more times for new processing using the first variable after the processing by the modified second function is completed, and the value of the first variable stored in the shared area may differ between the period during which the shared area is accessed one or more times for processing using the first variable and the period during which the shared area is accessed one or more times for new processing using the first variable. Note that the 15th aspect may be dependent on the 14th aspect. Furthermore, the modified program of the 15th embodiment is, for example, the modified program of case C4 described later.

[0040] This makes it possible to appropriately optimize the program to be processed that shows a processing pattern matching the determination pattern of the 14th embodiment.

[0041] Furthermore, in the information processing method according to the 16th aspect of this disclosure, in determining whether or not the predetermined access operation is performed, a first variable coordinate region and a second variable coordinate region are arranged in a coordinate space having a first axis indicating time and a second axis indicating each region in the memory, and it is determined that the predetermined access operation is performed when it is possible to approach the first variable coordinate region and the second variable coordinate region along the direction of the second axis without overlapping, and the first variable coordinate region is a coordinate region determined by the range of the first axis corresponding to the period during which one or more accesses to the first region are performed and the range of the second axis corresponding to the first region, and the second variable coordinate region is a coordinate region determined by the range of the first axis corresponding to the period during which one or more accesses to the second region are performed and the range of the second axis corresponding to the second region. Note that the 16th aspect may be dependent on the first aspect.

[0042] This makes it easy to understand when and where each variable is used, and allows for a proper determination of whether or not the predetermined access operations described above are performed, i.e., whether or not the target program can be optimized.

[0043] Also, in the information processing method according to the 17th aspect of the present disclosure, in the processing target program, further, securing of a third area for a third variable in the memory and processing using the third variable are defined, and the predetermined access operation is the first access among one or more accesses to the third area performed for processing using the third variable, after the final access among one or more accesses to the first area performed for processing using the first variable, is performed. Next, after the final access among one or more accesses to the third area is performed, the first access among one or more accesses to the second area performed for processing using the second variable is performed. In the modification of the processing target program, one area secured by execution of the processing target program is secured as a shared area for the first variable, the second variable, and the third variable, and the processing target program may be modified so that the shared area is accessed at different timings for each of the processing using the first variable, the processing using the second variable, and the processing using the third variable. Note that the 17th aspect may be dependent on any one of the 1st aspect to the 16th aspect.

[0044] As a result, a processing target program that secures three areas for the first variable, the second variable, and the third variable is modified to a modified program that secures one shared area for those three variables. Therefore, further optimization of the processing target program and the memory can be achieved.

[0045] Also, in the information processing method according to the 18th aspect of the present disclosure, each of the first variable and the second variable may be a variable used in the operation of Classic McEliece, which is an encryption method. Note that the 18th aspect may be dependent on any one of the 1st aspect to the 17th aspect.

[0046] As a result, effective optimization can be achieved for a processing target program that performs the operation of Classic McEliece, which requires many areas in the memory.

[0047] Further, the information processing apparatus according to the 19th aspect of the present disclosure includes an acquisition unit that acquires a processing target program in which securing a first area for a first variable in a memory, securing a second area for a second variable in the memory, and processing using each of the first variable and the second variable are defined, an analysis unit that determines whether a predetermined access operation to the memory is performed by analyzing the processing target program, and a correction execution unit that outputs a corrected program by correcting the processing target program when it is determined that the predetermined access operation is performed. The correction execution unit corrects the processing target program so that one area secured by the execution of the processing target program is secured as a shared area for the first variable and the second variable, and the shared area is accessed at different timings for each of the processing using the first variable and the processing using the second variable. The predetermined access operation is an operation in which the first access of one or more accesses to the second area for the processing using the second variable is performed after the last access of one or more accesses to the first area for the processing using the first variable is performed.

[0048] As a result, the same operational effects as those of the information processing method according to the first aspect can be achieved.

[0049] Hereinafter, embodiments of the present disclosure will be described with reference to the drawings. Each of the embodiments described below shows a preferred specific example of the present disclosure. Therefore, numerical values, shapes, materials, components, arrangement positions of components, connection forms, and the like shown in the following embodiments are merely examples and are not intended to limit the present disclosure. Thus, among the components in the following embodiments, components not described in the independent claims indicating the most上位 concept are described as arbitrary components.

[0050] It should be noted that there is an unclear term "最上位概念" in the original text. I translated it as "最上位概念" as it is, but it might need further clarification depending on the specific context.Furthermore, each figure is a schematic diagram and not necessarily a strictly accurate representation. In addition, the same reference numerals are used for substantially identical components in each figure, and redundant explanations are omitted or simplified. In addition, in this disclosure, ordinal numbers such as "first," "second," etc., do not mean the number or order of components unless otherwise specified, but are used to avoid confusion and distinguish similar components.

[0051] (Embodiment) Figure 1 is a diagram showing an example of the configuration of the information processing system in this embodiment.

[0052] The information processing system 1 in this embodiment is a system that can effectively reduce the memory area allocated in memory by optimizing the area allocated in memory through program execution. Such an information processing system 1 includes a user device 10, an analysis device 20, and a pattern providing device 30.

[0053] User device 10 is a computer, such as a personal computer, used by a user. Analysis device 20 is a computer that analyzes the program to be processed and generates a modified program by modifying the program based on the results of the analysis. The program to be processed is, for example, source code for causing the user device 10 to execute post-quantum cryptography. Pattern providing device 30 is a computer that holds and provides one or more judgment pattern data and one or more modification pattern data corresponding to the one or more judgment patterns. Each of the one or more judgment pattern data represents a pattern of processing performed by the computer as a judgment pattern. Each of the one or more modification pattern data represents data that represents the modification content corresponding to the judgment pattern shown in the judgment pattern data as a modification pattern. The set of judgment pattern data and the modification pattern data corresponding to that judgment pattern data may also be called optimization pattern data.

[0054] In this information processing system 1, the user device 10 transmits the program to be processed to the analysis device 20. The pattern providing device 30 provides the analysis device 20 with one or more judgment pattern data and one or more correction pattern data.

[0055] The analysis device 20 obtains the program to be processed from the user device 10, and further obtains one or more judgment pattern data and one or more modification pattern data from the pattern providing device 30. The analysis device 20 then performs an analysis using the one or more judgment pattern data to determine whether or not modification (i.e., optimization) is possible for the program to be processed. If the analysis device 20 determines that modification is possible for the program to be processed based on the analysis using the judgment pattern data, it modifies the program to be processed based on the modification pattern data corresponding to the judgment pattern data. As a result, the program to be processed is optimized, and a modified program is generated. This modified program may also be called optimized source code. The analysis device 20 transmits the modified program to the user device 10.

[0056] When the user device 10 obtains the modified program from the analysis device 20, it executes the modified program. At this time, the execution of the modified program allocates memory in the user device 10 for storing variables and other data. The memory allocated by the execution of the modified program is smaller than the memory allocated by the execution of the program being processed. Therefore, the memory allocation can be optimized and effectively reduced.

[0057] Figure 2 is a diagram illustrating the state of the memory provided in the user device 10.

[0058] For example, when the program to be processed is executed by the user device 10, as shown in Figure 2(a), a first area for storing variable A and a second area for storing variable B are allocated in the memory provided by the user device 10.

[0059] On the other hand, when the modified program is executed by the user device 10, as shown in Figure 2(b), a shared area for storing variables A and B is reserved in the memory provided by the user device 10. This shared area is an area of ​​size equivalent to either the first or second area. In the first period, this shared area is used to store variable A, and in the second period, which does not overlap with the first period, it is used to store variable B. In other words, the modified program optimizes the area reserved in memory. To put it another way, the area in memory used for variable A is reused for variable B, thus reducing memory usage.

[0060] Figure 3 is a block diagram showing an example configuration of the user device 10.

[0061] The user device 10 includes a first control unit 11, a first operation unit 12, a first display unit 13, a first communication unit 14, a first storage unit 15, and a memory 16.

[0062] The first operation unit 12 receives input operations from the user and outputs an input signal corresponding to the input operation to the first control unit 11. Such a first operation unit 12 is configured as, for example, a keyboard, a touch sensor, a touchpad, or a mouse.

[0063] The first display unit 13 is a display that shows characters, images, etc., indicated by an image signal output from, for example, the first control unit 11. For example, the first display unit 13 is a liquid crystal display, a plasma display, an organic EL (Electro-Luminescence) display, etc., but is not limited to these displays. Also, the first operation unit 12 and the first display unit 13 may be integrated as a touch panel.

[0064] The first communication unit 14 communicates with the analysis device 20 via wireless or wired connection. Wireless communication may be performed using Wi-Fi®, Bluetooth®, ZigBee®, or low-power radio.

[0065] The first storage unit 15 is a recording medium for storing computer programs such as the program to be processed P1 and the modified program P2. The first storage unit 15 may also store information other than computer programs. Furthermore, the computer programs stored in the first storage unit 15 may be computer programs written in a high-level language (i.e., source code), or they may be machine code programs obtained by compiling the source code. Such a first storage unit 15 may be a non-volatile recording medium such as a hard disk drive or an SSD (Solid State Drive).

[0066] Memory 16 is a recording medium for which a computer program read from the first storage unit 15 by the first control unit 11 is expanded and stored. Memory 16 also has an area reserved for storing one or more variables resulting from the execution of the computer program. Such memory 16 may be RAM (Random Access Memory), ROM (Read Only Memory), or semiconductor memory, etc.

[0067] The first control unit 11 is a processor such as a CPU (Central Processing Unit) that reads a computer program from the first storage unit 15, expands it into memory 16, and executes the computer program. The first control unit 11 then allocates an area in memory 16 for storing one or more variables through the execution of the computer program, and executes the processing defined by the computer program while accessing that area. The first control unit 11 also retrieves the program to be processed P1 from the first storage unit 15 and causes the first communication unit 14 to transmit the program to be processed P1 to the analysis device 20. Furthermore, when the first communication unit 14 receives the modified program P2 from the analysis device 20, the first control unit 11 stores the modified program P2 in the first storage unit 15.

[0068] Figure 4 is a block diagram showing an example configuration of the pattern providing device 30.

[0069] The pattern providing device 30 includes a third control unit 31, a third communication unit 34, and a third storage unit 35.

[0070] The third communication unit 34 communicates with the analysis device 20 via wireless or wired connection. Wireless communication may be performed using Wi-Fi®, Bluetooth®, ZigBee®, or low-power radio.

[0071] The third storage unit 35 is a recording medium that stores one or more judgment pattern data D1 and one or more correction pattern data D2. Such a third storage unit 35 may be a non-volatile recording medium such as a hard disk drive or SSD.

[0072] The third control unit 31 is a processor such as a CPU, which retrieves one or more judgment pattern data D1 and one or more correction pattern data D2 from the third storage unit 35 and causes the third communication unit 34 to transmit them to the analysis device 20.

[0073] Figure 5 is a block diagram showing an example of the configuration of the analysis device 20.

[0074] The analysis device 20 is an information processing device comprising a second control unit 21, a second communication unit 24, a second storage unit 25, an analysis unit 27, and a modification execution unit 28.

[0075] The second communication unit 24 communicates with the user device 10 and the pattern providing device 30 via wireless or wired connection. Wireless communication may be performed using Wi-Fi®, Bluetooth®, ZigBee®, or low-power radio.

[0076] The second storage unit 25 is a recording medium for storing one or more judgment pattern data D1, one or more correction pattern data D2, the program to be processed P1, and the modified program P2. Such a second storage unit 25 may be a non-volatile recording medium such as a hard disk drive or SSD.

[0077] The second control unit 21 is a processor such as a CPU. When the second communication unit 24 receives one or more judgment pattern data D1 and one or more correction pattern data D2 transmitted from the pattern providing device 30, the second control unit 21 stores the one or more judgment pattern data D1 and one or more correction pattern data D2 in the second storage unit 25. Furthermore, when the second communication unit 24 receives the processing target program P1 transmitted from the user device 10, the second control unit 21 stores the processing target program P1 in the second storage unit 25. Also, when the correction execution unit 28 generates a corrected program P2, the second control unit 21 stores the corrected program P2 in the second storage unit 25 and then causes the second communication unit 24 to transmit the corrected program P2 to the user device 10.

[0078] When the program to be processed P1 is stored in the second storage unit 25, the analysis unit 27 analyzes the program to be processed P1 using one or more judgment pattern data D1 stored in the second storage unit 25. Based on this analysis, the analysis unit 27 determines whether or not the program to be processed P1 can be modified.

[0079] If the analysis unit 27 determines that the program P1 to be processed can be modified, the modification execution unit 28 modifies the program P1 according to one or more modification pattern data D2 stored in the second storage unit 25. As a result, the modified program P2 is generated.

[0080] In this embodiment, the second communication unit 24 is configured as an acquisition unit that acquires the program P1 to be processed. The program P1 to be processed defines the allocation of a first memory area for a first variable, the allocation of a second memory area for a second variable, and processing using the first and second variables, respectively. When the program P1 to be processed is executed by the user device 10, the memory handled by the program P1 is memory 16. The analysis unit 27 determines that the program P1 to be processed can be modified if the execution of the program P1 performs a predetermined access operation to the memory. In other words, the analysis unit 27 determines whether the execution of the program P1 performs a predetermined access operation to the memory by analyzing the program P1 (specifically, static analysis). The predetermined access operation is the operation in which the first access is performed after the last access of one or more accesses to the first memory area performed for processing using the first variable, and then the first access of one or more accesses to the second memory area performed for processing using the second variable. The modification execution unit 28 outputs the modified program P2 by modifying the program P1 to be processed when it determines that a predetermined access operation is to be performed. In modifying the program P1 to be processed, the modification execution unit 28 modifies the program P1 so that one area allocated by the execution of the program P1 is allocated as a shared area for the first variable and the second variable, and that this shared area is accessed at different timings for the processing using the first variable and the processing using the second variable, respectively.

[0081] Furthermore, in this embodiment, the analysis unit 27 determines whether or not a predetermined access operation is performed by determining whether the processing pattern, which is the pattern of processing performed by the execution of the program P1 to be processed, matches one of the one or more predetermined determination patterns in which an access operation is performed. The one or more determination pattern data D1 described above each represents one or more predetermined determination patterns in which an access operation is performed. In other words, the analysis unit 27 determines that a predetermined access operation is performed if the processing pattern of the program P1 to be processed matches any of the determination patterns. That is, it is determined that the program P1 to be processed can be modified.

[0082] More specifically, the analysis unit 27 performs a static analysis of the program to be processed P1 to identify the usage period, declaration location, etc., of variables used in the program to be processed P1. Then, the analysis unit 27 uses the identified usage period, etc., to identify the processing pattern of the program to be processed P1. Furthermore, for each of the one or more judgment pattern data D1, the analysis unit 27 determines whether the identified processing pattern matches the judgment pattern shown in the judgment pattern data D1. The modification execution unit 28 modifies the program to be processed P1 according to the modification pattern data D2 corresponding to the judgment pattern data D1 that shows the judgment pattern that matches the processing pattern.

[0083] Here, the one or more judgment pattern data D1 and one or more modification pattern data D2 described above are classified into multiple cases.

[0084] <Case C1> Figure 6 shows an example of judgment pattern data D1 and correction pattern data D2 in Case C1.

[0085] The judgment pattern data D1 for case C1 includes the functions "Func0()" and "Func1()", as shown in Figure 6(a). In other words, this judgment pattern data D1 indicates a judgment pattern in which processing by function "Func0()" and processing by function "Func1()" are performed.

[0086] The process performed by the function "Func0()" described above executes the following operations: "uint8_tB

[1233] ;", "Func1();", and "B←B_Value;". The operation "uint8_tB

[1233] ;" allocates a 1233-byte area in memory for the variable B. The variable B will be stored in that area. The operation "Func1();" calls the function "Func1()". The operation "B←B_Value;" assigns the value "B_Value" to the variable B.

[0087] The above-mentioned function "Func1()" executes the following operations: "uint8_tA

[13312] ;", "A←A_Value;", and "FuncXX(A);". The operation "uint8_tA

[13312] ;" allocates a 13312-byte area in memory for variable A. Variable A will be stored in this area. The operation "A←A_Value;" assigns the value "A_Value" to variable A. The operation "FuncXX(A);" accesses the memory area for variable A and performs an operation using variable A in that area.

[0088] In the judgment pattern shown in judgment pattern data D1, the process "uint8_tB

[1233] ;" allocates memory for variable B, but before accessing that memory, memory for variable A is allocated and accessed. Furthermore, in this judgment pattern, the first access to the memory for variable B occurs after the last of the one or more accesses to the memory for variable A. In other words, in this judgment pattern, the predetermined access operations described above are performed. Therefore, the usage periods of variable A and variable B do not overlap. Note that variable A corresponds to the first variable described above, and variable B corresponds to the second variable described above. The target program P1 that shows a processing pattern matching this judgment pattern can be modified so that one memory area is shared for both variables A and B, that is, so that one memory area is reused. The modification pattern data D2 for case C1 shows a modification pattern for modifying the target program P1 as described above.

[0089] Specifically, the modification pattern data D2 for case C1 includes the functions "Func0()" and "Func1(B)", as shown in Figure 6(b). In other words, this modification pattern data D2 represents a modification pattern in which processing by function "Func0()" and processing by function "Func1(B)" are performed.

[0090] The process performed by the function "Func0()" described above executes the following operations: "uint8_tB

[13312] ;", "Func1(B);", and "B←B_Value;". The operation "uint8_tB

[13312] ;" allocates a 13312-byte area in memory for the variable B. The operation "Func1(B);" calls the function "Func1(B)".

[0091] The process performed by the function "Func1(B)" described above executes the processes "B←A_Value;" and "FuncXX(B);". The process "B←A_Value;" assigns the value "A_Value" to variable B. The process "FuncXX(B);" accesses the memory area of ​​variable B and performs an operation using variable B in that area. Note that the processes "B←A_Value;" and "FuncXX(B);" are equivalent to the processes "A←A_Value;" and "FuncXX(A);".

[0092] In the judgment pattern shown by judgment pattern data D1, a 13,312-byte area is allocated solely for variable A, and an additional 1,233-byte area is allocated solely for variable B. On the other hand, in the modification pattern shown by modification pattern data D2, only the largest of the 1,233-byte and 13,312-byte areas, 13,312 bytes, is allocated, and this area is used as a shared area for variables A and B. Therefore, if the processing pattern of the target program P1 matches the judgment pattern of judgment pattern data D1 in case C1, the modification execution unit 28 modifies the processing pattern of the target program P1 to match the modification pattern shown in modification pattern data D2 in case C1. This optimizes the memory used. In other words, it optimizes the target program P1.

[0093] Thus, in the determination pattern for case C1 in this embodiment, processing by the first function and processing by the second function are performed. In the example of Figure 6(a), the first function is the function "Func0()", and the second function is the function "Func1()". Processing by the first function allocates the second memory area, and then the second function is called. In the example of Figure 6(a), the second memory area is a 1233 byte area for variable B. Processing by the called second function allocates the first memory area, and then one or more accesses to the first memory area are performed. In the example of Figure 6(a), the first memory area is a 13312 byte area for variable A. In the example of Figure 6(a), one or more accesses to the first memory area include the access in the process "A←A_Value;" and the access in the process "FuncXX(A);". The processing by the first function involves one or more accesses to the second memory area after the processing by the second function has finished. In the example in Figure 6(a), the one or more accesses to the second memory area are accesses to the memory area for variable B, including the access in the process "B←B_Value;".

[0094] The processing target program P1, which shows a processing pattern that matches such a determination pattern, is modified by the modification execution unit 28 according to the modification pattern shown in the modification pattern data D2 in Figure 6(b). The modified program P2 generated by this modification is modified to include the modification pattern data D2.

[0095] Specifically, the modified program P2 defines that processing is performed by the first modified function and processing is performed by the second modified function. In the example in Figure 6(b), the first modified function is the function "Func0()", and the second modified function is the function "Func1(B)". Processing by the first modified function allocates a shared area, and then the second modified function is called. In the example in Figure 6(b), the shared area is a 13312 byte area. Processing by the called second modified function involves one or more accesses to the shared area for processing using the first variable. In the example in Figure 6(b), these one or more accesses include the access in the process "B←A_Value;" and the access in the process "FuncXX(B);". Processing by the first modified function further involves one or more accesses to the shared area for processing using the second variable after processing by the second modified function has finished. In the example in Figure 6(b), the one or more accesses include the access in the process "B←B_Value;".

[0096] Thus, in this embodiment, by using the determination pattern of case C1, it is possible to appropriately determine whether or not the predetermined access operation described above is performed, that is, whether or not the target program P1 can be optimized. Furthermore, in this embodiment, by using the modification pattern of case C1, the target program P1 that exhibits a processing pattern matching the determination pattern described above can be appropriately optimized.

[0097] <Case C2 and Case C2'> Figure 7 shows an example of judgment pattern data D1 and correction pattern data D2 in Case C2.

[0098] The judgment pattern data D1 for case C2 includes the functions "Func0()" and "Func1(B)", as shown in Figure 7(a). In other words, this judgment pattern data D1 indicates a pattern in which processing by function "Func0()" and processing by function "Func1(B)" are performed as the judgment pattern.

[0099] The process performed by the function "Func0()" described above executes the processes "uint8_tB

[1025] ;" and "Func1(B);". The process "uint8_tB

[1025] ;" allocates a 1025-byte area in memory for the variable B.

[0100] The processing performed by the function "Func1(B)" described above executes the following operations: "uint8_tA

[13312] ;", "A←A_Value;", "FuncXX(A);", "B←B_Value;", and "FuncYY(B);". The operation "FuncYY(B);" accesses the memory area of ​​variable B and performs an operation using variable B in that area.

[0101] In the judgment pattern shown in judgment pattern data D1, the process "uint8_tB

[1025] ;" allocates memory for variable B, but before accessing that memory, memory for variable A is allocated and accessed. Furthermore, in this judgment pattern, the first access to the memory for variable B occurs after the last of the one or more accesses to the memory for variable A. In other words, in this judgment pattern as well, the predetermined access operations described above are performed, similar to case C1. Therefore, the usage periods of variable A and variable B do not overlap. Note that variable A corresponds to the first variable described above, and variable B corresponds to the second variable described above. The target program P1 that shows a processing pattern matching this judgment pattern can be modified so that one memory area is shared for both variables A and B, that is, so that one memory area is reused. The modification pattern data D2 for case C2 shows a modification pattern for modifying the target program P1 as described above.

[0102] Specifically, the modification pattern data D2 for case C2 includes the functions "Func0()" and "Func1(B)", as shown in Figure 7(b). In other words, this modification pattern data D2 represents a modification pattern in which processing by the function "Func0()" and processing by the function "Func1(B)" are performed.

[0103] The process performed by the function "Func0()" described above executes the processes "uint8_tB

[13312] ;" and "Func1(B);". The process performed by the function "Func1(B)" executes the processes "B←A_Value;", "FuncXX(B);", "B←B_Value;", and "FuncYY(B);". Note that the processes "B←A_Value;" and "FuncXX(B);" are equivalent to the processes "A←A_Value;" and "FuncXX(A);".

[0104] In the judgment pattern shown by judgment pattern data D1, a 13,312-byte area is allocated solely for variable A, and an additional 1,025-byte area is allocated solely for variable B. On the other hand, in the modification pattern shown by modification pattern data D2, only the largest of the 1,025-byte and 13,312-byte areas, 13,312 bytes, is allocated, and this area is used as a shared area for variables A and B. Therefore, if the processing pattern of the target program P1 matches the judgment pattern of judgment pattern data D1 in case C2, the modification execution unit 28 modifies the processing pattern of the target program P1 to match the modification pattern shown in modification pattern data D2 in case C2. This optimizes the memory used. In other words, it optimizes the target program P1.

[0105] Thus, in the determination pattern for case C2 in this embodiment, processing is performed by the first function and processing is performed by the second function. In the example of Figure 7(a), the first function is the function "Func0()", and the second function is the function "Func1(B)". Processing by the first function allocates the second memory area, and then the second function is called. In the example of Figure 7(a), the second memory area is a 1025-byte area for variable B. Processing by the called second function allocates the first memory area, then accesses the first memory area one or more times, and then accesses the second memory area one or more times. In the example of Figure 7(a), the first memory area is a 13312-byte area for variable A. Also, in the example of Figure 7(a), the one or more accesses to the first memory area include the access in the process "A←A_Value;" and the access in the process "FuncXX(A);". Furthermore, in the example of Figure 7(a), one or more accesses to the second region include the access in the process "B←B_Value;" and the access in the process "FuncYY(B);".

[0106] The processing target program P1, which shows a processing pattern that matches such a determination pattern, is modified by the modification execution unit 28 according to the modification pattern shown in the modification pattern data D2 in Figure 7(b). The modified program P2 generated by the modification is modified to include the modification pattern data D2.

[0107] Specifically, the modified program P2 defines that processing is performed by the first modified function and processing is performed by the second modified function. In the example in Figure 7(b), the first modified function is the function "Func0()", and the second modified function is the function "Func1(B)". Processing by the first modified function allocates a shared area, and then the second modified function is called. In the example in Figure 7(b), the shared area is a 13312 byte area. Processing by the called second modified function involves one or more accesses to the shared area for processing using the first variable, and then one or more accesses to the shared area for processing using the second variable. In the example in Figure 7(b), the one or more accesses to the shared area for processing using the first variable include the access in the process "B←A_Value;" and the access in the process "FuncXX(B);". Furthermore, in the example of Figure 7(b), one or more accesses to the shared area performed for processing using the second variable include the access in the process "B←B_Value;" and the access in the process "FuncYY(B);".

[0108] Thus, in this embodiment, by using the determination pattern of case C2, it is possible to appropriately determine whether or not the above-mentioned predetermined access operation is performed, that is, whether or not the target program P1 can be optimized. Furthermore, in this embodiment, by using the modification pattern of case C2, the target program P1 that shows a processing pattern matching the above-mentioned determination pattern can be appropriately optimized.

[0109] In this case, in the judgment pattern data D1 and correction pattern data D2 in case C2, the function "Func0()" calls the function "Func1(B)". However, it is also possible that the functions defined in "Func1(B)" are executed by the function "Func0()" without the function "Func1(B)" being called.

[0110] Figure 8 shows the judgment pattern data D1 and the correction pattern data D2 in case C2'.

[0111] The judgment pattern data D1 for case C2' includes the function "Func0()", as shown in Figure 8(a). In other words, this judgment pattern data D1 indicates a pattern in which processing by the function "Func0()" is performed as the judgment pattern. The processing by the function "Func0()" executes the following processes: "uint8_tB

[1025] ;", "uint8_tA

[13312] ;", "A←A_Value;", "FuncXX(A);", "B←B_Value;", and "FuncYY(B);".

[0112] Even with the judgment pattern shown in the judgment pattern data D1, the predetermined access operation described above will be performed. Therefore, the usage period of variable A and the usage period of variable B will not overlap. The processing target program P1 that shows a processing pattern that matches such a judgment pattern can be modified so that one area is shared for variables A and B, that is, so that one area is reused. The modification pattern data D2 for case C2' shows a modification pattern for modifying the processing target program P1 as described above.

[0113] Specifically, the modification pattern data D2 for case C2' includes the function "Func0()", as shown in Figure 8(b). In other words, this modification pattern data D2 indicates a pattern in which processing by the function "Func0()" is performed as a modification pattern. The processing by the function "Func0()" executes the following processes: "uint8_tB

[13312] ;", "B←A_Value;", "FuncXX(B);", "B←B_Value;", and "FuncYY(B);".

[0114] In this example as well, if the processing pattern of the program P1 to be processed matches the determination pattern in the determination pattern data D1 of case C2', the modification execution unit 28 modifies the processing pattern of the program P1 to match the modification pattern shown in the modification pattern data D2 of case C2'. This optimizes the memory used. In other words, it optimizes the program P1 to be processed.

[0115] Thus, in the determination pattern for case C2' in this embodiment, the second region is secured, then the first region is secured, then the first region is accessed one or more times, and then the second region is accessed one or more times.

[0116] The processing target program P1, which shows a processing pattern that matches such a determination pattern, is modified by the modification execution unit 28 according to the modification pattern shown in the modification pattern data D2 in Figure 8(b). The modified program P2 generated by the modification is modified to include the modification pattern data D2. Specifically, the modified program P2 is defined to allocate a shared area, then access the shared area one or more times for processing using the first variable, and then access the shared area one or more times for processing using the second variable.

[0117] Thus, in this embodiment, by using the determination pattern of case C2', it is possible to appropriately determine whether or not the predetermined access operation described above is performed, that is, whether or not the target program P1 can be optimized. Furthermore, in this embodiment, by using the modification pattern of case C2', the target program P1 that exhibits a processing pattern matching the above determination pattern can be appropriately optimized.

[0118] <Case C3 and Case C3'> Figure 9 shows an example of judgment pattern data D1 and correction pattern data D2 in Case C3.

[0119] The judgment pattern data D1 for case C3 includes the functions "Func0()" and "Func1()", as shown in Figure 9(a). In other words, this judgment pattern data D1 indicates a judgment pattern in which processing by function "Func0()" and processing by function "Func1()" are performed.

[0120] The processing performed by the function "Func0()" described above executes the following processes: "uint8_tB

[1233] ;", "B←B_Value;", "FuncXX(B);", and "Func1();".

[0121] The process performed by the function "Func1()" described above executes the following operations: "uint8_tA

[13312] ;", "A←A_Value;", and "FuncYY(A);". The operation "FuncYY(A);" accesses the memory area of ​​variable A and performs an operation using variable A in that area.

[0122] In the judgment pattern shown in judgment pattern data D1, the first access to the area for variable A occurs after the last access to the area for variable B has been performed. In other words, in this judgment pattern as well, the predetermined access operation described above is performed, similar to cases C1 and C2. Therefore, the usage periods of variable A and variable B do not overlap. In case C3, variable B corresponds to the first variable described above, and variable A corresponds to the second variable described above. The processing target program P1 that shows a processing pattern that matches such a judgment pattern can be modified so that one area is shared for variables A and B, that is, so that one area is reused. The modification pattern data D2 for case C3 shows a modification pattern for modifying the processing target program P1 as described above.

[0123] Specifically, the modification pattern data D2 for case C3 includes the functions "Func0()" and "Func1(B)", as shown in Figure 9(b). In other words, this modification pattern data D2 represents a modification pattern in which processing by the function "Func0()" and processing by the function "Func1(B)" are performed.

[0124] The above-mentioned function "Func0()" executes the following processes: "uint8_tB

[13312] ;", "B←B_Value;", "FuncXX(B);", and "Func1(B);". The above-mentioned function "Func1(B)" executes the following processes: "B←A_Value;" and "FuncYY(B);". Note that the processes "B←A_Value;" and "FuncYY(B);" are equivalent to the processes "A←A_Value;" and "FuncYY(A);".

[0125] In the judgment pattern shown by the judgment pattern data D1, a 13,312-byte area is allocated solely for variable A, and an additional 1,233-byte area is allocated solely for variable B. On the other hand, in the modification pattern shown by the modification pattern data D2, only the largest of the 1,233-byte and 13,312-byte areas, 13,312 bytes, is allocated, and this area is used as a shared area for variables A and B. Therefore, if the processing pattern of the target program P1 matches the judgment pattern of the judgment pattern data D1 in case C3, the modification execution unit 28 modifies the processing pattern of the target program P1 to match the modification pattern shown in the modification pattern data D2 in case C3. This optimizes the memory used. In other words, it optimizes the target program P1.

[0126] Thus, in the determination pattern for case C3 in this embodiment, processing is performed by the first function and processing is performed by the second function. In the example of Figure 9(a), the first function is the function "Func0()", and the second function is the function "Func1()". The processing by the first function allocates the first memory area, then accesses the first memory area one or more times, and then the second function is called. In the example of Figure 9(a), the first memory area is a 1233-byte area for variable B. Also, in the example of Figure 9(a), the one or more accesses to the first memory area include the access in the process "B←B_Value;" and the access in the process "FuncXX(B);". In the processing by the called second function, the second memory area is allocated, and then accesses the second memory area one or more times. In the example of Figure 9(a), the second memory area is a 13312-byte area for variable A. Furthermore, in the example of Figure 9(a), one or more accesses to the second region include the access in the process "A←A_Value;" and the access in the process "FuncYY(A);".

[0127] The processing target program P1, which shows a processing pattern that matches such a determination pattern, is modified by the modification execution unit 28 according to the modification pattern shown in the modification pattern data D2 in Figure 9(b). The modified program P2 generated by the modification is modified to include the modification pattern data D2.

[0128] Specifically, the modified program P2 defines that processing is performed by the first modified function and processing is performed by the second modified function. In the example in Figure 9(b), the first modified function is the function "Func0()", and the second modified function is the function "Func1(B)". Processing by the first modified function allocates a shared area, then accesses the shared area one or more times for processing using the first variable (i.e., variable B), and then the second modified function is called. In the example in Figure 9(b), the shared area is a 13312 byte area. Also, in the example in Figure 9(b), the one or more accesses include access in the process "B←B_Value;" and access in the process "FuncXX(B);". Processing by the called second modified function involves accessing the shared area one or more times for processing using the second variable (i.e., variable A). In the example in Figure 9(b), the one or more accesses include the access in the process "B←A_Value;" and the access in the process "FuncYY(B);".

[0129] Thus, in this embodiment, by using the determination pattern of case C3, it is possible to appropriately determine whether or not the above-mentioned predetermined access operation is performed, that is, whether or not the target program P1 can be optimized. Furthermore, in this embodiment, by using the modification pattern of case C3, the target program P1 that shows a processing pattern matching the above-mentioned determination pattern can be appropriately optimized.

[0130] Here, in case C3, the judgment pattern data D1 and the correction pattern data D2 call the function "Func0()" either "Func1()" or "Func1(B)". However, the functions "Func0()" may execute each process defined in "Func1()" or "Func1(B)" without calling "Func1()" or "Func1(B)".

[0131] Figure 10 shows an example of judgment pattern data D1 and correction pattern data D2 in case C3'.

[0132] The judgment pattern data D1 for case C3' includes the function "Func0()", as shown in Figure 10(a). In other words, this judgment pattern data D1 indicates a pattern in which processing by the function "Func0()" is performed as the judgment pattern. The processing by the function "Func0()" executes the following processes: "uint8_tB

[1233] ;", "B←B_Value;", "uint8_tA

[13312] ;", "A←A_Value;", and "FuncYY(A);".

[0133] Even with the judgment pattern shown in the judgment pattern data D1, the predetermined access operation described above will be performed. Therefore, the usage period of variable A and the usage period of variable B will not overlap. The target program P1 that shows a processing pattern that matches such a judgment pattern can be modified so that one area is shared for variables A and B, that is, so that one area is reused. The modification pattern data D2 for case C3' shows a modification pattern for modifying the target program P1 as described above.

[0134] Specifically, the modification pattern data D2 for case C3' includes the function "Func0()", as shown in Figure 10(b). In other words, this modification pattern data D2 indicates a pattern in which processing by the function "Func0()" is performed as a modification pattern. The processing by the function "Func0()" executes the following processes: "uint8_tB

[13312] ;", "B←B_Value;", "FuncXX(B);", "B←A_Value;", and "FuncYY(B);".

[0135] In this example as well, if the processing pattern of the program P1 to be processed matches the determination pattern in the determination pattern data D1 of case C3', the modification execution unit 28 modifies the processing pattern of the program P1 to match the modification pattern shown in the modification pattern data D2 of case C3'. This optimizes the memory used. In other words, it optimizes the program P1 to be processed.

[0136] Thus, in the determination pattern for case C3' in this embodiment, the first region is secured, then the first region is accessed one or more times, then the second region is secured, and then the second region is accessed one or more times.

[0137] The processing target program P1, which shows a processing pattern that matches such a determination pattern, is modified by the modification execution unit 28 according to the modification pattern shown in the modification pattern data D2 in Figure 10(b). The modified program P2 generated by the modification is modified to include the modification pattern data D2. Specifically, in the modified program P2, similar to case C2', a shared area is allocated, then the shared area is accessed one or more times for processing using the first variable, and then the shared area is accessed one or more times for processing using the second variable.

[0138] Thus, in this embodiment, by using the determination pattern of case C3', it is possible to appropriately determine whether or not the above-mentioned predetermined access operation is performed, that is, whether or not the target program P1 can be optimized. Furthermore, in this embodiment, by using the modification pattern of case C3', the target program P1 that exhibits a processing pattern matching the above-mentioned determination pattern can be appropriately optimized.

[0139] <Case C4 and Case C4'> Figure 11 shows an example of judgment pattern data D1 and correction pattern data D2 in Case C4.

[0140] The judgment pattern data D1 for case C4 includes the functions "Func0()" and "Func1()", as shown in Figure 11(a). In other words, this judgment pattern data D1 indicates a judgment pattern in which processing by function "Func0()" and processing by function "Func1()" are performed.

[0141] The process performed by the function "Func0()" described above executes the following operations: "uint8_tB

[1233] ;", "B←B_Value1;", "FuncXX(B);", "Func1();", and "B←B_Value2;". The operation "B←B_Value1;" assigns the value "B_Value1" to the variable B. The operation "B←B_Value2;" assigns the value "B_Value2" to the variable B.

[0142] The processing performed by the function "Func1()" described above executes the following processes: "uint8_tA

[13312] ;", "A←A_Value;", and "FuncYY(A);".

[0143] Here, in the judgment pattern data D1, access to the memory area for variable B is distinguished between the period when the value "B_Value1" is assigned to variable B and the period when the value "B_Value2" is assigned to variable B. In other words, one or more accesses to the memory area for variable B during the period when the value "B_Value1" is assigned to variable B are distinguished from one or more accesses to the memory area for variable B during the period when the value "B_Value2" is assigned to variable B. Therefore, it can be said that one or more accesses to the memory area for variable B occur during the period when the value "B_Value1" is assigned to variable B, and one or more new accesses to the memory area for variable B occur during the period when the value "B_Value2" is assigned to variable B. In other words, one or more accesses to the memory area for the variable B mentioned above consist of the access in the process "B←B_Value1;" and the access in the process "FuncXX(B);", but do not include the access in the process "B←B_Value2;".

[0144] Therefore, in the judgment pattern shown in the judgment pattern data D1, the first access to the area for variable A occurs after the last access to the area for variable B has been performed. The last access mentioned above is the access in the process "FuncXX(B);". In other words, in this judgment pattern as well, the predetermined access operation described above is performed, just like in cases C1, C2, and C3. Therefore, the usage period of variable A and the usage period of variable B to which the value "B_Value1" is assigned do not overlap. In case C4, as in case C3, variable B corresponds to the first variable mentioned above, and variable A corresponds to the second variable mentioned above. The target program P1 that shows a processing pattern matching such a judgment pattern can be modified so that one area is shared for variables A and B, that is, so that one area is reused. The modification pattern data D2 for case C4 shows a modification pattern for modifying the target program P1 as described above.

[0145] Specifically, the modification pattern data D2 for case C4 includes the functions "Func0()" and "Func1(B)", as shown in Figure 11(b). In other words, this modification pattern data D2 represents a modification pattern in which processing by the function "Func0()" and processing by the function "Func1(B)" are performed.

[0146] The process performed by the function "Func0()" described above executes the following operations: "uint8_tB

[13312] ;", "B←B_Value1;", "FuncXX(B);", "Func1(B);", and "B←B_Value2;". The process performed by the function "Func1(B)" described above executes the following operations: "B←A_Value;" and "FuncYY(B);". Note that the operations "B←A_Value;" and "FuncYY(B);" are equivalent to the operations "A←A_Value;" and "FuncYY(A);".

[0147] In the judgment pattern shown by the judgment pattern data D1, a 13,312-byte area is allocated solely for variable A, and an additional 1,233-byte area is allocated solely for variable B. On the other hand, in the modification pattern shown by the modification pattern data D2, only the largest of the 1,233-byte and 13,312-byte areas, 13,312 bytes, is allocated, and this area is used as a shared area for variables A and B. Therefore, if the processing pattern of the target program P1 matches the judgment pattern of the judgment pattern data D1 in case C4, the modification execution unit 28 modifies the processing pattern of the target program P1 to match the modification pattern shown in the modification pattern data D2 in case C4. This optimizes the memory used. In other words, it optimizes the target program P1.

[0148] Thus, in the determination pattern for case C4 in this embodiment, processing is performed by the first function and processing is performed by the second function. In the example of Figure 11(a), the first function is the function "Func0()", and the second function is the function "Func1()". In the processing by the first function, the first memory area is allocated, then the first memory area is accessed one or more times, and then the second function is called. In the example of Figure 11(a), the first memory area is a 1233 byte area for variable B. Also, in the example of Figure 11(a), the one or more accesses to the first memory area include the access in the process "B←B_Value1;" and the access in the process "FuncXX(B);". In the processing by the called second function, the second memory area is allocated, and then the second memory area is accessed one or more times. In the example of Figure 11(a), the second memory area is a 13312 byte area for variable A. Furthermore, in the example of Figure 11(a), one or more accesses to the second area include the access in the process "A←A_Value;" and the access in the process "FuncYY(A);". In the processing by the first function, one or more new accesses to the first area occur after the processing by the second function has finished. In the example of Figure 11(a), one or more new accesses to the first area include the access in the process "B←B_Value2;".

[0149] Furthermore, the value of the first variable stored in the first area differs between the first period, during which one or more accesses to the first area occur, and the second period, during which one or more new accesses to the first area occur. In the example in Figure 11(a), the first period is the period during which the processes "B←B_Value1;" and "FuncXX(B);" are performed. During this first period, the value of the first variable stored in the first area is "B_Value1". On the other hand, the second period is the period during which the process "B←B_Value2;" is performed. During this second period, the value of the first variable stored in the first area is "B_Value2". Thus, the value of the first variable stored in the first area differs between the first and second periods.

[0150] The processing target program P1, which shows a processing pattern that matches such a determination pattern, is modified by the modification execution unit 28 according to the modification pattern shown in the modification pattern data D2 in Figure 11(b). The modified program P2 generated by the modification is modified to include the modification pattern data D2.

[0151] Specifically, the modified program P2 defines that processing is performed by the first modified function and processing is performed by the second modified function. In the example in Figure 11(b), the first modified function is the function "Func0()", and the second modified function is the function "Func1(B)". Processing by the first modified function allocates a shared area, then accesses the shared area one or more times for processing using the first variable (i.e., variable B), and then the second modified function is called. In the example in Figure 11(b), the shared area is a 13312 byte area. Also, in the example in Figure 11(b), the one or more accesses include the access in the process "B←B_Value1;" and the access in the process "FuncXX(B);". Processing by the called second modified function involves accessing the shared area one or more times for processing using the second variable (i.e., variable A). In the example in Figure 11(b), the one or more accesses include the access in the process "B←A_Value;" and the access in the process "FuncYY(B);". In the processing by the modified first function, after the processing by the modified second function is completed, one or more accesses to the shared area are made for a new process using the first variable. In the example in Figure 11(b), the one or more accesses include the access in the process "B←B_Value2;".

[0152] Furthermore, the value of the first variable stored in the shared area differs between the third period, when the shared area is accessed at least once for processing using the first variable, and the fourth period, when the shared area is accessed at least once for new processing using the first variable. In the example in Figure 11(b), the third period is the period during which the processes "B←B_Value1;" and "FuncXX(B);" are performed. In this third period, the value of the first variable stored in the shared area is "B_Value1". On the other hand, the fourth period is the period during which the process "B←B_Value2;" is performed. In this fourth period, the value of the first variable stored in the shared area is "B_Value2". Thus, the value of the first variable stored in the shared area differs between the third and fourth periods.

[0153] Thus, in this embodiment, by using the determination pattern of case C4, it is possible to appropriately determine whether the above-mentioned predetermined access operation is performed, that is, whether the program P1 to be processed can be optimized or not. For example, if one or more accesses to the first area, one or more accesses to the second area, and one or more accesses to the first area are performed in that order, the above-mentioned predetermined access operation will not be performed. However, if the value of the first variable stored in the first area is different between the one or more accesses to the first area performed before the one or more accesses to the second area and the one or more accesses to the first area performed afterward, the above-mentioned predetermined access operation will be performed. In other words, the last of the one or more accesses to the first area performed earlier can be treated as the final access to the first area. The determination pattern of case C4 specifies that the value of the first variable stored in the first area is different before and after one or more accesses to the second area. Therefore, by using this determination pattern, it is possible to appropriately determine whether the program P1 to be processed can be optimized or not. Furthermore, in this embodiment, by using the modification pattern of case C4, the processing target program P1 that shows a processing pattern matching the above-mentioned determination pattern can be appropriately optimized.

[0154] Here, in case C4, the judgment pattern data D1 and the correction pattern data D2 call the function "Func0()" either the function "Func1()" or the function "Func1(B)". However, the functions "Func1()" or "Func1(B)" may be executed by the function "Func0()" without the function "Func1()" or "Func1(B)" being called.

[0155] Figure 12 shows an example of judgment pattern data D1 and correction pattern data D2 in case C4'.

[0156] The judgment pattern data D1 for case C4' includes the function "Func0()", as shown in Figure 12(a). In other words, this judgment pattern data D1 indicates a pattern in which processing by the function "Func0()" is performed as the judgment pattern. The processing by the function "Func0()" executes the following processes: "uint8_tB

[1233] ;", "B←B_Value1;", "FuncXX(B);", "uint8_tA

[13312] ;", "A←A_Value;", "FuncYY(A);", and "B←B_Value2;".

[0157] Even with the judgment pattern shown in the judgment pattern data D1, the predetermined access operation described above is performed. Therefore, the usage period of variable A and the usage period of variable B to which the value "B_Value1" is assigned do not overlap. The target program P1 that shows a processing pattern matching such a judgment pattern can be modified so that one area is shared for variables A and B, that is, so that one area is reused. The modification pattern data D2 for case C4' shows a modification pattern for modifying the target program P1 as described above.

[0158] Specifically, the modification pattern data D2 for case C4' includes the function "Func0()", as shown in Figure 12(b). In other words, this modification pattern data D2 indicates a pattern in which processing by the function "Func0()" is performed as a modification pattern. The processing by the function "Func0()" executes the following processes: "uint8_tB

[13312] ;", "B←B_Value1;", "FuncXX(B);", "B←A_Value;", "FuncYY(B);", and "B←B_Value2;".

[0159] In this example as well, if the processing pattern of the program P1 to be processed matches the determination pattern in the determination pattern data D1 of case C4', the modification execution unit 28 modifies the processing pattern of the program P1 to match the modification pattern shown in the modification pattern data D2 of case C4'. This optimizes the memory used. In other words, it optimizes the program P1 to be processed.

[0160] Thus, in the determination pattern for case C4' in this embodiment, the first region is allocated, then the first region is accessed one or more times, then the second region is allocated, then the second region is accessed one or more times, and then the first region is accessed one or more times again. The value of the first variable stored in the first region is different between the first period in which the first region is accessed one or more times and the second period in which the first region is accessed one or more times again.

[0161] The program P1 to be processed, which shows a processing pattern that matches such a determination pattern, is modified by the modification execution unit 28 according to the modification pattern shown in the modification pattern data D2 in Figure 12(b). The modified program P2 generated by the modification is modified to include the modification pattern data D2. Specifically, the modified program P2 is defined to allocate a shared area, then access the shared area one or more times for processing using the first variable, then access the shared area one or more times for processing using the second variable, and then access the shared area one or more times for new processing using the second variable. The shared area is a 13,312-byte area in the example shown in Figure 12(b). The value of the first variable stored in the shared area is different between the third period, when the shared area is accessed one or more times for processing using the first variable, and the fourth period, when the shared area is accessed one or more times for new processing using the first variable.

[0162] Thus, in this embodiment, by using the determination pattern of case C4', it is possible to appropriately determine whether or not the above-mentioned predetermined access operation is performed, that is, whether or not the target program P1 can be optimized. Furthermore, in this embodiment, by using the modification pattern of case C4', the target program P1 that shows a processing pattern matching the above-mentioned determination pattern can be appropriately optimized.

[0163] The judgment pattern data D1 and correction pattern data D2 for cases C1 to C4 and C2' to C4' described above are examples, and the number of bytes in the area, for example, is not limited to the examples above. Also, one or more accesses to an area such as the first or second area may refer to all accesses to that area performed by the processing target program P1.

[0164] <Processing Flow> Figure 13 is a sequence diagram showing an example of the processing operation of the user device 10, the analysis device 20, and the pattern providing device 30.

[0165] First, the pattern providing device 30 transmits one or more judgment pattern data D1 and one or more correction pattern data D2 to the analysis device 20 (step S1). When the analysis device 20 receives the one or more judgment pattern data D1 and one or more correction pattern data D2 from the pattern providing device 30, it stores them in the second storage unit 25 (step S2).

[0166] Next, the user device 10 transmits the program to be processed P1 to the analysis device 20 (step S3). When the analysis device 20 receives the program to be processed P1 from the user device 10, it performs a modification process on the program to be processed P1 (step S4). At this time, the analysis device 20 performs the modification process by using one or more judgment pattern data D1 and one or more modification pattern data D2 stored in the second storage unit 25. Then, the analysis device 20 transmits the modified program P2 generated by the modification process to the user device 10 (step S5).

[0167] Figure 14 is a flowchart showing an example of the correction process performed by the analysis device 20.

[0168] First, the second communication unit 24 of the analysis device 20 receives the program to be processed P1 from the user device 10 (step S11). In other words, the second communication unit 24 acquires the program to be processed P1. Next, the analysis unit 27 determines whether a predetermined access operation to memory will be performed by the execution of the program to be processed P1 by analyzing the program to be processed P1 (step S12). In other words, the analysis unit 27 determines whether it is possible to modify the program to be processed P1. If the analysis unit 27 determines that a predetermined access operation will be performed (Yes in step S12), that is, if it is determined that it is possible to modify the program to be processed P1, the modification execution unit 28 modifies the program to be processed P1 (step S13). As a result of this modification, a modified program P2 is generated and output. Then, the second communication unit 24 transmits the modified program P2 to the user device 10 (step S14).

[0169] Furthermore, if the analysis device 20 determines that a predetermined access operation is not performed (No. in step S12), that is, if it determines that it is impossible to modify the program P1 to be processed, it terminates all processing on the program P1 to be processed without executing the processes in steps S13 and S14.

[0170] Figure 15 is a flowchart illustrating an example of the processing operation of the analysis unit 27 and the correction execution unit 28 included in the analysis device 20. In other words, Figure 15 is a flowchart that shows in detail the processing of steps S12 and S13 in Figure 14.

[0171] First, the analysis unit 27 initializes the variable i to its initial value (for example, 1) (step S21). Next, the analysis unit 27 selects the i-th line of the program P1 to be processed, which is specified by the variable i (step S22). Then, by analyzing the i-th line, the analysis unit 27 determines whether the first or last access to the variable's area has occurred, or whether the variable has been declared. As a result, the analysis unit 27 determines whether the processing pattern in the range from the reference line to the i-th line of the program P1 to be processed matches the determination pattern (step S23). In other words, it determines whether there are any modifications in that range. The determination pattern is the determination pattern indicated by one or more determination pattern data D1 stored in the second storage unit 25. In other words, in step S23, it is determined whether a predetermined access operation is performed by executing the range specified by the variable i. The reference line mentioned above may be the first line, the last line, or any other line of the program P1 to be processed. The i-th row is the i-th row from the reference row. Note that the above range is an example and is not particularly limited.

[0172] Here, if the analysis unit 27 determines that the processing pattern matches the determination pattern (Yes in step S23), that is, if it is determined that a predetermined access operation will be performed, the modification execution unit 28 modifies the target program P1 according to the modification pattern (step S24). In other words, the modification execution unit 28 modifies the part of the target program P1 that corresponds to the processing pattern according to the modification pattern corresponding to the determination pattern that matches the processing pattern. The modification pattern is shown in the modification pattern data D2 stored in the second storage unit 25. On the other hand, if the analysis unit 27 determines that the processing pattern does not match the determination pattern (No in step S23), the process in step S24 is not executed, and the process in step S25 is executed.

[0173] After the processing in step S24 is performed, or if the analysis unit 27 determines that the processing pattern does not match the determination pattern (No. in step S23), the analysis unit 27 determines whether the variable i satisfies i = n (step S25). Here, n is, for example, the total number of lines included in the program P1 to be processed, and is an integer of 2 or more. If the analysis unit 27 determines that the variable i does not satisfy i = n (No. in step S25), it performs an increment on the variable i (step S26). Then, the analysis unit 27 and the correction execution unit 28 repeatedly execute the processing from step S22.

[0174] On the other hand, if the analysis unit 27 determines that the variable i satisfies i = n (Yes in step S25), the correction execution unit 28 outputs the corrected program P2 obtained by the processing in step S24 one or more times (step S27). If the processing in step S24 has not been performed even once, the correction execution unit 28 does not execute the processing in step S27.

[0175] As described above, in this embodiment, if it is determined that a predetermined access operation will be performed, the program to be processed P1 is modified to be optimized. In other words, when such an access operation is performed, the period during which one or more accesses to the first area are performed does not overlap with the period during which one or more accesses to the second area are performed. Therefore, in such cases, for example, the program to be processed P1 can be modified so that the larger of the first and second areas is reserved as a shared area for the first and second variables. Thus, in this embodiment, the program to be processed P1 is modified as described above, and the modified program P2, which is the modified program to be processed P1, is output. As a result, when the modified program P2 is executed, the two areas, the first and second areas, are not reserved, and for example, only one of the first and second areas is reserved as a shared area. In other words, that one area is reused. This effectively reduces the area reserved in memory by the execution of the modified program P2. In other words, optimization of the program to be processed P1 or memory can be achieved.

[0176] Furthermore, in this embodiment, if the processing pattern matches the determination pattern, it is determined that a predetermined access operation will be performed, and if the processing pattern does not match any of the determination patterns, it is determined that a predetermined access operation will not be performed. Therefore, it is possible to easily determine whether or not the access operation will be performed, that is, to analyze the program P1 to be processed.

[0177] Conventional compilers may modify the source code when compiling it. However, unlike in this embodiment, the compiler does not determine whether the predetermined access operation described above will occur, nor does it modify the source code based on the result of that determination. Conventional garbage collection automatically deletes variables that are no longer used, thereby reusing the memory space for other variables. However, garbage collection does not modify the program, and it is necessary to separately allocate memory space for the aforementioned reuse. Furthermore, in the information processing method described in Patent Document 1, processing is performed using a memory pool, but even with this memory pool processing, no program modification is performed, and a large area is allocated in memory all at once in advance. Therefore, the information processing method in this embodiment can achieve further memory optimization compared to conventional compilers, garbage collection, and memory pools.

[0178] (Modification 1) In the above embodiment, as shown in Figure 15, the analysis device 20 corrects the parts that need to be corrected each time a part needs to be corrected is found in the program P1 to be processed. In Modification 1, the analysis device identifies all the parts that need to be corrected from the program P1 to be processed, and then corrects all of those parts at once.

[0179] Figure 16 is a block diagram showing an example of the configuration of the analysis device in modified example 1.

[0180] The analysis device 20a in Modification 1 comprises the components of the analysis device 20 and further includes a storage unit 26. The storage unit 26 is a recording medium for storing the modification location data D3. Such a storage unit 26 may be a non-volatile recording medium such as a hard disk drive or SSD. The modification location data D3 is data indicating one or more modification locations included in the program P1 to be processed.

[0181] Figure 17 is a flowchart showing an example of the processing operation of the analysis device 20a and the modification execution unit 28 in the modified example 1.

[0182] First, the analysis unit 27 executes the processes in steps S21 to S23, similar to the flowchart shown in Figure 15. Then, if the analysis unit 27 determines that the processing pattern matches the determination pattern (Yes in step S23), it updates the modification location data D3 stored in the storage unit 26 (step S24a). In other words, the analysis unit 27 updates the modification location data D3 so that the parts of the program P1 to be processed that correspond to the processing pattern that matches the determination pattern are indicated as modification locations in the modification location data D3. Therefore, in the modified example 1, even if it is determined in step S23 that the processing pattern matches the determination pattern, the modification of the program P1 to be processed is not immediately executed, and the modification location data D3 is updated so that the above-mentioned modification locations are indicated. The modification locations indicate, for example, the variable to be modified, the area reserved for that variable, etc. Then, the analysis unit 27 executes the processes in steps S25 and S26, similar to the flowchart shown in Figure 15.

[0183] Furthermore, in step S25, if the analysis unit 27 determines that the variable i satisfies i = n (Yes in step S25), the modification execution unit 28 performs modifications to the program P1 to be processed (step S24b). That is, the modification execution unit 28 reads the modification location data D3 from the storage unit 26, identifies each modification location indicated in the modification location data D3, and modifies each modification location in the program P1 to be processed according to the modification pattern. Then, the modification execution unit 28 outputs the modified program P2 obtained by the execution of step S24b (step S27). Note that if the processing in step S24a has not been performed even once, that is, if the modification location data D3 has not been updated even once, the modification execution unit 28 does not perform the processing in step S27.

[0184] Thus, in this modified example 1, since all modifications are made at once, it may be possible to quickly optimize the program P1 being processed.

[0185] (Modification 2) In the above embodiment, the analysis device 20 determines whether a predetermined access operation is performed, that is, whether the program P1 to be processed can be modified, by using the determination pattern data D1. In Modification 2, the analysis device 20 makes the determination using a coordinate space that shows the memory usage status over time, without using the determination pattern data D1.

[0186] Figure 18 is a diagram illustrating the determination made by the analysis device 20 in the modified example 2.

[0187] In the modified example 2, the analysis unit 27 of the analysis device 20 arranges variable coordinate regions 41 to 45 in the coordinate space, for example, as shown in Figure 18(a). The coordinate space has a first axis representing time (i.e., the time axis) and a second axis representing each region in memory. The variable coordinate region 41 is the coordinate region of variable A included in the program P1 to be processed, and is defined by the period from the first access to the region allocated in memory for variable A until the last access, and the region itself. In other words, the variable coordinate region 41 is defined by the range on the first axis corresponding to the above-mentioned period and the range on the second axis corresponding to the above-mentioned region. The variable coordinate region 42 is the coordinate region of variable B included in the program P1 to be processed, and is defined similarly to the variable coordinate region 43. The variable coordinate region 43 is the coordinate region of variable C included in the program P1 to be processed, and is defined similarly to the variable coordinate region 41. The variable coordinate region 44 and the variable coordinate region 45 are each the coordinate regions of variable D included in the program P1 to be processed, and are defined similarly to the variable coordinate region 41. However, variable coordinate region 44 is the coordinate region when the value "D_Value1" is assigned to variable D, and variable coordinate region 45 is the coordinate region when the value "D_Value2" is assigned to variable D. Note that the values ​​"D_Value1" and "D_Value2" are different values. In this way, each variable coordinate region placed in the coordinate space is distinguished by the type of variable and the value assigned to that variable.

[0188] Then, as shown in Figure 18(b), the analysis unit 27 determines that a predetermined access operation can be performed if at least one of the variable coordinate regions 41 to 45 can be moved along the second axis direction without overlapping with the other variable coordinate regions. If there is space in the second axis direction of a variable coordinate region, that variable coordinate region can move along the second axis direction. In the example of Figure 18, the analysis unit 27 determines that a predetermined access operation can be performed, that is, the program P1 to be processed can be modified, because the variable coordinate regions 42 to 45 can be moved along the second axis direction without overlapping with the variable coordinate region 41. In other words, the analysis unit 27 determines that optimization is possible for variables A, B, and D, and determines that the region of variable A can be used as a shared region. As a result, the modification execution unit 28 modifies the program P1 to be processed so that a shared region shared by variables A, B, and D is secured.

[0189] Thus, in the modified example 2, the analysis unit 27 places a first variable coordinate region and a second variable coordinate region in a coordinate space having a first axis representing time and a second axis representing each region in memory. The analysis unit 27 then determines that the predetermined access operation described above is performed when it is possible to approach the first variable coordinate region and the second variable coordinate region along the second axis direction without overlapping. Here, the first variable coordinate region is a coordinate region determined by the range of the first axis corresponding to the period during which one or more accesses to the first region occur, and the range of the second axis corresponding to the first region. The second variable coordinate region is a coordinate region determined by the range of the first axis corresponding to the period during which one or more accesses to the second region occur, and the range of the second axis corresponding to the second region. The first region is the region reserved for the first variable, and the second region is the region reserved for the second variable.

[0190] Thus, in the modified example 2, by using a coordinate space, the timing and region in which each variable is used can be easily grasped, and it is possible to appropriately determine whether or not the predetermined access operation described above is performed.

[0191] (Modification 3) In the above embodiment, the analysis device 20 performs the processes of steps S21 to S27 once, as shown in Figure 15. In Modification 3, the analysis device 20 repeatedly performs the processes of steps S21 to S27.

[0192] Figure 19 is a flowchart showing an example of the processing operation of the analysis unit 27 and the modification execution unit 28 included in the analysis device 20 in Modification 3.

[0193] The analysis unit 27 and the modification execution unit 28 execute a series of processes from steps S21 to S27, similar to the embodiment described above. Then, as shown in Figure 19, when the modified program P2 is output in step S27, the analysis unit 27 determines whether or not the termination condition has been met (step S28). The termination condition may be, for example, that the number of times the series of processes from steps S21 to S27 has been performed has reached a predetermined number of times. If the analysis unit 27 and the modification execution unit 28 determine that the termination condition has not been met (No in step S28), they repeatedly execute the processes from step S21. At this time, the modified program P2 output in step S27 is treated as a new program to be processed P1 in the subsequent steps S21 to S27. On the other hand, if the analysis unit 27 and the modification execution unit 28 determine that the termination condition has been met (Yes in step S28), they terminate all processing for the program to be processed P1.

[0194] As a result, parts of the program P1 that were not optimized by the series of processes in steps S21 to S27 may be optimized by the subsequent series of processes in steps S21 to S27.

[0195] (Modification 4) In the above embodiment, the analysis device 20 modifies the program P1 to be processed so that one shared area is reserved for two variables. In Modification 4, the analysis device 20 modifies the program P1 to be processed so that one shared area is reserved for three variables.

[0196] Figure 20 shows an example of the judgment pattern data D1 and the modified pattern data D2 in Modification 4. The judgment pattern data D1 and the modified pattern data D2 in Modification 4 are modified versions of the judgment pattern data D1 and the modified pattern data D2 in Case C1 shown in Figure 6, with the modifications for variables A, B, and C. Furthermore, in the program P1 to be processed in Modification 4, not only are the processes for variables A and B defined, but the allocation of a third memory area for variable C and the processing using variable C are also defined.

[0197] In the modified example 4, the judgment pattern data D1 includes the functions "Func0()", "Func1()", and "Func2()", as shown in Figure 20(a). In other words, this judgment pattern data D1 indicates a judgment pattern in which processing by the function "Func0()", processing by the function "Func1()", and processing by the function "Func2()" are performed.

[0198] The process performed by the function "Func0()" described above executes the following: process "uint8_tB

[1233] ;", process "Func1();", process "Func2();", and process "B←B_Value;". The process "Func2();" is a call to the function "Func2()". The process performed by the function "Func1()" described above executes the following: process "uint8_tA

[13312] ;", process "A←A_Value;", and process "FuncXX(A);".

[0199] The above-mentioned function "Func2()" executes the following operations: "uint8_tC

[10] ;", "C←C_Value;", and "FuncYY(C);". The operation "uint8_tC

[10] ;" allocates a 10-byte area (i.e., the third area) in memory for the variable C. The operation "C←C_Value;" assigns the value "C_Value" to the variable C. The operation "FuncYY(C);" accesses the area of ​​variable C in memory and performs an operation using the variable C in that area.

[0200] In the judgment pattern shown in judgment pattern data D1, the process "uint8_tB

[1233] ;" allocates memory for variable B, but processing for variables A and C is performed before access to that memory. That is, memory is allocated for variable A and accessed, and then memory is allocated for variable C and accessed. In addition, in this judgment pattern, the first access to the memory for variable C occurs after the last access of one or more accesses to the memory for variable A. Furthermore, in this judgment pattern, the first access to the memory for variable B occurs after the last access of one or more accesses to the memory for variable C. In other words, the predetermined access operations described above are performed in this judgment pattern as well. Therefore, the usage periods of variable A, variable B, and variable C do not overlap. Note that variables A, B, and C correspond to the first, second, and third variables, respectively. A processing target program P1 that exhibits a processing pattern matching such a determination pattern can be modified so that one area is shared for variables A, B, and C, that is, so that one area is reused. The modification pattern data D2 in the modified example 4 shows a modification pattern for modifying the processing target program P1 as described above.

[0201] Specifically, the modified pattern data D2 in modified example 4 includes the functions "Func0()", "Func1(B)", and "Func2(B)", as shown in Figure 20(b). In other words, this modified pattern data D2 represents a modified pattern in which processing by the function "Func0()", processing by the function "Func1(B)", and processing by the function "Func2(B)" are performed.

[0202] In the processing performed by the function "Func0()" described above, the processes "uint8_tB

[13312] ;", "Func1(B);", "Func2(B);", and "B←B_Value;" are executed. The process "Func2(B);" is a call to the function "Func2(B)". In the processing performed by the function "Func1(B)" described above, the processes "B←A_Value;" and "FuncXX(B);" are executed.

[0203] The process performed by the function "Func2(B)" described above executes the processes "B←C_Value;" and "FuncYY(B);". The process "B←C_Value;" assigns the value "C_Value" to the variable B. The process "FuncYY(B);" accesses the memory area of ​​variable B and performs an operation using variable B in that area. Note that the processes "B←C_Value;" and "FuncYY(B);" are equivalent to the processes "C←C_Value;" and "FuncYY(C);".

[0204] In the determination pattern shown by the determination pattern data D1, a 13,312-byte area is allocated solely for variable A, a 1,233-byte area is allocated solely for variable B, and a 10-byte area is allocated solely for variable C. On the other hand, in the modification pattern shown by the modification pattern data D2, only the largest of the 10-byte, 1,233-byte, and 13,312-byte areas, 13,312 bytes, is allocated, and this area is used as a shared area for variables A, B, and C. Therefore, if the processing pattern of the target program P1 matches the determination pattern of the determination pattern data D1 in the modified example 4, the modification execution unit 28 modifies the processing pattern of the target program P1 to match the modification pattern shown in the modification pattern data D2 in the modified example 4. This optimizes the memory used. In other words, it optimizes the target program P1.

[0205] Thus, in the modified example 4, the predetermined access operations used to determine whether or not to modify the program P1 to be processed are operations related to three variables. Specifically, the predetermined access operations are such that the final access to the first variable (i.e., variable A) is performed, followed by the initial access to the third variable (i.e., variable C), and then, after the final access to the third variable, the initial access to the second variable (i.e., variable B) is performed. The final access to the first variable is, specifically, the final access among one or more accesses to the first area performed for processing using the first variable. The initial access to the third variable is, specifically, the initial access among one or more accesses to the third area performed for processing using the third variable. The final access to the third variable is, specifically, the final access among one or more accesses to that third area. In the example of Figure 20(b), the one or more accesses to the third area performed for processing using the third variable include the access in the process "C←C_Value;" and the access in the process "FuncYY(C);". In the example of Figure 20(b), the first access among those accesses is the access in the process "C←C_Value;", and the last access is the access in the process "FuncYY(C);". Specifically, the first access of the second variable is the first access among the one or more accesses to the second area performed for processing using the second variable. The modification execution unit 28 modifies the target program P1 according to the modification pattern shown in the modification pattern data D2 in the modified example 4. In other words, the modification execution unit 28 modifies the target program P1 so that one area secured by the execution of the target program P1 is secured as a shared area for the first variable, the second variable, and the third variable, and that this shared area is accessed at different timings for processing using the first variable, processing using the second variable, and processing using the third variable. In the example of Figure 20(b), this shared area is a 13312-byte area.

[0206] As a result, in the modified example 4, the program P1 being processed, which allocates three memory areas not only for the first and second variables but also for the third variable, is modified into the modified program P2, which allocates one shared memory area for those three variables. Therefore, further optimization of the program P1 being processed and memory can be achieved.

[0207] (Modification 5) In the above embodiment, the analysis device 20 modifies the variables included in the program P1 to be processed, regardless of the type of variable. In Modification 5, the analysis device 20 finds multiple variables used in Classic McElice calculations from the program P1 to be processed and modifies those variables. Classic McElice is an encryption method, specifically one of the Post-Quantum Cryptography (PQC) encryption methods.

[0208] Figure 21 is a flowchart showing an example of the processing operation of the analysis unit 27 and the modification execution unit 28 included in the analysis device 20 in Modification 5.

[0209] The analysis unit 27 and the correction execution unit 28 perform the processing in steps S21 to S27, as well as the processing in step S30, in the same manner as in the above embodiment. For example, when the i-th row is selected in step S22, the analysis unit 27 identifies the range from the reference row to the i-th row in the program P1 to be processed, and determines whether or not a Classic McElice operation is performed in that range (step S30). Classic McElice operations include, for example, inverse matrix calculation, matrix permutation, and error correction. Inverse matrix calculation is used to store the result of FFT (fast Fourier transform). For example, the decrypt function is used for the inverse matrix calculation. For example, the benes_8192 function is used for matrix permutation. For example, the bm_128_gfu32_bs function, bm_gfu32 function, etc. are used for error correction.

[0210] Here, if the analysis unit 27 determines that a Classic McEliece calculation is to be performed (Yes in step S30), it executes the process in step S23. At this time, the analysis unit 27 determines whether or not the processing pattern using multiple variables used in the Classic McEliece calculation matches the determination pattern (step S23). On the other hand, if the analysis unit 27 determines that a Classic McEliece calculation is not to be performed (No in step S30), it executes the process in step S25.

[0211] Furthermore, the Classic McElice operation may include at least a part of the decoding process. For example, the crypto_kem_dec function may be used for at least a part of that decoding process.

[0212] Thus, in Modification 5, the first and second variables are variables used in the calculation of the encryption scheme Classic McElice. Furthermore, the number of variables used in the calculation is not limited to two, but may be three or four or more. This allows for effective optimization of the program that performs the Classic McElice calculation, which requires a large amount of memory. Therefore, Classic McElice can be easily implemented in low-resource IoT (Internet of Things) devices.

[0213] <Other Embodiments> The information processing system 1 and information processing method relating to this disclosure have been described above based on the above embodiments and modifications 1 to 5. However, this disclosure is not limited to these embodiments and modifications 1 to 5. As long as they do not depart from the spirit of this disclosure, various modifications that a person skilled in the art could conceive of are also included within the scope of this disclosure. Furthermore, forms constructed by combining at least two of the modifications 1 to 5 may also be included in this disclosure.

[0214] For example, in the above embodiments and modifications 1 to 5, the analysis device 20 modifies the source code of the program to be processed P1, but the modification may also be performed when compiling the program to be processed P1. As a result, the modified machine code program P2 is output as the optimized program to be processed P1.

[0215] Furthermore, in the above embodiments and modifications 1 to 5, the program to be processed P1 is source code, but it may be compiled. In other words, the program to be processed P1 may be machine code. In this case, the analysis device 20 outputs a modified machine code program P2 by modifying the machine code program to be processed P1.

[0216] Furthermore, in the above embodiments and modifications 1 to 5, the analysis device 20 receives one or more optimization pattern data from the pattern providing device 30. The optimization pattern data is a pair of corresponding judgment pattern data D1 and correction pattern data D2. Here, the third control unit 31 of the pattern providing device 30 may store one or more new optimization pattern data in the third storage unit 35. Alternatively, the third control unit 31 may update one or more optimization pattern data stored in the third storage unit 35 and store one or more new optimization pattern data in the third storage unit 35. The analysis device 20 may receive one or more new optimization pattern data from the pattern providing device 30 at regular intervals. The analysis device 20 may also receive new optimization pattern data from the pattern providing device 30 each time new optimization pattern data is stored in the third storage unit 35 of the pattern providing device 30.

[0217] Furthermore, in the above embodiments and modifications 1 to 5, the user device 10 and the analysis device 20 are independent devices, but they may be configured as a single unit.

[0218] Furthermore, in the above embodiments and modifications 1 to 5, the modified pattern data D2 is used. However, if the modified patterns corresponding to each judgment pattern are standardized, the analysis device 20 may modify the program P1 to be processed according to those rules without using the modified pattern data D2. Also, in the above embodiments and modifications 1 to 5, the number of variables allocated to the common area is not particularly limited as long as there are two or more, and it may be three or four or more.

[0219] Furthermore, in the above embodiments and their respective modifications, each component may be implemented by being composed of dedicated hardware or by executing a software program suitable for each component. Each component may also be implemented by a program execution unit such as a CPU (Central Processing Unit) or processor reading and executing a software program recorded on a recording medium such as a hard disk or semiconductor memory. Here, the program that implements the information processing system 1 of the above embodiments may, for example, cause the processor to execute each of the steps included in Figures 13 to 15, Figure 17, Figure 19, and Figure 21.

[0220] The following cases are also included in this disclosure.

[0221] (1) The information processing system 1 is specifically a computer system consisting of a microprocessor, ROM (Read Only Memory), RAM (Random Access Memory), a hard disk unit, a display unit, a keyboard, a mouse, etc. Computer programs are stored in the RAM or hard disk unit. The information processing system 1 achieves its function by the operation of the microprocessor in accordance with the computer program. Here, the computer program is composed of a combination of multiple instruction codes that indicate commands to the computer in order to achieve a predetermined function.

[0222] (2) Some or all of the components constituting the information processing system 1 may be made up of a single system LSI (Large Scale Integration). The system LSI is a multi-functional LSI manufactured by integrating multiple components onto a single chip, and specifically, it is a computer system that includes a microprocessor, ROM, RAM, etc. The RAM stores a computer program. The system LSI achieves its function by operating the microprocessor in accordance with the computer program.

[0223] (3) Some or all of the components constituting the information processing system 1 may consist of an IC card or a standalone module that can be attached to or removed from the device. The IC card or module is a computer system consisting of a microprocessor, ROM, RAM, etc. The IC card or module may include the above-mentioned multi-functional LSI. The IC card or module achieves its function by the operation of the microprocessor in accordance with the computer program. The IC card or module may be tamper-resistant.

[0224] (4) The disclosure may also be the methods described above. Alternatively, it may be a computer program that implements these methods using a computer, or a digital signal consisting of a computer program.

[0225] Furthermore, this disclosure may also refer to a computer program or digital signal recorded on a computer-readable recording medium, such as a flexible disk, hard disk, CD (Compact Disc)-ROM, DVD, DVD-ROM, DVD-RAM, BD (Blu-ray® Disc), semiconductor memory, etc. Alternatively, it may refer to a digital signal recorded on such a recording medium.

[0226] Furthermore, this disclosure may also include the transmission of computer programs or digital signals via telecommunications lines, wireless or wired communication lines, networks such as the Internet, data broadcasting, etc.

[0227] Alternatively, the program or digital signal may be carried out by another independent computer system by recording and transferring it on a recording medium, or by transferring the program or digital signal via a network or the like.

[0228] This disclosure allows for the optimization of memory regions through program modifications, which is useful for computer systems and the like.

[0229] 1 Information Processing System 10 User Device 11 First Control Unit 12 First Operation Unit 13 First Display Unit 14 First Communication Unit 15 First Storage Unit 16 Memory 20, 20a Analysis Device 21 Second Control Unit 24 Second Communication Unit 25 Second Storage Unit 26 Storage Unit 27 Analysis Unit 28 Correction Execution Unit 30 Pattern Providing Device 31 Third Control Unit 34 Third Communication Unit 35 Third Storage Unit C1, C2, C2', C3, C3', C4, C4' Case D1 Judgment Pattern Data D2 Correction Pattern Data D3 Correction Location Data P1 Program to be Processed P2 Program after Correction

Claims

1. An information processing method executed by a computer, comprising: obtaining a target program which defines the allocation of a first area in memory for a first variable, the allocation of a second area in memory for a second variable, and processing using the first and second variables respectively; determining whether a predetermined access operation to the memory is performed by the execution of the target program by analyzing the target program; if it is determined that the predetermined access operation is performed, modifying the target program to output a modified program; in the modification of the target program, one area allocated by the execution of the target program is allocated as a shared area for the first and second variables, and the shared area is accessed at different timings for processing using the first variable and processing using the second variable, respectively; and the predetermined access operation is an operation in which the first access is performed after the last access of one or more accesses to the first area performed for processing using the first variable has been performed for processing using the first variable.

2. The information processing method according to claim 1, wherein, in determining whether or not the predetermined access operation is performed, it is determined whether or not the processing pattern, which is a pattern of processing performed by the execution of the program to be processed, matches one of the one or more determination patterns in which the predetermined access operation is performed.

3. The information processing method according to claim 2, wherein in the determination pattern, processing by a first function and processing by a second function are performed, in the processing by the first function, the second area is allocated, then the second function is called, in the processing by the called second function, the first area is allocated, then the first area is accessed one or more times, and in the processing by the first function, after the processing by the second function is completed, the second area is accessed one or more times.

4. The information processing method according to claim 3, wherein the modified program is defined to perform processing by a first modified function and processing by a second modified function, the processing by the first modified function involves allocating the shared area, then calling the second modified function, the processing by the second modified function involves one or more accesses to the shared area for processing using the first variable, and the processing by the first modified function further involves one or more accesses to the shared area for processing using the second variable after the processing by the second modified function has finished.

5. The information processing method according to claim 2, wherein in the determination pattern, the second area is allocated, then the first area is allocated, then the first area is accessed one or more times, and then the second area is accessed one or more times.

6. The information processing method according to claim 2, wherein in the determination pattern, processing by a first function and processing by a second function are performed, the processing by the first function involves the allocation of the second area, then the second function is called, and the processing by the called second function involves the allocation of the first area, then the first area is accessed one or more times, and then the second area is accessed one or more times.

7. The information processing method according to claim 6, wherein the modified program is defined to perform processing by a first modified function and processing by a second modified function, the processing by the first modified function involves allocating the shared area, then calling the second modified function, the processing by the called second modified function involves accessing the shared area one or more times for processing using the first variable, and then accessing the shared area one or more times for processing using the second variable.

8. The information processing method according to claim 2, wherein in the determination pattern, the first area is allocated, then the first area is accessed one or more times, then the second area is allocated, and then the second area is accessed one or more times.

9. The information processing method according to claim 5 or 8, wherein the modified program is defined to: allocate the shared area; then access the shared area one or more times for processing using the first variable; and then access the shared area one or more times for processing using the second variable.

10. The information processing method according to claim 2, wherein in the determination pattern, processing by a first function and processing by a second function are performed, the processing by the first function involves allocating the first area, then accessing the first area one or more times, then calling the second function, and the processing by the called second function involves allocating the second area, then accessing the second area one or more times.

11. The information processing method according to claim 10, wherein the modified program is defined to perform processing by a first modified function and processing by a second modified function, the processing by the first modified function involves allocating the shared area, then accessing the shared area one or more times for processing using the first variable, then calling the second modified function, and the processing by the called second modified function involves accessing the shared area one or more times for processing using the second variable.

12. The information processing method according to claim 2, wherein in the determination pattern, the first area is allocated, then the first area is accessed one or more times, then the second area is allocated, then the second area is accessed one or more times, then the first area is accessed one or more times again, and the value of the first variable stored in the first area is different during the period in which the first area is accessed one or more times and during the period in which the first area is accessed one or more times again.

13. The information processing method according to claim 11, wherein the modified program is defined as follows: the shared area is allocated, then the shared area is accessed once or more times for processing using the first variable, then the shared area is accessed once or more times for processing using the second variable, and then the shared area is accessed once or more times for new processing using the first variable, and the value of the first variable stored in the shared area is different during the period in which the shared area is accessed once or more times for processing using the first variable and during the period in which the shared area is accessed once or more times for new processing using the first variable.

14. The information processing method according to claim 2, wherein in the determination pattern, processing by a first function and processing by a second function are performed, the processing by the first function involves allocating the first area, then accessing the first area one or more times, then calling the second function, the processing by the called second function involves allocating the second area, then accessing the second area one or more times, the processing by the first function further involves, after the processing by the second function is completed, one or more new accesses to the first area, and the value of the first variable stored in the first area is different during the period in which one or more accesses to the first area are performed and during the period in which one or more new accesses to the first area are performed.

15. The information processing method according to claim 14, wherein the modified program is defined to perform processing by a first modified function and processing by a second modified function, the processing by the first modified function involves allocating the shared area, then accessing the shared area one or more times for processing using the first variable, then calling the second modified function, the processing by the called second modified function involves accessing the shared area one or more times for processing using the second variable, the processing by the first modified function further involves accessing the shared area one or more times for new processing using the first variable after the processing by the second modified function has finished, and the value of the first variable stored in the shared area is different during the period in which the shared area is accessed one or more times for processing using the first variable and during the period in which the shared area is accessed one or more times for new processing using the first variable.

16. The information processing method according to claim 1, wherein, in determining whether or not the predetermined access operation is performed, a first variable coordinate region and a second variable coordinate region are arranged in a coordinate space having a first axis indicating time and a second axis indicating each region in the memory, and it is determined that the predetermined access operation is performed when the first variable coordinate region and the second variable coordinate region can approach each other along the direction of the second axis without overlapping, the first variable coordinate region is a coordinate region determined by a range of the first axis corresponding to the period during which one or more accesses to the first region are performed and a range of the second axis corresponding to the first region, and the second variable coordinate region is a coordinate region determined by a range of the first axis corresponding to the period during which one or more accesses to the second region are performed and a range of the second axis corresponding to the second region.

17. The information processing method according to claim 1, wherein the program to be processed further defines the allocation of a third area in memory for a third variable and processing using the third variable, the predetermined access operation is such that, after the final access of one or more accesses to the first area performed for processing using the first variable is performed, the first access of one or more accesses to the third area performed for processing using the third variable is performed, and then, after the final access of one or more accesses to the third area is performed, the first access of one or more accesses to the second area performed for processing using the second variable is performed, and the modification of the program to be processed is such that one area allocated by the execution of the program to be processed is allocated as a shared area for the first variable, the second variable, and the third variable, and the program to be processed is modified so that the shared area is accessed at different timings for processing using the first variable, processing using the second variable, and processing using the third variable, respectively.

18. The information processing method according to claim 1, wherein each of the first and second variables is a variable used in calculations of the encryption scheme Classic McElice.

19. Information processing apparatus comprising: an acquisition unit that acquires a processing target program which defines the allocation of a first area in memory for a first variable, the allocation of a second area in memory for a second variable, and processing using the first and second variables, respectively; an analysis unit that determines whether a predetermined access operation to the memory is performed by the execution of the processing target program by analyzing the processing target program; and a modification execution unit that modifies the processing target program and outputs a modified program when it is determined that the predetermined access operation is performed, wherein the modification execution unit modifies the processing target program such that one area allocated by the execution of the processing target program is allocated as a shared area for the first and second variables, and the shared area is accessed at different timings for processing using the first variable and processing using the second variable, respectively, and the predetermined access operation is an operation in which the first access is performed after the last access of one or more accesses to the first area performed for processing using the first variable has been performed.

20. A program to be processed, which includes: obtaining a program to be processed that defines the allocation of a first memory region for a first variable, the allocation of a second memory region for a second variable, and processing using the first and second variables respectively; determining whether a predetermined access operation to the memory is performed by the execution of the program to be processed by analyzing the program to be processed; and, if it is determined that the predetermined access operation is performed, modifying the program to be processed and outputting the modified program, wherein the modification of the program to be processed is such that one region allocated by the execution of the program to be processed is allocated as a shared region for the first and second variables, and the shared region is accessed at different times for processing using the first variable and processing using the second variable, respectively, and the predetermined access operation is the operation in which the first access is performed after the last access of one or more accesses to the first region performed for processing using the first variable has been performed for processing using the first variable.