WO2014129247A1 - アボート削減方法、アボート削減装置、及びアボート削減プログラム - Google Patents
アボート削減方法、アボート削減装置、及びアボート削減プログラム Download PDFInfo
- Publication number
- WO2014129247A1 WO2014129247A1 PCT/JP2014/051051 JP2014051051W WO2014129247A1 WO 2014129247 A1 WO2014129247 A1 WO 2014129247A1 JP 2014051051 W JP2014051051 W JP 2014051051W WO 2014129247 A1 WO2014129247 A1 WO 2014129247A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- abort
- runtime
- transaction
- execution
- helper
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/466—Transaction processing
- G06F9/467—Transactional memory
Definitions
- the present invention relates to a technique for reducing the number of aborts in program execution using hardware transactional memory (HTM), and more specifically, a predetermined function is called during execution of a transaction block.
- HTM hardware transactional memory
- the present invention relates to a technique for reducing the number of aborts caused by.
- HTM is a transactional memory implemented as hardware.
- each running thread has its copy locally, and the processing result for the copy that has locally on condition that the value of the shared resource is not rewritten by another thread when the processing is completed Write. This process is called commit. ⁇ If the shared resource value has been rewritten by another thread, the processing itself is discarded.
- a transaction can be aborted at any time (referred to as an abort), and when aborted, changes to the shared resource that the transaction has made are canceled (referred to as rollback).
- a transaction is a collection of a series of inseparable processes executed by a single thread.
- HTM-based parallel library HTM-basedconcurrent HTM is used for various optimizations such as library.
- the managed runtime environment relies on various runtime helpers such as JIT compilers and memory allocators.
- the runtime helper is a function of a virtual machine that is not included in the interpreter and JIT-compiled execution code, but is called from the interpreter and JIT-compiled code at the time of execution.
- some of these runtime helpers cause an abort if called and executed during the execution of a transaction.
- Patent Documents 1 to 3 and Non-Patent Documents 1 to 3 as conventional techniques for dealing with aborts.
- Patent Document 1 and Non-Patent Document 2 disclose techniques for performing appropriate processing in an abort handler in accordance with information on the reason for abort provided by HTM hardware.
- Patent Document 2 discloses a technique for temporarily interrupting a transaction while executing a certain transaction, performing arbitrary processing, and then starting the transaction.
- Patent Document 3 discloses a technique for switching between implementations of a plurality of transactional memories at the time of execution.
- Non-Patent Document 1 discloses a technique for executing a non-transaction path after retrying a plurality of times and then executing the transaction again when the transaction is aborted.
- Non-Patent Document 3 discloses a technique for delaying re-execution of a transaction when aborted due to a collision between transactions.
- the JIT compiler is called when a certain method is executed a predetermined number of times. However, if the call is made during a transaction, an abort occurs because the size of the work area used by the JIT compiler exceeds the transaction size supported by the hardware.
- symbol resolution code resolution
- code correction codepatching
- Thread-local heap (thread-local heap: TLH) allocation is often called by a program, allocates TLH from the heap, and clears it with zero. However, if a TLH allocation is made during a transaction, an abort occurs because zero-clearing overflows beyond the transaction size limit described above.
- asynchronous garbage collection (GC) check is started when each application that periodically checks the flag set by stop-the-world GC sleeps.
- GC synchronous garbage collection
- class loading is to load classes on demand during program execution. If class loading occurs during a transaction, I / O aborts the transaction.
- Patent Document 1 and Non-Patent Document 2 use the abort reason provided by the hardware of the HTM. For example, if an asynchronous GC check or class load is called during a transaction, the reason for abort is the hardware viewpoint. Both are system call calls. For this reason, the techniques of Patent Literature 1 and Non-Patent Literature 2 cannot distinguish between the two and cannot take different appropriate measures.
- Patent Document 3 it is necessary to switch between mounting of a plurality of transactional memories at the time of execution.
- the switching timing since only the performance, current workload, and resource allocation are described in Patent Document 3 as the switching timing, it is possible to perform appropriate processing according to the type of runtime helper that can cause an abort. Absent.
- Non-Patent Document 1 is a method of executing a non-transaction path on condition of a predetermined number of aborts and then executing a transaction again.
- a predetermined number of aborts may be useless, or even if a non-transaction path is executed, the problem may not be solved. Therefore, it is necessary to perform an appropriate process according to the type of runtime helper, but a technique for that is not described in Non-Patent Document 1.
- Non-Patent Document 3 is a method of delaying the re-execution of a transaction for a while when aborted due to a collision between transactions. Therefore, even if this technique is applied to an abort caused by a call to a runtime helper, the abort is not resolved.
- the present invention has been made to solve the above-described problems, and an object thereof is to provide a technique for reducing the number of aborts caused by a runtime helper being called during execution of a transaction block.
- the abort reduction method includes: (a) the computer executing the runtime helper in response to a runtime helper call during execution of a transaction block; and (b) aborting due to the runtime helper call.
- the computer executes an abort handler; and (c) after execution of the abort handler in step (b), the computer executes a non-transaction path corresponding to the transaction block. Steps.
- the execution of the runtime helper includes a process for passing ID information indicating a type of the runtime helper to the abort handler.
- the execution of the abort handler includes the ID of the runtime helper that caused the abort. Processing to obtain information and invalidate the transaction block for a particular type of runtime helper.
- the runtime helper is a function of a virtual machine that is not included in the interpreter and JIT-compiled execution code, but is called from the interpreter and JIT-compiled code at the time of execution.
- the transaction block is a program area surrounded by a transaction start instruction and a transaction end instruction, and is a program area that is executed as a transaction in the program execution using the hardware transactional memory.
- the process of invalidating the transaction block for the specific type of runtime helper invalidates the transaction block unconditionally for the first type of runtime helper that cannot be executed even in a non-transaction path. And the second type runtime helper that can be executed in the non-transaction path, on the condition that the second type runtime helper is not called during the execution of the non-transaction path once. Including the process of invalidating the block.
- the first type of runtime helper includes runtime code modification
- the second type of runtime helper includes runtime compilation and class loading.
- the computer reactivates the transaction block in response to the program reaching a steady state.
- the method further includes the step of:
- the following configuration may be adopted instead of the configuration for re-enabling the transaction block. That is, when the runtime helper is the second type runtime helper, the execution content of the runtime helper is recorded using a non-transaction writing command, and the transaction is performed using the ID information as an argument. Includes processing to issue an abort instruction. In addition, when the abort handler is executed, when the transaction block is invalidated for the second type of runtime helper, the recorded processing content is registered in a table.
- the abort reduction method further includes the step of (e) re-validating the transaction block in response to the execution of the processing content registered in the table.
- the processing content is identification information of a method to be compiled
- the runtime helper of the second type is class loading
- the processing content is an identifier of a class to be loaded.
- the abort handler determines thread local heap allocation and asynchronous garbage collection check as runtime helpers other than the specific type.
- the computer invalidates all transaction blocks at the start of execution of the program, and (g) the computer waits for a predetermined period from the start of execution of the program. Validating all transaction blocks in response to elapse.
- the execution of the runtime helper includes a process of issuing a transaction abort instruction
- the process for passing the ID information to the abort handler includes a process of using the ID information as an argument of the transaction abort instruction.
- the process for passing the ID information to the abort handler includes a process of recording the ID information using a non-transactional write instruction, and after the process, the runtime helper is a process of the original runtime helper. May be performed.
- the execution of the runtime helper records information necessary for the execution using a non-transaction writing instruction on condition that the runtime helper is another type of runtime helper different from the specific type. Processing to include.
- the execution of the abort handler includes a process of executing the other type of runtime helper using the recorded necessary information. Then, instead of the step (c) after the processing, the computer includes (h) a step of re-executing the transaction block.
- the following configuration may be adopted instead of the configuration for delaying execution of the runtime helper. That is, the execution of the runtime helper is a process of recording information necessary for the execution using a non-transaction writing instruction on condition that the runtime helper is another type of runtime helper different from the specific type. And a process of canceling the execution.
- the abort reduction method further includes the step of (i) the computer executing the transaction block using the necessary information recorded on the other type of runtime helper after executing the transaction block. Including.
- the runtime helper of the specific type includes class loading
- the runtime helper of the other type is runtime compilation
- information necessary for the execution is identification information of a method to be compiled.
- the specific type of runtime helper includes class loading
- the other type of runtime helper is runtime code correction
- the information necessary for execution is an address and data to be corrected at runtime code. .
- the execution of the runtime helper replaces a call for runtime code modification in a transaction block included in the code to be compiled with a transaction abort instruction, and And a process of creating a correspondence table from the address of the transaction abort instruction to the information necessary for correcting the runtime code.
- the abort reduction method further includes (j) re-execution of the transaction block after the computer executes an abort handler in response to execution of the replaced transaction abort instruction.
- the abort handler is executed by subtracting the correspondence table from the address of the transaction abort instruction to obtain necessary information, correcting the runtime code, and overwriting the transaction abort instruction with a nop instruction. including.
- the following configuration may be employed in place of the replacement configuration for runtime code correction by the compiler. That is, Execution of the abort handler prohibits writing on the page containing the instruction address where the abort occurred, provided that the runtime helper corrects the runtime code, and the cause of the abort is a write protection exception Including the process of correcting the runtime code by obtaining the address and data to be corrected at runtime by identifying the write command at the position where the write protection occurred, invalidating the write prohibition on the condition of .
- the abort reduction method further includes (k) the computer re-executing the transaction block instead of the step (c) after the write prohibition process by the abort handler or the execution code correction.
- the present invention can also be grasped as an abort reduction program for causing a computer to execute each step of the above-described abort reduction method. Moreover, it can also be grasped as an abort reduction device provided with means adapted to execute each step of such an abort reduction method.
- the process for passing the ID information indicating the type of the runtime helper to the abort handler is performed, so that the processing corresponding to the type of the runtime helper can be performed from the beginning in the abort handler.
- a transaction block can be invalidated for a specific type of runtime helper.
- the number of aborts caused by the runtime helper being called during execution of the transaction block can be efficiently reduced without waste.
- FIG. 5A is a flowchart illustrating an example of the processing flow in the first half of the processing by the abort handler.
- FIG. 5B is a flowchart illustrating an example of the processing flow in the latter half of the processing by the abort handler.
- FIG. 7A is a flowchart illustrating an example of a flow of transaction block validation processing.
- FIG. 7B is a flowchart showing another example of the transaction block validation processing flow. It is a flowchart which shows the other example of the flow of a process by a runtime helper. It is a flowchart which shows the other example of the flow of a process by a runtime helper. It is a flowchart which shows the other example of the flow of a part of process by an abort handler. It is a flowchart which shows an example of the flow of a process by a JIT compiler.
- FIG. 17A is a diagram showing experimental results comparing throughput according to the number of threads between the conventional technique and the present invention.
- FIG. 17B is a diagram showing experimental results comparing throughput according to the number of threads between the conventional technique and the present invention.
- FIG. 1 shows an example of a hardware configuration of a computer system 100 suitable for carrying out the present invention.
- the computer system 100 includes a main CPU (central processing unit) 102 and a main memory 104 connected to a bus 106.
- the CPU 102 is a multiprocessor capable of parallel processing, and includes an HTM 102a.
- the HTM 102a is a transactional memory implemented as hardware, and as described above, each of the executing threads has a copy locally, and the value of the shared resource is not changed when the processing is completed. Confirm and write the processing results at once. Also, if the HTM 102a has been rewritten by another thread, those values have been changed, so that the processing itself can be discarded and restarted.
- the transaction by the HTM 102a may be aborted at any time, and when aborted, the changes to the shared data that the transaction has made are canceled and rolled back.
- a transaction is a collection of a series of inseparable processes executed by a single thread.
- a display 110 for example, a liquid crystal display (LCD) can be connected to the bus 106 via a display controller 108.
- the display 110 is used to display information about a computer connected to a network via a communication line and information about software running on the computer with an appropriate graphic interface for managing the computer. used.
- a disk 114 such as a silicon disk or a hard disk, can be connected to the bus 106 via a SATA or IDE controller 112.
- the bus 106 may also optionally be connected to a drive 116, such as a CD, DVD or BD drive, via a SATA or IDE controller 112.
- a keyboard 120 and a mouse 122 may optionally be connected to the bus 106 via a keyboard / mouse controller 118 or a USB bus (not shown), but this is not necessary for implementing the present invention. *
- the disk 114 stores an operating system, a program that provides a virtual machine such as a Java (registered trademark) virtual machine (VM), and other programs and data so that they can be loaded into the main memory 104.
- a virtual machine such as a Java (registered trademark) virtual machine (VM)
- VM virtual machine
- the abort reduction program can provide functions to be described later for a part of a program that provides a virtual machine, that is, an interpreter, a compiled code execution unit, an abort handler, and a plurality of runtime helpers. It can be implemented by modifying as follows.
- the above computer program can be compressed and divided into a plurality of pieces and recorded on a plurality of media.
- the drive 116 can be used to install a program from the CD-ROM, DVD-ROM or BD to the disk 114 as required.
- the communication interface 126 follows, for example, the Ethernet (registered trademark) protocol.
- the communication interface 126 is connected to the bus 106 via the communication controller 124, plays a role of physically connecting the computer system 100 to the communication line 128, and is a TCP / IP of the communication function of the operating system of the computer system 100.
- a network interface layer is provided for the communication protocol.
- the communication line may be based on a wired LAN environment or a wireless LAN environment, for example, based on a Wi-Fi standard such as IEEE 802.11a / b / g / n.
- the computer system 100 used in the embodiment of the present invention may be an apparatus that can store and execute the abort reduction program according to the embodiment of the present invention, such as a PC, a server, A workstation or the like can be used as an abort reduction device.
- a PC personal computer
- server personal computer
- a workstation personal computer
- the component demonstrated above is an illustration, All the components are not necessarily an essential component of this invention.
- FIG. 2 is a diagram showing an example of the software configuration of the computer system 100 shown in FIG.
- the CPU 102 reads a virtual machine such as a Java (registered trademark) virtual machine (VM) and an operating system from the disk 114 to the main memory 104 and executes the virtual machine 206 and the operating system 202 in the main memory 104.
- VM virtual machine
- the operating system 202 is software that provides basic functions of the computer system 100 such as management of the CPU 102 and memory.
- the virtual machine 206 is an emulator that performs low-speed execution (interpret) of bytecode and execution of compiled code, manages execution of code, and provides various services to applications executed on the virtual machine.
- the virtual machine 206 includes an interpreter 210, a compiled code execution unit 212, a dispatcher 214, a runtime helper group 218 including a plurality of runtime helpers, and an abort handler 204.
- the dispatcher 214 refers to the code cache 216 which is a memory area for storing the compiled code generated by the JIT compiler 220 included in the runtime helper group 218, and the compiled code starting from the bytecode address to be executed next is the code cache. It is determined whether it is stored in H.216.
- the interpreter 210 executes the bytecode to be processed at a low speed when there is no compiled code.
- the compiled code execution unit 212 acquires the compiled code from the code cache 216 and executes it.
- the CPU 102 is a multiprocessor capable of parallel processing, and includes the HTM 102a. Therefore, when there is a transaction block surrounded by a transaction start instruction and a transaction end instruction in the execution target code, the interpreter 210 executes the area as a transaction using the HTM 102a. When a transaction block is included in the JIT-compiled code, the compiled code execution unit 212 executes the area as a transaction using the HTM 102a.
- the interpreter 210 and the compiled code execution unit 212 also execute a non-transactional path according to a predetermined condition.
- the non-transaction path means a process that is semantically the same as the transaction block that is normally executed to advance the program when the execution of the transaction block aborts many times. There is one non-transaction path for each transaction block. Both are semantically the same, but the non-transaction path is slower to execute.
- a non-transaction path may be written by a programmer, or a compiler or the like may be automatically generated from a transaction block code.
- the interpreter 210 and the compiled code execution unit 212 are collectively referred to as an execution unit 208 (corresponding to the execution unit in claim 19 of the claims).
- the runtime helper 218 includes a plurality of runtime helpers.
- a runtime helper is a virtual machine function that is called at run time from interpreted or JIT-compiled code. Some runtime helpers can abort a transaction if executed during the transaction, and such runtime helpers are referred to herein as abort-proneproruntime helper 219. Call it. Whether or not it is an abortive runtime helper 219 depends on the implementation of the HTM, but as an example, a JIT compiler 220, a class loader 222, an asynchronous garbage collector (GC) 224, a TLH allocator 226, a symbol resolver 228 Can be mentioned.
- the present invention aims to reduce the number of aborts caused by the abortive runtime helper 219. So, first, I will explain each of the abortive runtime helpers listed above.
- the JIT compiler 220 is called when a certain method is executed a predetermined number of times. However, if the call is made during a transaction, an abort occurs because the size of the work area used by the JIT compiler 220 exceeds the transaction size supported by the hardware. A possible solution is to execute the non-transaction path only once and expect the JIT-compiled method to be executed during that time. If a method subject to JIT compilation is executed while executing a non-transaction path, the JIT compiler 220 is called outside the transaction block and executed successfully. On the other hand, if the method subject to JIT compilation is not executed while executing the non-transaction path, the transaction block is invalidated, and the transaction block is validated again after waiting for the program to reach a steady state.
- the class loader 222 loads classes on demand during program execution. If class loading occurs during a transaction, I / O aborts the transaction. A possible solution is to perform a non-transaction path only once and expect that non-transaction path to use the same class. If the same class is used while executing a non-transaction path, the class loader 222 is called outside the transaction block and executed successfully. On the other hand, when the same class is not used during execution of a non-transaction path, the transaction block is invalidated, and the transaction block is validated again after waiting for the program to reach a steady state.
- Asynchronous GC 224 is called when each application that periodically checks the flag set by stop-the-worldGC sleeps. However, since a system call call for sleep during a transaction is not allowed, an abort occurs when the setting of the flag is detected during the transaction.
- a possible solution is to perform a non-transactional path. By executing the non-transaction path, it can be expected that the current thread will reach another asynchronous GC checkpoint before entering the next transaction, thereby calling the asynchronous GC 224 outside the transaction block.
- TLH allocator 226 is often called by a program, allocates TLH from the heap, and clears it with zero. However, if TLH allocation is done during a transaction, an abort occurs because zero cleaning overflows the transaction size limit.
- a possible solution is to perform a non-transactional path. By performing a non-transactional path, it can be expected that the current thread will allocate a new object before the next transaction is entered, thereby calling the TLH allocator 226 outside the transaction block.
- the symbol resolver 228 or code correction is to resolve a symbol in a method on demand at the time of execution, and as a result, correct the code that refers to the symbol. Therefore, if symbol resolution is performed during a transaction, an abort occurs. However, in this case, even if a non-transaction path is executed, the code on the transaction path will not be corrected, and this does not solve the problem. A possible solution is therefore to invalidate the transaction block immediately so that no aborts occur unnecessarily.
- the abort runtime helper 219 passes ID information indicating the type of the abort runtime helper 219 to the abort handler 204 when it is called during execution of a transaction block.
- the abort property runtime helper 219 issues a transaction abort instruction using the ID information as an argument indicating the cause of the abort without performing original processing.
- the abort handler 204 called when the transaction abort instruction is executed acquires the ID information of the abortive runtime helper 219 that caused the abort, and the ID information is a specific type of abortive runtime helper 219.
- Transaction block is invalidated.
- the abort handler 204 unconditionally invalidates the transaction block for the first type of runtime helper that cannot be executed even in a non-transaction path.
- the abort handler 204 executes the non-transaction path only once for the second type runtime helper that can be executed in the non-transaction path, and the second type runtime helper is not called during the execution. Invalidate the transaction block.
- the first type of runtime helper includes runtime code modification
- the second type of runtime helper includes JIT compilation and class loading.
- the abort handler 204 determines TLH allocation and asynchronous GC check as runtime helpers other than a specific type, and does nothing for them.
- the execution unit 208 executes a non-transaction path corresponding to the transaction block in which the abort occurred.
- the execution unit 208 revalidates the transaction block in response to the program reaching a steady state. This is because when the program is in a steady state, it is expected that the class causing the abort is loaded and the method causing the abort is compiled.
- the state in which the transaction block is invalidated until the cause of the abort is resolved is referred to as a temporary non-transaction mode in this specification.
- whether or not the program has reached a steady state depends on whether a sufficient number of classes have been loaded, a sufficient number of methods have been compiled, or both.
- the following method may be used.
- the time when a new class is not loaded and / or the time when a new method is not compiled or both last for 10 seconds or more.1000 new classes are loaded or 1000 new methods are compiled or both. ⁇
- the number of classes loaded per second, the number of methods compiled per second, or both are monitored, and the number is less than 10 per second. However, numbers such as 10 seconds and 1000 are examples. It is preferable to obtain an optimum value in advance in a preliminary experiment.
- the above-described abort reduction method can be extended from the following four viewpoints as the abort reduction base method.
- Abort runtime helper 219 ID information is used to indicate the cause of the abort, and is used as an argument of the transaction abort instruction (base method) B2. Record the ID information of the abortive runtime helper 219 in the runtime helper recording area of the currently executing thread using the non-transactional write instruction.
- Second embodiment (A1 + B2 + C1 + D1) Whether a runtime helper is aborted when called during a transaction depends on the HTM implementation. For example, JIT compilation does not cause a transaction abort on implementations that support very large transaction sizes. In such an implementation, if the abort abort runtime helper 219 issues a transaction abort instruction each time it is called during a transaction, performance is degraded.
- the abortive runtime helper 219 uses the non-transaction write instruction to store the storage area of the thread that is currently being executed. To record.
- the abort handler 204 determines whether or not such a record exists, and if it exists, determines the cause of the abort based on the record.
- the information to be recorded in the recording area by the abortive runtime helper 219 may be its own ID information as an example.
- the abortive runtime helper 219 is a code modification, it immediately invalidates the transaction block. Even when the abort property runtime helper 219 is the JIT compiler 220, the transaction block is invalidated on the condition that the JIT compiler 220 is not called in the execution of one non-transaction path. As described above, the execution of the non-transaction path is slower than the execution of the transaction block. Therefore, invalidating the transaction block degrades the performance.
- the abortive runtime helper 219 called during the transaction is the JIT compiler 220 or the symbol resolver 228, the execution is delayed and executed in the abort handler 204.
- the JIT compiler 220 and the symbol resolver 228 do not have side effects that are visible to the programmer (programexecution semantics), and their execution order is not strictly defined, so there is no problem even if execution is delayed in this way.
- the class loader 222 since the class loader 222 has a side effect visible to the programmer (programmer-visiblesemantics), such a delay is not allowed.
- the abort runtime helper 219 which is the JIT compiler 220 or the symbol resolver 228, uses the non-transaction write instruction to transmit information necessary for the original processing together with the ID information.
- the abort handler 204 determines whether or not such a record exists, and if it exists, performs JIT compilation or code correction based on the record.
- the information to be recorded in the recording area by the JIT compiler 220 is identification information of a method to be compiled.
- Information to be recorded in the recording area by the symbol resolver 228 is an address and data to be corrected at the time of execution.
- processing described below is added to the original processing by the JIT compiler 220 instead of using a non-transactional write instruction.
- the JIT compiler 220 replaces the call for runtime code correction in the transaction block included in the code to be compiled with the transaction abort instruction, and converts the address of the transaction abort instruction to information necessary for the runtime code correction. Create a correspondence table.
- the information necessary for correcting the runtime code is an address and data to be corrected for the runtime code.
- the abort handler 204 called by execution of the replaced transaction abort instruction acquires necessary information by subtracting the correspondence table from the address of the transaction abort instruction.
- the abort handler 204 corrects the runtime code based on the acquired information, and overwrites the transaction abort instruction with a nop instruction.
- the execution unit 208 re-executes the transaction block.
- Code modification is often used in JIT compiled code, such as JIT compilation and polymorphic inline method caching, as well as symbol resolution.
- code modifications cause an abort if called while executing a transaction.
- execution of the abort handler 204 can be delayed until processing of the abort handler 204 is started as in the third embodiment, from the viewpoint of software engineering, in the managed runtime, delay processing is performed at all code correction positions. Inserting logic for is not practical.
- code correction processing is delayed without inserting logic for delay processing at all code correction positions.
- the abort handler 204 first prohibits writing a page including the instruction address at which the abort occurred, on condition that the abort runtime helper 219 that caused the abort is a code correction at the time of execution. Thereafter, the execution unit 208 re-executes the transaction block. Then, the abort handler 204 that is called next invalidates the previous write prohibition on the condition that the cause of the abort is a write protection exception, and identifies the write command at the position where the write protection has occurred. The address and data to be corrected at runtime are acquired and the runtime code is corrected. Thereafter, the execution unit 208 re-executes the transaction block.
- the transaction block is validated after confirming that the causing method is JIT compiled or the causing class is loaded. Therefore, in the sixth embodiment, the JIT compiler 220 and the class loader 222 that are called during transaction execution record the processing contents in the storage area of the currently executing thread using a non-transaction write instruction, A transaction abort command is issued with the ID information as an argument.
- the processing content is identification information of a method to be compiled in the case of the JIT compiler 220, and an identifier of a class to be loaded in the case of the class loader 222.
- the abort handler 204 When the abort handler 204 called by the transaction abort instruction invalidates the transaction block for the JIT compiler 220 and the class loader 222, the abort handler 204 reads the information recorded in the storage area of the currently executing thread and reads the global table. Register with. Thereafter, the execution unit 208 revalidates the transaction block in response to the execution of the processing content registered in the global table.
- FIG. 3 is a flowchart showing an example of the flow of the entire abort reduction process according to the embodiment of the present invention.
- FIG. 4 is a flowchart showing an example of the flow of processing by the abortive runtime helper 219.
- FIGS. 5A and 5B are flowcharts showing an example of a partial flow of processing by the abort handler 204.
- FIG. 6 is a flowchart illustrating an example of the flow of non-transaction path execution processing.
- FIGS. 7A and 7B are flowcharts showing an example of the flow of transaction block validation processing.
- the flowchart shown in FIG. 3 starts with the execution of a transaction block, and the execution unit 208 determines whether or not the current transaction block to be executed has been invalidated (step 300).
- the execution unit 208 subsequently initializes a retry counter for counting the number of retries of the current transaction block with a positive integer (step). 302).
- the execution unit 208 also increments an execution counter for counting the number of executions of the current transaction block by 1 (step 304).
- the execution unit 208 starts and executes a transaction (steps 306 and 308). It is assumed that a retry counter is held for each thread, and an execution counter and an abort counter described later are held for each transaction block.
- the execution counter and abort counter are initialized when a code including the corresponding transaction block is loaded.
- the execution unit 208 determines whether or not the abort property runtime helper 219 is called in the transaction (step 310). If the abortive runtime helper 219 has been called (step 310: YES), the process proceeds to step 312, where the called abortive runtime helper 219 performs processing. Details of the processing by the abortive runtime helper 219 will be described later with reference to FIG. After the processing by the abortive runtime helper 219 or when the abortable runtime helper 219 has not been called (step 310: NO), the processing proceeds to step 314, and the execution unit 208 determines whether or not an abort has occurred in the transaction. Determine whether.
- step 314 If an abort has occurred in the transaction (step 314: YES), the process proceeds to step 316, where the abort handler 204 performs the process. Details of the processing by the abort handler 204 will be described later with reference to FIG. On the other hand, if no abort has occurred in the transaction (step 314: NO), the process proceeds to step 320, the execution unit 208 ends the transaction (step 320), and ends the process.
- the process by the abort handler 204 in step 316 has two results. If the result indicates 2, the process returns to step 306 and tries to execute the current transaction block again. On the other hand, when the result of processing by the abort handler 204 indicates 1 or when it is determined in step 300 that the current transaction block is invalidated (step 300: YES), the process proceeds to step 318, and the execution unit Performs a non-transactional path. Details of the non-transaction path execution process will be described later with reference to FIG. After the non-transaction path execution process, the process ends.
- the flowchart shown in FIG. 4 shows details of processing by the abortive runtime helper 219 in step 312 of the flowchart shown in FIG.
- the process starts at step 400, and the abort runtime helper 219 issues a transaction abort instruction using the ID indicating the type of the abort runtime helper 219 as an argument indicating the cause of the abort. Thereafter, the abortive runtime helper 219 terminates the process.
- the processing of the flowchart shown in FIG. 4 is executed when the abortive runtime helper 219 is called during execution of a transaction. Note that the original processing is performed.
- the flowchart shown in FIG. 5A shows the first half of the processing by the abort handler 204 in step 316 of the flowchart shown in FIG. Processing begins at step 500, where the abort handler 204 determines whether the cause of the abort is a TLH allocation or an asynchronous GC check. If the cause of the abort is either TLH allocation or asynchronous GC check (step 500: YES), the abort handler 204 ends the process leaving a result indicating 1. On the other hand, if the cause of the abort is neither TLH allocation nor asynchronous GC check (step 500: NO), then the abort handler 204 determines whether the cause of the abort is symbol resolution (step 502). . If the cause of the abort is symbol resolution (step 502: YES), the abort handler 204 immediately invalidates the current transaction block (step 510), and ends the process leaving a result indicating 1.
- the abort handler 204 determines whether the cause of the abort is JIT compilation or class loading (step 504). If the cause of the abort is neither JIT compilation nor class loading (step 504: NO), the process continues to step 520 of the flowchart shown in FIG. On the other hand, if the cause of the abort is either JIT compilation or class loading (step 504: YES), then the abort handler 204 determines whether the non-tx-once flag is set for the current transaction block. Is determined (step 506).
- the non-tx-once flag is a flag assigned for each transaction block, and is used together with a non-tx-execution flag assigned for each thread described later.
- the non-transaction path is executed only once by the control using these flags, and the current transaction block is invalidated on the condition that the JIT compilation or class loading causing the abort is not executed during that time. Realize processing.
- the non-tx-once flag is set in the execution of a non-transaction path, which will be described later with reference to FIG. 6. The setting indicates that no JIT compilation or class loading occurred during the execution of the non-transaction path. Show.
- step 506 when the non-tx-once flag is not set (step 506: NO), the abort handler 204 then continues to the non-tx of the currently executed thread.
- An -execution flag is set (step 508).
- the non-tx-execution flag indicates that the cause of the abort was JIT compilation or class loading.
- the abort handler 204 invalidates the current transaction block (step 510).
- step 508 or step 510 the abort handler 204 ends the process leaving a result indicating 1.
- the flowchart shown in FIG. 5 (b) shows the flow of the latter half of the process that is executed when the determination in step 504 of the flowchart shown in FIG. 5 (a) is NO.
- Processing begins at step 520, where the abort handler 204 determines whether the retry counter value is greater than zero. If the retry counter value is greater than 0 (step 520: YES), the abort handler 204 decrements the retry counter value by 1 (step 522), and ends the process leaving a result indicating 2.
- the abort handler 204 increments the abort counter of the current transaction block by 1 (step 524). Subsequently, the abort handler 204 determines whether or not the abort rate obtained by dividing the abort counter value by the execution counter value is smaller than a predetermined threshold (step 526). If the abort rate is smaller than the predetermined threshold (step 526: YES), the abort handler 204 ends the process leaving a result indicating 1. On the other hand, if the abort rate is equal to or higher than the predetermined threshold (step 526: NO), the abort handler 204 invalidates the current transaction block (step 528), and ends the process leaving a result indicating 1.
- the flowchart shown in FIG. 6 shows the details of the non-transaction path execution process in step 318 of the flowchart shown in FIG.
- the process starts at step 600, and the execution unit 208 starts executing a non-transaction path. Subsequently, when JIT compilation or class loading is triggered during execution of the non-transaction path, the execution unit 208 sets the non-tx-execution flag of the currently executing thread to the non-transaction path. JIT compilation or class loading is executed in synchronization with the execution of, and then the non-tx-execution flag of the currently executing thread is reset (step 602). Subsequently, the execution unit 208 ends the execution of the non-transaction path (Step 604).
- the execution unit 208 determines whether or not the non-tx-execution flag of the currently executing thread is set (step 606). If the non-tx-execution flag of the currently executing thread is not set (step 606: NO), the execution unit 208 ends the process. On the other hand, when the non-tx-execution flag of the currently executing thread is set (step 606: YES), the execution unit 208 sets the non-tx-once flag assigned to the current transaction block. (Step 608) Thereafter, the non-tx-execution flag of the currently executing thread is reset (Step 610). Thereafter, the execution unit 208 ends the process.
- the flowchart shown in FIG. 7A is a process periodically executed by the execution unit 208.
- the process starts at step 700, and the execution unit 208 waits until a sufficient number of classes are loaded and a sufficient number of methods are compiled. Subsequently, the execution unit 208 re-enables all the transaction blocks invalidated due to JIT compilation or class loading, and resets the corresponding execution counter, abort counter, and non-tx-once flag (Step S208). 702). Then, the execution unit 208 ends the process.
- FIG. 7B is a flowchart showing a flow of processing newly executed by the execution unit 208 at the start of program execution when the configuration of A2 is adopted in addition to the configuration of A1 in the first embodiment.
- the process starts at step 710, and the execution unit 208 invalidates all transaction blocks included in the code of the program to be executed. Subsequently, the execution unit 208 waits until a sufficient number of classes are loaded and a sufficient number of methods are compiled (step 712). Subsequently, the execution unit 208 re-enables all transaction blocks in the code of the program to be executed, and resets the corresponding execution counter, abort counter, and non-tx-once flag (step 714). Then, the execution unit 208 ends the process.
- FIG. 8 is a flowchart showing another example of the processing flow by the abortive runtime helper 219 in step 312 of the flowchart shown in FIG.
- the flowchart shown in FIG. 8 starts at step 800, and the abortable runtime helper 219 records the ID indicating the type of the runtime helper in the storage area of the currently executing thread by using a non-transactional write instruction. Subsequently, the abortive runtime helper 219 executes its original process (step 802). Subsequently, the abortive runtime helper 219 determines whether or not the currently executing transaction has been aborted (step 804).
- the abortive runtime helper 219 ends the process without doing anything.
- the abortive runtime helper 219 clears the information recorded in the storage area of the currently executing thread (step 806) and ends the processing. To do.
- the abort handler 204 reads the information recorded in the storage area of the currently executing thread at the beginning of the processing shown in the flowchart of FIG.
- FIG. 9 is a flowchart showing another example of the processing flow by the abortive runtime helper 219 in step 312 of the flowchart shown in FIG.
- FIG. 10 is a flowchart showing another example of the processing flow of the first half by the abort handler 204 in step 316 of the flowchart shown in FIG.
- the flowchart shown in FIG. 9 starts in step 900, and the abortive runtime helper 219 determines whether or not the processing content is symbol resolution. If the processing content is symbol resolution (step 900: YES), the abortive runtime helper 219 uses the non-transactional write instruction to set the address and data of the code to be corrected in the storage area of the currently executing thread. Write (step 902).
- the abortive runtime helper 219 determines whether or not the processing content is JIT compilation (step 904). If the processing content is JIT compilation (step 904: YES), the abortive runtime helper 219 uses the non-transactional write instruction to write the ID of the method to be JIT compiled into the storage area of the currently executing thread (step 904). 902). If the processing content is not JIT compilation in step 904 (step 904: NO), the post-processing of step 902 or step 906 proceeds to step 908, and the abortive runtime helper 219 indicates the type of the abortive runtime helper 219. A transaction abort instruction is issued as an argument indicating the cause of the abort. Thereafter, the abortive runtime helper 219 terminates the process.
- the flowchart shown in FIG. 10 starts at step 1000, and the abort handler 204 determines whether or not the cause of the abort is symbol resolution. If the cause of the abort is symbol resolution (step 1000: YES), the abort handler 204 modifies the address of the recorded code with the data recorded in the storage area of the currently executing thread (step 1002). ) The process ends with the result indicating 2 left.
- the abort handler 204 determines whether or not the cause of the abort is JIT compilation (step 1004). If the cause of the abort is JIT compilation (step 1004: YES), the abort handler 204 JIT compiles the method identified by the ID recorded in the storage area of the currently executing thread (step 100), 2 The process ends with a result indicating
- the abort handler 204 determines whether the cause of the abort is TLH allocation or asynchronous GC check (step 1008). If the cause of the abort is either TLH allocation or asynchronous GC check (step 1008: YES), the abort handler 204 ends the process leaving a result indicating 1.
- step 1010 determines whether the cause of the abort is a class load (step 1010). . If the cause of the abort is not class loading (step 1010: NO), the process continues to step 520 in the flowchart shown in FIG. On the other hand, if the cause of the abort is class loading (step 1010: YES), then the abort handler 204 determines whether the non-tx-once flag for the current transaction block is set (step) 1012).
- step 1012 If the non-tx-once flag is not set (step 1012: NO), then the abort handler 204 sets the non-tx-execution flag of the currently executed thread (step 1014). On the other hand, if the non-tx-once flag is set (step 1012: YES), the abort handler 204 invalidates the current transaction block (step 1016). After step 1014 or step 1016, the abort handler 204 ends the process leaving a result indicating 1.
- FIG. 11 is a flowchart illustrating an example of the flow of processing by the JIT compiler 220.
- FIG. 12 is a flowchart showing another example of the process flow of the first half by the abort handler 204 in step 316 of the flowchart shown in FIG.
- the flowchart shown in FIG. 11 starts when a certain method is executed a predetermined number of times and the JIT compiler 220 is called, and the JIT compiler 220 determines whether there is a transaction block in the code to be compiled (step 1100). If there is a transaction block in the code to be compiled (step 1100: YES), then the JIT compiler 220 determines whether there is a call for code correction in the found transaction block (step 1102).
- step 1102 If there is a code correction call in the found transaction block (step 1102: YES), the JIT compiler 220 replaces the found code correction call with the transaction abort instruction and the code replaced from the instruction address of the abort instruction.
- a correspondence table for information necessary for execution of correction is created (step 1104).
- information necessary for executing the code correction is an address and data to be corrected at the time of execution.
- step 1100 If there is no transaction block in the code to be compiled in step 1100 (step 1100: NO), if there is no code modification call in the transaction block found in step 1102 (step 1102: NO), or processing from step 1104 Advances to step 1106, the JIT compiler 220 performs normal JIT compilation processing, and thereafter ends the processing.
- the flowchart shown in FIG. 12 starts at step 1200, and the abort handler 204 determines whether or not the cause of the abort is symbol resolution. This determination can be made by searching the correspondence table created by the JIT compiler 220 at the instruction address where the abort occurred, and determining whether or not there is a hit. If a hit occurs, it can be determined that the cause of the abort is symbol resolution. If the cause of the abort is symbol resolution (step 1200: YES), the abort handler 204 obtains necessary information by subtracting the correspondence table created by the JIT compiler 220 from the instruction address where the abort occurred. The code is corrected using the information, and the abort instruction is replaced with a nop instruction which means that nothing is done (step 1202). Thereafter, the abort handler 204 ends the process leaving a result indicating 2.
- the abort handler 204 determines whether the cause of the abort is TLH allocation or asynchronous GC check (step 1204). If the cause of the abort is either TLH allocation or asynchronous GC check (step 1204: YES), the abort handler 204 ends the process leaving a result indicating 1.
- step 1204 determines whether the cause of the abort is JIT compilation or class loading (step 1204). Step 1206). If the cause of the abort is neither JIT compilation nor class loading (step 1206: NO), the process continues to step 520 of the flowchart shown in FIG. On the other hand, if the cause of the abort is either JIT compilation or class loading (step 1206: YES), then the abort handler 204 determines whether the non-tx-once flag for the current transaction block is set. Is determined (step 1208).
- step 1208 If the non-tx-once flag is not set (step 1208: NO), then the abort handler 204 sets the non-tx-execution flag of the currently executed thread (step 1210). On the other hand, if the non-tx-once flag is set (step 1208: YES), the abort handler 204 invalidates the current transaction block (step 1212). After step 1210 or step 1212, the abort handler 204 ends the process leaving a result indicating 1.
- FIG. 13 is a flowchart showing another example of the processing flow of the first half by the abort handler 204 in step 316 of the flowchart shown in FIG.
- the flowchart shown in FIG. 13 starts at step 1300, and the abort handler 204 determines whether or not the cause of the abort is a code correction. If the cause of the abort is code correction (step 1300: YES), the abort handler 204 write-protects the page including the instruction address where the abort occurred (step 1302). Thereafter, the abort handler 204 ends the process leaving a result indicating 2.
- the abort handler 204 determines whether the cause of the abort is a write protection exception (step 1304). If the cause of the abort is a write protection exception (step 1304: YES), the abort handler 204 modifies the runtime code by disabling the write protection and identifying the write instruction where the write protection occurred. The power address and data are acquired, and the code at the time of execution is corrected (step 1306). Thereafter, the abort handler 204 ends the process leaving a result indicating 2.
- the abort handler 204 determines whether the cause of the abort is a TLH allocation or an asynchronous GC check (step 1308). If the cause of the abort is either TLH allocation or asynchronous GC check (step 1308: YES), the abort handler 204 ends the process leaving a result indicating 1.
- the abort handler 204 determines whether the cause of the abort is JIT compilation or class loading (step 1308). Step 1310). If the cause of the abort is neither JIT compilation nor class loading (step 11310: NO), the process continues to step 520 of the flowchart shown in FIG. On the other hand, if the cause of the abort is either JIT compilation or class loading (step 1310: YES), then the abort handler 204 determines whether the non-tx-once flag for the current transaction block is set. Is determined (step 1312).
- step 1312 If the non-tx-once flag is not set (step 1312: NO), then the abort handler 204 sets the non-tx-execution flag of the currently executed thread. On the other hand, if the non-tx-once flag is set (step 1312: YES), the abort handler 204 invalidates the current transaction block (step 1316). After step 1314 or step 1316, the abort handler 204 ends the process leaving a result indicating 1.
- FIG. 14 is a flowchart showing another example of the flow of processing by the abortive runtime helper 219 in step 312 of the flowchart shown in FIG.
- FIG. 15 is a flowchart showing another example of the processing flow of the first half by the abort handler 204 in step 316 of the flowchart shown in FIG.
- FIG. 16 is a flowchart illustrating another example of the transaction block validation processing flow.
- the flowchart shown in FIG. 14 starts at step 1400, and the abortive runtime helper 219 determines whether the processing content is JIT compilation or class loading. If the processing content is either JIT compilation or class loading (step 1400: YES), the abortive runtime helper 219 should perform JIT compilation in the storage area of the currently executing thread using a non-transactional write instruction. Write the ID of the method or the ID of the class to be loaded (step 1402).
- the abortive runtime helper 219 uses an ID indicating the type of the abortable runtime helper 219 as an argument indicating the cause of the abort.
- a transaction abort instruction is issued (step 1404). Thereafter, the abortive runtime helper 219 terminates the process.
- the flowchart shown in FIG. 15 starts at step 1500, and the abort handler 204 determines whether the cause of the abort is TLH allocation or asynchronous GC check. If the cause of the abort is either TLH allocation or asynchronous GC check (step 1500: YES), the abort handler 204 ends the process leaving a result indicating 1. On the other hand, if the cause of the abort is neither TLH allocation nor asynchronous GC check (step 1500: NO), then the abort handler 204 determines whether the cause of the abort is symbol resolution (step 1502). . If the cause of the abort is symbol resolution (step 1502: NO), the abort handler 204 immediately invalidates the current transaction block (step 1504), and ends the process leaving a result indicating 1.
- the abort handler 204 determines whether the cause of the abort is JIT compilation or class loading (step 1506). If the cause of the abort is neither JIT compilation nor class loading (step 1506: NO), the process continues to step 520 of the flowchart shown in FIG. On the other hand, if the cause of the abort is either JIT compilation or class loading (step 1506: YES), then the abort handler 204 determines whether the non-tx-once flag is set for the current transaction block. Is determined (step 1508).
- step 1508 If the non-tx-once flag is not set (step 1508: NO), then the abort handler 204 sets the non-tx-execution flag of the currently executed thread (step 1510). On the other hand, if the non-tx-once flag is set (step 1508: YES), the abort handler 204 stores the method ID or class ID recorded in the storage area of the currently executing thread in the global table. Write (step 1512). Subsequently, the abort handler 204 invalidates the current transaction block (step 1514). After step 1510 or step 1514, the abort handler 204 ends the process leaving a result indicating 1.
- the flowchart shown in FIG. 16 starts at step 1600, and the execution unit 208 waits until all methods and all classes in the global table are JIT-compiled or loaded, respectively. Subsequently, the execution unit 208 re-enables all the transaction blocks invalidated due to JIT compilation or class loading, and resets the corresponding execution counter, abort counter, and non-tx-once flag (Step S208). 702). Then, the execution unit 208 ends the process.
- FIG. 17A shows the result of evaluating the performance of a 4-core zEC12 machine to which the abort reduction method of the present invention is applied using a micro benchmark that adds a counter.
- FIG. 17B shows a result of evaluating the performance of a 16-core zEC12 machine to which the abort reduction method of the present invention is applied using Java (registered trademark) ConcurrentHashMap using HTM.
- the horizontal axis indicates the number of threads
- the vertical axis indicates the throughput. Note that the throughput value is 1 when the conventional technology for one thread is applied.
- the applied abort reduction method of the present invention is the abort reduction method according to the third embodiment described above.
- the compared prior art is a method described in Non-Patent Document 1, and when a transaction aborts, it is re-executed several times. If abort still occurs, a non-transaction path is executed and then the transaction is performed again. It is a technique of executing.
- FIG. 17A the performance is reduced by 89% when the present invention is not used.
- the experimental result shown in FIG. 17B the performance is reduced by 13% when the present invention is not used. This is because if the present invention is not used, JIT compilation and runtime code correction occur in the transaction, and the transaction continues to abort.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
- Executing Machine-Instructions (AREA)
Abstract
Description
前記アボート・ハンドラの実行は、前記ランタイムヘルパーが実行時コード修正であることを条件に、アボートが起きた命令アドレスを含むページを書き込み禁止にし、及び、アボートの原因が書込み保護の例外であることを条件に、前記書込み禁止を無効化し、書込み保護が起きた位置の書き込み命令を識別することにより実行時コード修正されるべきアドレスとデータを取得して、前記実行時コード修正を行う処理をふくむ。そして上記アボート削減方法は、(k)前記コンピュータが、前記アボート・ハンドラによる書き込み禁止処理又は前記実行時コード修正の後ステップ(c)の代わりに、前記トランザクションブロックを再実行するステップを更に含む。
・新しいクラスがロードされない時間、又は新しいメソッドがコンパイルされない時間、或いはその両方が10秒間以上続いた
・クラスが新たに1000個ロードされた、又はメソッドが新たに1000個コンパイルされた、或いはその両方である
・1秒間にロードされるクラス数、又は1秒間にコンパイルされるメソッド数、あるいはその両方を監視して、10個/秒未満になった
なお、10秒、1000個などの数は一例であり、予備実験で最適な値を予め求めておくのが好ましい。
A.一時的な非トランザクションモードに入るタイミング
A1. 一時的な非トランザクションモードへ入るタイミングをトランザクションごとに決定する(ベースの手法)
A2. プログラム実行開始直後のウォーミングアップにおいて一時的な非トランザクションモードに積極的に入っておく(その後プログラムが安定状態となった後にA1.の手法を採用)
B.アボート原因の識別方法
B1. アボート性ランタイムヘルパー219のID情報をアボートの原因を示す情報とし、トランザクションアボート命令の引数とする(ベースの手法)
B2. 非トランザクション書き込み命令を用いて、アボート性ランタイムヘルパー219のID情報を現在実行中のスレッドのランタイムヘルパーの記録領域に記録する
B3. 非トランザクション書き込み命令を用いて、アボート性ランタイムヘルパー219のID情報のみならず、アボート性ランタイムヘルパー219の処理に必要な情報をも現在実行中のスレッドのランタイムヘルパーの記録領域に記録する
B4. トランザクションアボート命令の命令アドレスからコード修正に必要な情報への対応表を作成する
B5. ページ保護機能を利用する
なお、非トランザクション書き込み命令とは通常の書き込み命令を意味し、トランザクションがアボートしてもロールバックされることはない書き込み命令をいう。
C.アボート原因の解決方法
C1. 非トランザクションパスの実行、又はトランザクションブロックの無効化、或いはその両方(ベースの手法)
C2. アボート性ランタイムヘルパー219の処理を遅延させ、アボート・ハンドラ204の実行中に行う
D.一時的な非トランザクションモードから抜け出すタイミング
D1. プログラムが定常状態に達するのまで待つ(ベースの手法)
D2. アボート・ハンドラ204内での遅延処理が終わるまで待つ
D3. アボートにより実行されなかったクラスロードの全てのクラスがロードされ、又はコンパイルされなかった全てのメソッドがコンパイルされ、或いはその両方がなされるまで待つ
あるランタイムヘルパーがトランザクションを実行中に呼び出された場合にアボートを引き起こすか否かはHTMの実装に依存する。例えば、JITコンパイルは、非常に大きいトランザクションサイズをサポートする実装上ではトランザクションのアボートを引き起こすことはない。このような実装において、アボート性ランタイムヘルパー219がトランザクション中に呼び出される度トランザクションアボート命令を発行すると、パフォーマンスの低下を招いてしまう。
ベースの第1の実施形態では、アボート性ランタイムヘルパー219がコード修正の場合、直ちにトランザクションブロックを無効化する。アボート性ランタイムヘルパー219がJITコンパイラ220である場合も、1度の非トランザクションパスの実行においてJITコンパイラ220が呼び出されないことを条件にトランザクションブロックを無効化する。上述したように非トランザクションパスの実行はトランザクションブロックの実行よりも遅いので、トランザクションブロックを無効化するとパフォーマンスが低下する。
第3の実施の形態では非トランザクション書き込み命令を利用した。しかしながら非トランザクション書き込み命令をサポートしないマシンも存在する。
コード修正は、シンボル解決だけでなく、JITコンパイルや多相的インライン・メソッド・キャッシュ(polymorphic inline methodcaching)など、JITコンパイルされたコードにおいてよく利用される。しかしながらこれまで述べてきたように、コード修正はトランザクションを実行中に呼び出されるとアボートを引き起こす。第3の実施形態のようにアボート・ハンドラ204の処理が開始されるまでその実行を遅延させることもできるが、ソフトウェアエンジニアリングの観点からすれば、マネージドランタイムにおいて、全てのコード修正の位置で遅延処理のためのロジックを挿入することは現実的ではない。
ベースの第1の実施形態では、JITコンパイラ220又はクラスローダー222のトランザクション中の呼び出しに起因してトランザクションブロックを無効化した場合、プログラムが定常状態になるのを待ってトランザクションブロックを再有効化する。しかしながら、プログラムの定常状態において、原因となったメソッドがJITコンパイルされ、又は原因となったクラスがロードされているという保証はない。
Claims (20)
- ハードウェアトランザクショナルメモリを用いたプログラム実行においてアボートの回数を削減するためのコンピュータによる方法であって、
(a)前記コンピュータが、トランザクションブロックの実行中におけるランタイムヘルパーの呼び出しに応答して、前記ランタイムヘルパーを実行するステップと、
(b)前記ランタイムヘルパーの呼び出しに起因したアボートに応答して、前記コンピュータが、アボート・ハンドラを実行するステップと、
(c)ステップ(b)の前記アボート・ハンドラの実行の後、前記コンピュータが、前記トランザクションブロックに対応する非トランザクションパスを実行するステップとを含み、
前記ランタイムヘルパーの実行は、ランタイムヘルパーの種別を示すID情報を前記アボート・ハンドラに渡すための処理を含み、
前記アボート・ハンドラの実行は、アボートの原因となった前記ランタイムヘルパーの前記ID情報を取得し、特定の種別のランタイムヘルパーに対して前記トランザクションブロックを無効化する処理を含む、
アボート削減方法。 - 前記特定の種別のランタイムヘルパーに対して前記トランザクションブロックを無効化する処理は、非トランザクションパスにおいても実行不可能な第1の種別のランタイムヘルパーに対し無条件で前記トランザクションブロックを無効化する処理と、非トランザクションパスにおいては実行可能な第2の種別のランタイムヘルパーに対し、一度の前記非トランザクションパスを実行中に前記第2の種別のランタイムヘルパーが呼び出されないことを条件として前記トランザクションブロックを無効化する処理とを含む、請求項1に記載のアボート削減方法。
- 前記第1の種別のランタイムヘルパーは、実行時コード修正を含み、前記第2の種別のランタイムヘルパーは、実行時コンパイルとクラスロードとを含む、請求項2に記載のアボート削減方法。
- (d)条件付きで前記トランザクションブロックが無効化された場合において、前記コンピュータが、プログラムが定常状態に達したことに応答して前記トランザクションブロックを再有効化するステップを更に含む、請求項3に記載のアボート削減方法。
- 前記ランタイムヘルパーの実行は、前記ランタイムヘルパーが前記第2の種別のランタイムヘルパーである場合に、その処理内容を、非トランザクション書き込み命令を用いて記録し、及び、前記ID情報を引数としてトランザクションアボート命令を発行する処理を含み、前記アボート・ハンドラの実行は、前記第2の種別のランタイムヘルパーに対して前記トランザクションブロックを無効化する場合に、前記記録した処理内容を表に登録し、及び、(e)前記コンピュータが、前記表に登録された処理内容が実行されたことに応答して、前記トランザクションブロックを再有効化するステップを更に含む、請求項3に記載のアボート削減方法。
- 前記第2の種別のランタイムヘルパーが実行時コンパイルである場合、前記処理内容は、コンパイルすべきメソッドの識別情報であり、前記第2の種別のランタイムヘルパーがクラスロードである場合、前記処理内容は、ロードすべきクラスの識別子である請求項5に記載のアボート削減方法。
- 前記アボート・ハンドラは、スレッドローカルヒープ割付と、非同期ガーベジコレクションチェックとを、前記特定の種別以外のランタイムヘルパーとして判断する、請求項3に記載のアボート削減方法。
- (f)前記コンピュータが、プログラムの実行開始において全てのトランザクションブロックを無効化するステップと、(g)前記コンピュータが、前記プログラムの実行開始から所定の期間が経過することに応答して、前記全てのトランザクションブロックを有効化するステップとを更に含む、請求項1に記載のアボート削減方法。
- 前記ランタイムヘルパーの実行は、トランザクションアボート命令を発行する処理を含み、前記ID情報をアボート・ハンドラに渡すための処理は、前記ID情報を前記トランザクションアボート命令の引数とする処理を含む、請求項1に記載のアボート削減方法。
- 前記ID情報をアボート・ハンドラに渡すための処理は、非トランザクション書き込み命令を用いて前記ID情報を記録する処理を含み、該処理の後前記ランタイムヘルパーは本来のランタイムヘルパーの処理を行う、請求項1に記載のアボート削減方法。
- 前記ランタイムヘルパーの実行は、該ランタイムヘルパーが前記特定の種別と異なる他の種別のランタイムヘルパーであることを条件に、その実行に必要な情報を、非トランザクション書き込み命令を用いて記録する処理を含み、前記アボート・ハンドラの実行は、前記他の種別のランタイムヘルパーに対し、記録された前記必要な情報を用いてその実行を行う処理を含み、及び、該処理の後ステップ(c)の代わりに、(h)前記コンピュータが、前記トランザクションブロックを再実行するステップを含む、請求項1に記載のアボート削減方法。
- 前記ランタイムヘルパーの実行は、該ランタイムヘルパーが前記特定の種別と異なる他の種別のランタイムヘルパーであることを条件に、その実行に必要な情報を、非トランザクション書き込み命令を用いて記録する処理と、その実行をキャンセルする処理とを含み、(i)前記コンピュータが、前記トランザクションブロックを実行後、前記他の種別のランタイムヘルパーに対し、記録された前記必要な情報を用いてその実行処理を行うステップを更に含む、請求項1に記載のアボート削減方法。
- 前記特定の種別のランタイムヘルパーはクラスロードを含み、前記他の種別のランタイムヘルパーは、実行時コンパイルであり、前記実行に必要な情報はコンパイルすべきメソッドの識別情報である、請求項11又は12に記載のアボート削減方法。
- 前記特定の種別のランタイムヘルパーはクラスロードを含み、前記他の種別のランタイムヘルパーは、実行時コード修正であり、前記実行に必要な情報は実行時コード修正されるべきアドレス及びデータである、請求項11又は12に記載のアボート削減方法。
- 前記ランタイムヘルパーが実行時コンパイルである場合に、前記ランタイムヘルパーの実行は、コンパイル対象のコードに含まれるトランザクションブロック内の実行時コード修正の呼び出しを、トランザクションアボート命令で置換し、該トランザクションアボート命令のアドレスから前記実行時コード修正に必要な情報への対応表を作成する処理を含み、(j)前記コンピュータが、置換された前記トランザクションアボート命令の実行に応答してアボート・ハンドラを実行した後に、前記トランザクションブロックを再実行するステップを更に含み、前記アボート・ハンドラの実行は、前記トランザクションアボート命令のアドレスから前記対応表を引いて必要な情報を取得することにより前記実行時コード修正を行い、前記トランザクションアボート命令をnop命令で上書きする処理を含む、請求項1に記載のアボート削減方法。
- 前記アボート・ハンドラの実行は、前記ランタイムヘルパーが実行時コード修正であることを条件に、アボートが起きた命令アドレスを含むページを書き込み禁止にし、及び、アボートの原因が書込み保護の例外であることを条件に、前記書込み禁止を無効化し、書込み保護が起きた位置の書き込み命令を識別することにより実行時コード修正されるべきアドレスとデータを取得して、前記実行時コード修正を行い、(k)前記コンピュータが、前記アボート・ハンドラによる書き込み禁止処理又は前記実行時コード修正の後ステップ(c)の代わりに、前記トランザクションブロックを再実行するステップを更に含む、請求項1に記載のアボート削減方法。
- コンピュータに、請求項1乃至16のいずれかに一項に記載のアボート削減方法の各ステップを実行させるためのアボート削減プログラム。
- 請求項1乃至16のいずれかに一項に記載のアボート削減方法の各ステップを実行するように適合された手段を備える、アボート削減装置。
- ハードウェアトランザクショナルメモリを用いたプログラム実行においてアボートの回数を削減するための装置であって、
実行部と、
複数のランタイムヘルパーと、
アボート・ハンドラとを含み、
前記ランタイムヘルパーの各々は、前記実行部によるトランザクションブロックの実行中に呼び出されることに応答して、ランタイムヘルパーの種別を示すID情報を前記アボート・ハンドラに渡すための処理を行い、
前記アボート・ハンドラは、アボートの原因となった前記ランタイムヘルパーの前記ID情報を取得し、特定の種別のランタイムヘルパーに対して前記トランザクションブロックを無効化する処理を行い、及び、
前記実行部は、前記ランタイムヘルパーの呼び出しに起因した前記アボート・ハンドラの処理の後に、前記トランザクションブロックに対応する非トランザクションパスを実行する、アボート削減装置。 - 前記特定の種別のランタイムヘルパーに対して前記トランザクションブロックを無効化する処理は、非トランザクションパスにおいても実行不可能な第1の種別のランタイムヘルパーに対し無条件で前 記トランザクションブロックを無効化する処理と、非トランザクションパスにおいては実行可能な第2の種別のランタイムヘルパーに対し、一度の前記非トランザクションパスを実行中に前記第2の種別のランタイムヘルパーが呼び出されないことを条件として前記トランザクションブロックを無効する処理とを含み、前記実行部は、条件付きで前記トランザクションブロックが無効化された場合に、プログラムが定常状態に達したことに応答して前記トランザクションブロックを再有効化する、請求項19に記載のアボート削減装置。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2015501363A JP5901835B2 (ja) | 2013-02-22 | 2014-01-21 | アボート削減方法、アボート削減装置、及びアボート削減プログラム |
US14/769,739 US9501314B2 (en) | 2013-02-22 | 2014-01-21 | Reducing aborts caused by a runtime helper called during execution of a transaction block |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013-033433 | 2013-02-22 | ||
JP2013033433 | 2013-02-22 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2014129247A1 true WO2014129247A1 (ja) | 2014-08-28 |
Family
ID=51391044
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/JP2014/051051 WO2014129247A1 (ja) | 2013-02-22 | 2014-01-21 | アボート削減方法、アボート削減装置、及びアボート削減プログラム |
Country Status (3)
Country | Link |
---|---|
US (1) | US9501314B2 (ja) |
JP (1) | JP5901835B2 (ja) |
WO (1) | WO2014129247A1 (ja) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019120464A1 (en) * | 2017-12-18 | 2019-06-27 | Huawei Technologies Co., Ltd. | Scalable hardware transactional memory |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010121218A (ja) | 2001-12-04 | 2010-06-03 | Nippon Steel Corp | 金属酸化物及び/又は金属水酸化物被覆金属材料の製造方法 |
WO2011081704A2 (en) * | 2009-12-15 | 2011-07-07 | Intel Corporation | Handling operating system (os) transitions in an unbounded transactional memory (utm) mode |
Family Cites Families (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8706982B2 (en) * | 2007-12-30 | 2014-04-22 | Intel Corporation | Mechanisms for strong atomicity in a transactional memory system |
US7966459B2 (en) | 2007-12-31 | 2011-06-21 | Oracle America, Inc. | System and method for supporting phased transactional memory modes |
US8776063B2 (en) | 2008-11-26 | 2014-07-08 | Oracle America, Inc. | Method and system for hardware feedback in transactional memory |
CN101788922B (zh) * | 2009-01-22 | 2013-12-25 | 国际商业机器公司 | 基于辅助线程实现事务存储系统的方法和装置 |
US8489864B2 (en) | 2009-06-26 | 2013-07-16 | Microsoft Corporation | Performing escape actions in transactions |
US8301849B2 (en) * | 2009-12-23 | 2012-10-30 | Intel Corporation | Transactional memory in out-of-order processors with XABORT having immediate argument |
US9626187B2 (en) * | 2010-05-27 | 2017-04-18 | International Business Machines Corporation | Transactional memory system supporting unbroken suspended execution |
KR101203131B1 (ko) | 2010-07-26 | 2012-11-20 | (주)지오메디칼 | 다공성 콘택트렌즈 제조방법 및 그 제조방법에 의하여 제조된 다공성 콘택트렌즈 |
US8424015B2 (en) * | 2010-09-30 | 2013-04-16 | International Business Machines Corporation | Transactional memory preemption mechanism |
US9436477B2 (en) * | 2012-06-15 | 2016-09-06 | International Business Machines Corporation | Transaction abort instruction |
US20150278123A1 (en) * | 2014-03-28 | 2015-10-01 | Alex Nayshtut | Low-overhead detection of unauthorized memory modification using transactional memory |
-
2014
- 2014-01-21 WO PCT/JP2014/051051 patent/WO2014129247A1/ja active Application Filing
- 2014-01-21 JP JP2015501363A patent/JP5901835B2/ja not_active Expired - Fee Related
- 2014-01-21 US US14/769,739 patent/US9501314B2/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010121218A (ja) | 2001-12-04 | 2010-06-03 | Nippon Steel Corp | 金属酸化物及び/又は金属水酸化物被覆金属材料の製造方法 |
WO2011081704A2 (en) * | 2009-12-15 | 2011-07-07 | Intel Corporation | Handling operating system (os) transitions in an unbounded transactional memory (utm) mode |
Also Published As
Publication number | Publication date |
---|---|
US20160004557A1 (en) | 2016-01-07 |
US9501314B2 (en) | 2016-11-22 |
JP5901835B2 (ja) | 2016-04-13 |
JPWO2014129247A1 (ja) | 2017-02-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9626187B2 (en) | Transactional memory system supporting unbroken suspended execution | |
US8544022B2 (en) | Transactional memory preemption mechanism | |
JP5592015B2 (ja) | ハードウェア制限に基づく調整可能なトランザクション・サイズを利用してコードを動的に最適化する装置、方法およびシステム | |
US8402224B2 (en) | Thread-shared software code caches | |
US8990786B2 (en) | Program optimizing apparatus, program optimizing method, and program optimizing article of manufacture | |
JP5460430B2 (ja) | 動的コンパイラプログラム、動的コンパイル方法及び動的コンパイル装置 | |
TWI812750B (zh) | 交易式比較及丟棄指令 | |
TWI786181B (zh) | 在例外遮罩更新指令之後允許未中止的交易處理 | |
JP2011134202A (ja) | メモリ管理装置、メモリ管理方法、及びメモリ管理プログラム | |
CN107003897B (zh) | 监控事务处理资源的利用率 | |
US8296742B2 (en) | Automatic native generation | |
US10346196B2 (en) | Techniques for enhancing progress for hardware transactional memory | |
CN101425052B (zh) | 一种事务性内存的实现方法 | |
JP5901835B2 (ja) | アボート削減方法、アボート削減装置、及びアボート削減プログラム | |
Zhou et al. | Efficient atomic durability on eADR-enabled persistent memory | |
EP2176761B1 (en) | Object model for transactional memory | |
JP2007249736A (ja) | 言語処理実行方法およびその計算機システム | |
Yang et al. | Lightweight monitors for the Java virtual machine | |
Nowack et al. | Parallelize the Runtime Checks–Not the Application | |
JP2015090647A (ja) | ハードウェア割り込みを用いるサンプリング・プロファイラの精度改善方法、システム、及びプログラム |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 14754188 Country of ref document: EP Kind code of ref document: A1 |
|
ENP | Entry into the national phase |
Ref document number: 2015501363 Country of ref document: JP Kind code of ref document: A |
|
WWE | Wipo information: entry into national phase |
Ref document number: 14769739 Country of ref document: US |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 14754188 Country of ref document: EP Kind code of ref document: A1 |