# Patent

## Title
Multi-section garbage collection system including shared performance monitor register

## Abstract

A system includes memory and a hardware processor. The memory includes a load-monitored region register (LMRR) and a sampled data address register (SDAR). The hardware processor is configured to perform a garbage collection process that reclaims unused objects of the memory. The hardware processor further executes a performance monitoring process that provides information indicating a utilization of an instruction performed by the hardware processor. The SDAR is configured to store first data generated according to the garbage process and second data generated according to the performance monitoring process.

## Background
BACKGROUND
Various non-limiting embodiments described herein relate generally to computer memory management, and more specifically, to a multi-section garbage collection system.
Garbage collection is an automatic memory management process that identifies objects in memory that are no longer being referenced and frees those objects. As memory objects of varying sizes are allocated and later freed, the memory in which they are stored becomes increasingly fragmented. Eventually, very few large free areas of memory exist, and it becomes difficult to store additional objects without increasing the memory size. When this occurs, a process within garbage collection, referred to as compaction, is employed in order to consolidate the allocated objects into one large area, leaving another large area of free space available for new objects. During consolidation, the memory objects that are still being referenced are moved from one area of memory to another area of memory.
Conventionally, when garbage collection is performed on an object storage area, applications using the object storage area are required to pause or halt execution. One reason for this is to determine whether the pointers to the objects used by the applications to access the objects are still valid, since the objects may have moved. These pauses, occasionally several seconds long, prevent the applications from being used for time-sensitive tasks, such as transaction processing, real-time games, or mechanical control. Thus, a need exists for an optimized garbage collection process.
SUMMARY
According to a non-limiting embodiment, a system includes memory and a hardware processor. The memory includes a load-monitored region register (LMRR) and a sampled data address register (SDAR). The hardware processor is configured to perform a garbage collection process that reclaims unused objects of the memory. The hardware processor further executes a performance monitoring process that provides information indicating a utilization of an instruction executed by the hardware processor. The SDAR is configured to store first data generated according to the garbage process and second data generated according to the performance monitoring process.
According to another non-limiting embodiment, a method of managing a memory unit comprises designating a load-monitored region register (LMRR) and a sampled data address register (SDAR) in the memory unit. The method further comprises sharing the SDAR between a garbage collection process that reclaims unused objects of the memory. The method further includes executing a performance monitoring process that provides information indicating a utilization of an instruction executed by the hardware processor, wherein the SDAR stores first data generated according to the garbage process and second data generated according to the performance monitoring process.
According to yet another non-limiting embodiment, a computer program product manages a memory unit. The computer program product comprises a computer readable storage medium having program instructions embodied therewith. The program instructions are executable by an electronic computer processor to perform operations comprising designating a load-monitored region register (LMRR) and a sampled data address register (SDAR) in the memory unit, and sharing the SDAR between a garbage collection process that reclaims unused objects of the memory. The operations further include executing a performance monitoring process that provides information indicating a utilization of an instruction executed by the hardware processor, wherein the SDAR stores first data generated according to the garbage process and second data generated according to the performance monitoring process.
Additional features are realized through the techniques of the present invention. Other embodiments are described in detail herein and are considered a part of the claimed invention. For a better understanding of the invention with the features, refer to the description and to the drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 depicts a block diagram illustrating a computing environment to incorporate and use one or more features of the various inventive concepts.
FIG. 2 depicts a block diagram illustrating a computing environment to incorporate and use one or more features of the various inventive concepts.
FIG. 3 depicts a block diagram illustrating further details with respect to the memory of FIG. 2.
FIG. 4A depicts an illustrative example of a load monitored doubleword indexed instruction;
FIG. 4B depicts an illustrative example of load doubleword monitored instruction.
FIG. 5 depicts a block diagram illustrating detail of memory for which garbage collection is to be performed.
FIG. 6 depicts an illustrative example of a load monitored region register.
FIG. 7 depicts a flowchart illustrating a process for configuring a Load Monitored Region Register (LMRR) and a Load Monitored Segment Enable Register (LMSER).
FIGS. 8A-8B depict an illustrative example of logic to perform garbage collection using the load monitored doubleword indexed instruction.
FIG. 9 is a flow diagram illustrating a non-limiting embodiment of logic to take action by a handler based on a condition.
FIG. 10 is a block diagram of a computing environment including a performance monitor and a shared Sampled Data Address Register (SDAR) according to a non-limiting embodiment.
FIG. 11 is a flow diagram illustrating a method of performing a multi-section garbage collection using a shared performance monitor register according to a non-limiting embodiment.
FIG. 12 is a flow diagram illustrates a method of performing a multi-section garbage collection using a shared performance monitor register according to a non-limiting embodiment.
FIG. 13 depicts a block diagram illustrating a system to perform a garbage collection process, in accordance with an embodiment.
FIG. 14 depicts an illustrative example of a cloud computing environment, in accordance with an embodiment.
FIG. 15 depicts an illustrative example of abstraction model layers, in accordance with an embodiment.



DETAILED DESCRIPTION
In accordance with one or more aspects, a capability is provided for an optimized garbage collection process that advantageously improves application performance, improves performance of the processor executing the application, and/or improves performance of the computing environment in which the processor executes.
The optimized garbage collection process allows applications (also referred to as programs) that are accessing objects in an area of memory not undergoing garbage collection to continue processing during garbage collection without interruption, allows applications accessing objects in an area of memory being garbage collected to continue processing after a very short unnoticeable delay, and further improves the handling of the object pointers (also referred to as pointers). In one embodiment, an instruction, referred to as a load monitored doubleword indexed (ldmx) instruction, is provided and used whenever an application accesses a pointer to an object in memory. When such an instruction accesses a pointer that indicates an object that lies within a given address range, the processor causes an asynchronous branch (referred to as an Event-Based Branch (EBB)) to a pointer update handler (also referred to as a garbage collection handler, an EBB handler, or handler). This enables the pointer update handler to update the pointer (e.g., the address of the object) if the object pointed to has been moved during an ongoing garbage collection process or is moved by the handler. In order to update the pointer, the handler needs to know its address. In one embodiment of the instruction, the address of the pointer is calculated internally by the hardware during execution of the ldmx instruction, and is not available to the pointer update handler. Thus, in order to determine the address of the pointer, the pointer update handler examines the ldmx instruction to determine the source registers, reads the source registers, and calculates the address of the pointer based on contents of the source registers.
In addition, at least one embodiment provides a feature where the hardware (e.g., the handler) which invokes the garbage collection EBB determines the amount of garbage collection work to perform based on the fairness and urgency of the running application, or importance of the current task. Various criteria may be considered when determining the fairness, urgency or importance including, but not limited to, program priority, a pre-allocated time per EBB assigned to the application, the current number of work credits assigned to the application, i.e., where work credits are earned by doing garbage collection work when no engaged in critical tasks, latency requirements of the application (e.g., low latencies for high-speed trading), and the amount of remaining unused object space. Thus, the amount of garbage collection work can be dynamically reduced when the handler determines that the current task or running application is assigned a high-priority, for example, and vice-versa. Upon invoking the garbage collection EBB, various operations may be performed to monitor the garbage collection work including, but not limited to, performing a fixed GC work or moving a fixed number of objects, setting the amount of garbage collection work performed to be proportional to a priority of the current application or task, determining an amount of bounded time spent on performing garbage collection work, and using a credit-based scheme to determine the amount work to perform. When a credit-based scheme is performed, the garbage collection work may be performed on-demand as objects are accessed. This results in a fair execution of the garbage collection EBB since the amount of garbage collection work is based on the rate of object usage.
With reference now to FIG. 1, a block diagram (100) is provided illustrating a computing environment to incorporate and use one or more aspects. The computing environment includes a processor (102) (e.g., a central processing unit), memory 104 (e.g., main memory), and one or more input/output (I/O) devices and/or interfaces (106) coupled to one another via, for example, one or more buses (108) and/or other connections.
The processor (102) is based on the Power Instruction Set Architecture (ISA) offered by International Business Machines Corporation. In at least one embodiment, the Power ISA is described in “Power ISATM Version 2.07B,” International Business Machines Corporation, Apr. 9, 2015, which is hereby incorporated herein by reference in its entirety. POWER ISA® is a registered trademark of International Business Machines Corporation, Armonk, N.Y., USA. Other names used herein may be registered trademarks, trademarks, or product names of International Business Machines Corporation or other companies.
In another example, processor (102) is based on the z/Architecture offered by International Business Machines Corporation, and is part of a server, such as the System z server, which implements the z/Architecture and is also offered by International Business Machines Corporation. At least one embodiment of the z/Architecture is described in an IBM® publication entitled, “z/Architecture Principles of Operation,” IBM® Publication No. SA22-7832-09, Tenth Edition, September, 2012, which is hereby incorporated herein by reference in its entirety. In one example, the processor executes an operating system, such as z/OS, also offered by International Business Machines Corporation. IBM®, Z/ARCHITECTURE® and Z/OS® are registered trademarks of International Business Machines Corporation.
In yet a further embodiment, processor (102) is based on an Intel architecture offered by Intel Corporation. Intel® is a registered trademark of Intel Corporation, Santa Clara, Calif. Yet further, processor (102) may be based on other architectures. The architectures mentioned herein are merely provided as examples.
Another non-limiting embodiment of a computing environment to incorporate and use one or more features is described with reference to FIG. 2. In this example, a computing environment (200) includes, for instance, a native central processing unit (202), memory (204), and one or more input/output devices and/or interfaces (206) coupled to one another via, for example, one or more buses (208) and/or other connections. As examples, computing environment (200) may include a PowerPC processor, a zSeries server, or a pSeries server offered by International Business Machines Corporation, Armonk, N.Y.; an HP Superdome with Intel Itanium II processors offered by Hewlett Packard Co., Palo Alto, Calif.; and/or other machines based on architectures offered by International Business Machines Corporation, Hewlett Packard, Intel, Oracle, or others.
Native central processing unit (202) includes one or more native registers (210), such as one or more general purpose registers and/or one or more special purpose registers used during processing within the environment. These registers include information that represents the state of the environment at any particular point in time.
Moreover, native central processing unit (202) executes instructions and code that are stored in memory (204). In one particular example, the central processing unit executes emulator code (212) stored in memory (204). This code enables the processing environment configured in one architecture to emulate another architecture. For instance, emulator code (212) allows machines based on architectures other than the Power ISA, such as zSeries servers, pSeries servers, HP Superdome servers or others, to emulate the Power ISA and to execute software and instructions developed based on the Power ISA. In a further example, emulator code (212) allows machines based on architectures other than the z/Architecture, such as PowerPC processors, pSeries servers, HP Superdome servers or others, to emulate the z/Architecture and to execute software and instructions developed based on the z/Architecture. Other architectures may also be emulated.
Further details relating to emulator code (212) are described with reference to FIG. 3. As shown, FIG. 3 is a block diagram (300) of a computing environment. Guest instructions (350) stored in memory (304) comprise software instructions (e.g., correlating to machine instructions) that were developed to be executed in an architecture other than that of a native CPU. For example, guest instructions (350) may have been designed to execute on a PowerPC processor or a z/Architecture processor, such as processor (102) of FIG. 1, but instead, are being emulated on a native CPU, such as native CPU (202). The native CPU may be, for example, an Intel Itanium II processor. In one example, emulator code (312) includes an instruction fetching routine (352) to obtain one or more guest instructions (350) from memory (304), and to optionally provide local buffering for the instructions obtained. It also includes an instruction translation routine (354) to determine the type of guest instruction that has been obtained and to translate the guest instruction into one or more corresponding native instructions (356). This translation includes, for instance, identifying the function to be performed by the guest instruction and choosing the native instruction(s) to perform that function.
Further, emulator code (312) includes an emulation control routine (360) to cause the native instructions to be executed. Emulation control routine (360) may cause a native CPU to execute a routine of native instructions that emulate one or more previously obtained guest instructions and, at the conclusion of such execution, return control to the instruction fetch routine to emulate the obtaining of the next guest instruction or a group of guest instructions.
Execution of the native instructions (356) may include loading data into a register from memory (304); storing data back to memory from a register; or performing some type of arithmetic or logic operation, as determined by the translation routine.
Each routine is, for instance, implemented in software, which is stored in memory and executed by a native central processing unit. In other examples, one or more of the routines or operations are implemented in firmware, hardware, software or some combination thereof. The registers of the emulated processor may be emulated using registers of the native CPU or by using locations in memory (304). The guest instructions (350), the native instructions (356), and the emulator code (312) may reside in the same memory or may be disbursed among different memory devices.
As used herein, firmware includes, e.g., the microcode, millicode and/or macrocode of the processor. It includes, for instance, the hardware-level instructions and/or data structures used in implementation of higher level machine code. The firmware may include, for example, proprietary code that is typically delivered as microcode that includes trusted software or microcode specific to the underlying hardware and controls operating system access to the system hardware.
In one example, a guest instruction (350) that is obtained, translated and executed is an instruction described herein. The instruction, which is of one architecture (e.g., the Power ISA or z/Architecture) is fetched from memory, translated and represented as a sequence of native instructions (356) of another architecture (e.g., the z/Architecture, Power ISA, Intel architecture, etc.). These native instructions are then executed.
In existing art, load doubleword indexed (ldx) instructions are not used to load object pointers, sometimes also referred to as “pointers”. Instead, a load doubleword monitored indexed instruction (ldmx) is implemented. That is, whenever object pointers are to be loaded, the ldmx instruction is used, but in all other cases when loading doublewords, the traditional ldx instruction may be used. The load doubleword monitored indexed (ldmx) instruction has the same format as the load doubleword indexed (ldx) instruction, except the opcode is different as explained below.
An example of a load doubleword monitored indexed instruction is described with reference to FIG. 4A. The load doubleword monitored indexed (ldmx) instruction (400) includes operation code (opcode) fields (402a) (e.g., bits 0-5), (402b) (e.g., bits 21-30) indicating a load pointer operation; a result field (RT) (404) (e.g., bits 6-10) used to indicate a register to store a result of the load operation (i.e. the pointer); a register field (RA) (406) (e.g., bits 11-15) used to specify a register to be used by the load operation; and a second register (RB) (408) (e.g., bits 16-20) used to specify a second register to be used by the load operation. In a non-limiting embodiment, bit 31 may be reserved and therefore may not be used by the instruction.
In operation of the ldmx instruction, a check is made as to whether the data to be loaded (e.g., the object pointer) points to an object located in a selected portion of memory, referred to herein as a load monitored region. If the data to be loaded does not point to an object located in the selected portion of memory, then a conventional load is performed. For instance, in one example, the load is performed as if a load doubleword indexed instruction (e.g., in the Power ISA) is being executed.
One example of pseudo-code for the ldmx instruction is as follows:
If RA=0, then b←0
else, b←(RA)
EA←b+(RB)
loaded_ea←MEM(EA, 8)
if, (loaded_ea is in enabled section of load-monitored region) & (BESCRGE LME=0b11)
initiate garbage collection EBB
Else
RT←loaded_ea,
In the above pseudo-code, “loaded_ea” is the object pointer; “EA” is an address of the object pointer; “BESCR” refers to branch event status-control register; “GE” refers to general enable; and “LME” refers to load monitored enabled. As shown in the pseudo-code, the effective address (EA) of the pointer to be loaded is the sum (RA|0)+(RB). If the pointer to be loaded points to an enabled section of the load monitored region and EBBs are enabled in the BESCR fields GE and LME, then a lightweight interrupt, referred to as an “Event-Based Branch (EBB), occurs; otherwise, otherwise, the pointer is loaded into the destination register, RT. It should be noted that lightweight interrupts such as EBBs transfer control directly to an application-level EBB handler, thereby eliminating the involvement of the operating system as occurs in “normal” interrupts. This advantageously eliminates a significant amount of overhead necessary whenever control is transferred to an operating system. Although, in the examples herein, the instruction format is for the Power ISA, similar formats may be used for other architectures.
Alternatively, the load doubleword monitored (ldm) instruction may be used instead of ldmx. The ldm instruction behaves like ldmx except that the EA accessed would be calculated like a load doubleword (ld) instruction using RA and DS fields instead of operands RA and RB as with ldx.
An example of a load doubleword monitored instruction is described with reference to FIG. 4B. The load doubleword monitored (ldm) instruction (420) includes operation code (opcode) fields (422) indicating a load pointer operation; a result field (RT) (424) used to indicate a register to store a result of the load operation (i.e. the pointer); a register field (RA) (426) used to specify a register to be used by the load operation; and an offset field (DS) used to specify a variable to be used by the load operation.
One example of pseudo-code for the ldm instruction is as follows:
If RA=0, then b←0
Else, b←(RA)
EA←b+EXTS(DS∥0b00)
loaded_ea←MEM(EA, 8)
if, (loaded_ea is in enabled section of load-monitored region) & (BESCRGE LME=0b11)
initiate garbage collection EBB,
Else, RT←loaded_ea
As shown in the pseudo-code, the effective address (EA) of the pointer to be loaded is the sum (RA|0)+EXTS(DS∥0b00). Other than calculating the EA as above, the operation of the ldm instruction is identical to the operation of the ldmx instruction described earlier. Although, in the examples herein, the instruction format is for the Power ISA, similar formats may be used for other architectures.
As explained previously, the selected portion of memory undergoing garbage collection (e.g., a memory block of user address space) is referred to herein as the load monitored region. Referring to FIG. 5, a block diagram (500) is shown illustrating memory, and specifically regions within the memory. As shown, memory (502) includes a load monitored region (504), as well as a plurality of objects, including ObjectA (506) and ObjectB (508). As shown, ObjectB (508) is in the shaded load monitored region (504), meaning that the object is in a portion of memory in which garbage collection is being performed. Therefore, the current pointer may need to be updated, if the object to which the pointer points has been moved due to, for instance, the garbage collection process.
Further, as used herein, an object area includes the load monitored region and the area of memory including objects that are not undergoing garbage collection. Additionally, the memory (502) may include a plurality of pointers shown as pointerA (510a), pointerB (510b), and pointerC (510c).
In this figure, it is further shown that an application program (520) executes an ldmx instruction (522), which attempts to load pointerB (510b). PointerB (510b) points to ObjectB (508) in the load monitored region, and thus, an EBB is performed giving control to the EBB handler (524) (also known as the update pointer handler, or handler). The handler (524) calculates a pointer address for PointerB (510b), i.e., the address at which PointerB (510b) is located, by reading the image of the load monitored instruction to determine the source registers, reading the source registers, and calculating the pointer address using data read from the source registers. The handler (524) then reads the pointer using a “normal” load instruction, modifies the pointer, if necessary, and if modified stores the pointer in the location from which it was obtained (526). Processing then returns to the application at the ldmx instruction, which is re-executed. Details of the pointer address calculation are shown in the pseudo code described above. These calculations, required in existing art, are time consuming, and embodiments advantageously eliminate the need for them as further described below.
Alternatively, the handler may modify the pointer, and store the modified pointer in the target register of the instruction. Processing would then continue at the instruction after the ldmx instruction. This would have the effect of emulating the load of the pointer without the need to re-execute the ldmx instruction. In one or more aspects, the application is unaware of the EBB processing, and simply receives the pointer, as if the EBB never occurred.
As indicated above, lightweight interrupt processing is performed when the data to be loaded (e.g., the object pointer) points to an object that is in the load monitored region of memory. The load monitored region may be identified in alternative ways. For instance, in one implementation, its size and base address are stored in a register, such as depicted in FIG. 6. As shown, a load monitored region register (LMRR) (600) includes, for instance, a base address field (602) including a load monitored region base address, a reserved field (603) that is not used here but is reserved for use in future enhancements, and a size field (604) indicating a size of the region. The size field (604) ranges, for example, from bits 60 to 63.
In one example, the load monitored region base address includes the high-order bits of the load monitored region. It may be assumed that the load monitored region is aligned on a granularity of its size. The size field is encoded such that each value corresponds to a specified size. For example, if 16 possible sizes are needed, the size field has 4 bits. Typical sizes are in the order of 10's of MBs (megabytes) to over a GB (gigabyte). The number of bits in the load monitored region base address field can be derived from the minimum size supported.
For example, if the minimum size supported is 16 MB, then the load monitored region base address field is 40 bits, which is sufficient to identify any 16 MB memory region aligned on a 16 MB address boundary. When the size field indicates smaller sizes, then more bits are required to specify the base address.
In other examples, the size and base address may be specified in a memory location, or as part of another register used for another purpose, etc. Additionally, other formats may be used to specify the address range of the load monitored region.
The load monitored region may be subdivided into segments of equal size, where each segment is 1/Nth of the total load monitored region size. A Load Monitored Segment Enable Register (LMSER) may also be provided where each bit corresponds to a segment. For example, a 64-bit register could be used to subdivide a load monitored region into 64 segments, where each segment is 1/64th of the total load monitored region.
The LMRR 600 may indicate a base address and size of a garbage collection (GC) region. The regions include a single block of storage aligned on a multiple of its size. For example, region sizes may increase in size by a factor of 2, e.g., 32 MB, 64 MB, 128 MB, 256 MB, 512 MB, 1 GB, 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, 64 GB, 128 GB, 256 GB, 512 GB, 1 TB, etc. The base address field (602) ranges from bit 0 to bit 38, for example, where bit 0 is the most-significant bit. Accordingly, the execution of the ldmx instruction assumes that all regions are aligned on multiples of their size. In an example including a region size of 1 TB, the ldmx instruction uses bits 0 to 23 in identifying the load monitored region, while ignoring bits 24 to 38 of the base address field. In another non-limiting embodiment including a region size of 32 MB, the ldmx instruction uses every bit of the base address field, i.e., bits 0 to 38, in identifying the load monitored region.
Now with reference to FIG. 7, a flowchart (700) is provided illustrating an example as to how the LMRR and LMSER are configured. First, the load monitored region (LMR) is specified in the LMRR (702). Details of such specification have been described above, with reference to FIG. 6. Then a binary value is assigned to each section in the LMSER (704), where a first binary value corresponds to an enabled section (i.e., a section of the load monitored region that is identified for garbage collection), and a second binary value corresponds to a disabled section (i.e., a section that is not subject to garbage collection).
Referring now to FIG. 8A, a flowchart (800) illustrates an example of logic associated with executing the ldmx instruction. The hardware of a processor executes an application that issues the ldmx instruction, and the processor hardware decodes the ldmx instruction (802). During execution of the instruction, the processor hardware determines the memory location addressed by the instruction, and compares the data at that address (i.e., the pointer) read with the load monitored region register (or other register or memory location) that specifies the selected portion of memory undergoing the garbage collection (804). If the pointer that was read points to a location within the load monitored region, then the hardware causes a lightweight interrupt (e.g., an Event Based Branch that does not involve the supervisor) that diverts execution to the garbage collection handler at operation 806.
Turning to operation 808 (see FIG. 8B), the garbage collector EBB reads the instruction image, and at operation 810 the garbage collector EBB handler reads the ldm instruction image to determine the source register (see FIG. 4B, element 426) and the offset value DS (see FIG. 4B, element 428). At operation 812, the garbage collector handler calculates the pointer EA from source register RA contents and offset field DS, and based on the calculations determines the pointer address at operation 814. The calculations performed to determine the pointer address represents a time consuming process that existing art requires but which embodiments eliminate by storing the pointer address in a register that is shared with a performance monitor as further explained in greater detail below.
Still referring to FIG. 8B, at operation 816 the garbage collection handler reads the pointer from the address that was determined as explained above (e.g., operation 814). At operation 818, the garbage collection handler moves the object to a location outside of the load monitored region, and updates the pointer to point to the object. At operation 820, the EA is loaded with the updated pointer, and the garbage collection handler returns control to the application at the ldmx instruction at operation 822. When the application re-executes the ldmx instruction, since the pointer now points outside the load monitored region as explained above, the ldmx loads the pointer without interruption.
Returning to operation (804), if the pointer that was read does not point to a location within the load monitored region, then the processor hardware does not cause the Event Based Branch, but instead executes the ldmx instruction without causing the EBB at operation (824). For instance, the ldmx instruction is processed as if the load doubleword indexed instruction was executed, as described above. In particular, in one example, the pointer is read from the location identified by the instruction and it is stored in the target register. Thereafter, processing continues to the next instruction at operation (826).
As described herein, garbage collection is optimized by allowing applications to continue processing (without being paused due to garbage collection) when those applications are not accessing objects in an area of memory undergoing garbage collection. Further, garbage collection is optimized by allowing applications accessing objects in an area of memory undergoing garbage collection to immediately resume processing after a very brief delay during the time the lightweight interrupt handler processes the pointer. This is enabled by determining during the load of the pointer that the object is in the selected portion of memory undergoing garbage collection, and based thereon, causing an EBB to occur such that the handler may take immediate action and quickly return control to the application.
Additionally, one or more aspects may be used for other than garbage collection. For example, since one or more aspects described herein may be used to detect when a pointer to a specified storage address range is loaded, it may be used to provide an advance warning about imminent access into a restricted memory space. In this case, a memory region is initialized to be the restricted memory region. Subsequently, when a pointer is read that points to a restricted area, an EBB occurs.
For example, a handler may take action based on a specific condition as described with reference to FIG. 9. In one example, a load instruction is decoded, (900). The load instruction may be one of various load instructions, including the ldm or ldmx instruction, as examples. The load instruction is decoded and based on the decoding, the object pointer is determined. A determination is made as to whether the object pointer indicates an object in a specified memory area, (902). This memory area is, for instance, a specified storage address range that is to be restricted for one reason or the other. If the pointer does not indicate an object in the specified memory area, then the ldmx (or other instruction) is executed as conventional, (904). Processing then continues at the next instruction, (906).
However, returning to (902), if the pointer does indicate an object in a specified memory area, then control is obtained by a handler, (908). For instance, the processor hardware performs an interrupt (e.g., a lightweight interrupt that does not involve the operating system) to the handler (e.g., an application-level handler). The handler may then take one or more actions, (910). For example, the handler may provide an alert, optionally prevent access to the specified memory area, and then continue processing at the next instruction, (912). As a further example, the handler may obtain the pointer address (e.g., calculates it from the instruction), read the pointer, modify the pointer, store the modified pointer back in the location from which it was read, and return control to the instruction and re-executes the instruction, such that the specified memory area is not accessed, (914). Other possibilities also exist.
As described above, processing may be diverted to a real-time garbage collection handler in response to an EBB if the pointer to be loaded points to an enabled section of the load monitored region. If the pointer is to be modified, the handler needs to determine the address of the pointer in order to modify it. Since existing art does not provide the handler with this address, the handler needs to determine it by 1) reading the ldmx instruction image to determine the source registers, 2) reading the source registers, and 3) calculating the pointer address using source registers RA and RB. It then needs to read the pointer, modify it, and store it back to the same location. These steps are time consuming and represent a significant overhead. In order to eliminate the majority of this overhead, embodiments advantageously shares a register with a performance monitor, referred to as the Sampled Data Address Register (SDAR) as described below. When the SDAR is shared as described, if the pointer to be loaded points to an enabled section of the load monitored region, then the pointer address is stored in the SDAR before the EBB occurs. This enables the EBB handler to obtain the pointer address directly from the SDAR instead of being required to calculate the address as outlined above.
According to at least one non-limiting embodiment of the invention, however, a sampled data address register (SDAR) is utilized so as to eliminate the need for the EBB handler to read the instruction image, calculate the pointer address, and read the pointer. It does this by storing the pointer address in the SDAR, which is a register otherwise used by a performance monitor. The SDAR is used to avoid the need to provide a dedicated register to provide the pointer address (i.e., the address at which a pointer attempting to access which caused the garbage collector EBB). In this manner, significant additional costs and design complexities associated with garbage collector hardware may be avoided.
More particularly, the SDAR is utilized by a Performance Monitoring (PM) mechanism which provides detailed information concerning the utilization of the processor instruction execution and memory management operations. The Performance Monitor includes an implementation dependent number of n-bit counters (e.g., 32-bit counters) for counting processor and memory management related events. The number of performance monitor counters may vary, but is typically between two and eight 32 bit counters (PMC0, PMC1, . . . PMC7). The Performance Monitor counters are controlled by two monitor mode control registers (MMCRO, MMCR1) that establish the function of the counters. The performance monitor counters and the monitor mode control registers are addressable using register read and write instructions. The monitor mode control registers are partitioned into bit fields that allow for selection of events to be recorded or counted. Selection of allowable combination of events causes the counters to operate concurrently. The monitor mode control registers may include bit fields for enabling the counters, controlling interrupts, selecting the event to be counted, and for freezing the counters at their current values. The number of events that can be selected for counting is implementation dependent. Other registers that may be used to support the performance monitor are the sampled instruction address register (SIAR) and the sampled instruction event register (SIER). The SIAR stores the effective address of an instruction being sampled while the SIER provides additional information about the instruction that was sampled when a performance monitor interrupt occurs. The SDAR, when not being used by the garbage collector as described herein, stores the effective address of the operand of the instruction whose effective address is stored in the STAR. In at least one embodiment of the invention, however, the SDAR is shared with the garbage collector event-based branch mechanism to facilitate multi-section garbage collection as discussed in greater detail below.
Referring now to FIG. 10, a computing environment 1000 including a performance monitor 1002 and a shared Sampled Data Address Register (SDAR) 1004 is illustrated according to a non-limiting embodiment. The SDAR (1004) is an n-bit register such as, for example, a 64-bit register that saves the data address of which a sampled load and store instruction references. The SDAR (1004) is configured to operate according to one or more modes that control its updating. According to a non-limiting embodiment of the invention, the SDAR (1004) operates according to an additional mode such that it is updated with the address of the data accessed by ldmx instructions. In this mode, the SDAR (1004) is updated as described below regardless of sampling mode. This added mode will be discussed in greater detail below.
Referring to FIG. 11, a flow diagram illustrates a method of performing a multi-section garbage collection using a shared performance monitor register according to a non-limiting embodiment. The method begins at operation 1100, and at operation 1102 a new instruction is received. At operation 1104, a determination is made as to whether the new instruction is one of a load instruction, a store instruction, or an ldmx instruction. When the received instruction is not a load instruction, a store instruction, or an ldmx instruction, the method returns to operation 1102, and receives a new instruction.
In the event the received instruction is one of a load instruction, a store instruction, or an ldmx instruction at operation 1104, a process is performed to determine whether the SDAR should be updated at operation 1106. In at least one embodiment, the SDAR is updated for memory access instruction when Performance Monitoring sampling mode is active and the load/store instruction was sampled, or for an ldmx instruction when the ldmx instruction loads a pointer to an enabled section of the load monitored region included in the memory.
When the above process indicates that the SDAR should be updated because of an ldmx instruction that accessed a pointer to an enabled section of the load monitored region, then the SIER_SDAR_VALID bit is set to “0”, and the SDAR_BUSY bit is set to “1” at operation 1110. In this manner, the system is notified that the SDAR contains the address of the pointer accessed by the ldmx instruction. In addition, setting the SDAR_BUSY bit to “1” notifies the system that the shared SDAR is currently reserved to perform garbage collection. Accordingly, the system blocks any further updates to the SDAR while the SDAR_BUSY bit is “1”. At operation 1112, the garbage collection EBB is invoked, and the data address accessed according to the ldmx (e.g. the pointer address) is read from the SDAR at operation 1114. After obtaining the data address from the SDAR, the SDAR_BUSY bit is set to “0”, i.e., cleared, at operation 1116. At operation 1118, tasks associated with garbage collection are performed and the EBB is exited.
When, however, the SDAR is loaded in response to a Performance Monitoring sampling mode at operation 1108, the counter that is counting the sampled event is incremented at operation 1120. At operation 1122, a determination is made as to whether a counter overflow exists. If the counter does not overflow, then the method proceeds to operation 1124 and processing continues uninterrupted.
When, however, the counter overflows at operation 1122, determination as to whether the SDAR_BUSY bit is set to “0” is performed at operation 1126. If the SDAR_BUSY bit it is set to 0, the method proceeds to operation 1128 where then SDAR_Valid is set to 1 and the SDAR is written with the address of the instruction causing the event. Otherwise (i.e. if SDAR_BUSY is set to “1”), the SDAR is not updated and the method proceeds to operation 1130.
At operation 1130, a performance monitor interrupt occurs, causing the performance monitor interrupt handler to be invoked, and at operation 1132, the performance monitor interrupt handler determines the value of the SDAR_VALID bit. If it determines that SDAR_VALID bit is set to “0”, the Performance Monitor interrupt handler handles the interrupt without using the SDAR at operation 1134. When interrupt processing is complete, the interrupt handler is exited at operation 1136.
When, however, the SDAR_Valid bit is set to “1” at operation 1132, the interrupt handler loads the address of the load or store instruction from the SDAR at operation 1138. In this manner, the interrupt handler can use the SDAR during processing of the performance monitor interrupt at all times except for when the SDAR is in use by the garbage collection handler. When interrupt processing is complete, the interrupt handler is exited at operation 1136.
As described above, the SDAR may be shared to perform multi-section garbage collection processes by providing the performance monitor interrupt handler an indicator as to whether or not the SDAR is valid (i.e. being used to store an address needed for garbage collection). Since the SDAR is in use for garbage collection during the performance monitor interrupt handler only when an asynchronous performance monitor event occurs simultaneously with an EBB related to garbage collection, the SDAR will be valid during the performance monitor interrupt handler in almost all situations since such simultaneous events occur very rarely (typically <1% of the time) occur. This sharing of the SDAR, therefore, is advantageous since it always provides the pointer address to the garbage collection handler, thereby improving its performance, without requiring additional registers and the associated control circuitry. Accordingly, the system (e.g., operating speed, performance efficiency) is improved.
In at least one embodiment, the possibility of entering the Performance Monitor EBB handler when invalid SDAR data exists may be eliminated. In this case, data loaded into the SDAR in response to Performance Monitor events are never blocked as explained with reference to FIG. 12.
Turning to FIG. 12, a flow diagram illustrates a method of performing a multi-section garbage collection using a shared performance monitor register according to a non-limiting embodiment. The method begins at operation 1200, and at operation 1202, a new instruction is received. At operation 1204, a determination is made as to whether the received instruction is a load instruction, a store instruction, or an ldmx instruction. When it is not a load, store, or ldmx instruction, the method returns to operation 1202 and receives a new instruction. Otherwise, the method moves to operation 1206 and determines whether to update the SDAR. In at least one embodiment, the SDAR is updated for memory access instruction when Performance Monitoring sampling mode is active and the load/store instruction was sampled, or for an ldmx instruction when the ldmx instruction loads a pointer to an enabled section of the load monitored region included in the memory. When no updating is necessary, the method returns to operation 1202. Otherwise, the method proceeds to operation 1208 and the SIER_SDAR_VALID bit is set to “0.”
At operation 1210, a determination is made as to whether a Performance Monitoring sampling mode is invoked or whether an ldmx instruction has loaded a pointer from an enabled section of the load monitored region included in the memory. When the Performance Monitoring sampling mode is invoked, the method proceeds to operation 1212 and sets the SIER_SDAR_VALID bit to “1.” At operation 1214, processor loads the SDAR with load or store address data, and the PM counter is incremented at operation 1216. At operation 1218, the PM counter is analyzed. When no overflow exists, the method proceeds to operation 1220 and processing continues uninterrupted. When, however, the counter overflows, the Performance Monitor interrupt occurs at operation 1222. Accordingly, the interrupt handler handles the interrupt at operation 1224, and the method exits thereafter. In this manner, since the SDAR_VALID bit is always set to 1 when the performance monitor interrupt occurs, the handler shares the SDAR with the garbage collection process such that SDAR is always valid—even if a Performance Monitor interrupt occurs immediately after entry into the garbage collector EBB handler.
Referencing again operation 1210, if a pointer indicates that the load monitored region was loaded by an ldmx instruction, then the garbage collector EBB is invoked at operation 1226. At operation 1228, the garbage collector EBB determines whether SIER_SDAR_VALID bit is set to “0”. When the SIER_SDAR_VALID bit is set to “0”, the EBB handler reads the pointer address from the SDAR at operation 1230. When the garbage collection is completed, the handler is exited at operation 1234. Note that the SIER_SDAR_VALID bit was set to 0 (indicating the SDAR is valid) at operation 1208, and thus it will still be 0 at operation 1228 except in rare instances in which a sampled load or store instruction causes the SDAR to be updated after operation 1208 but before operation 1228.
When the SIER_SDAR_VALID bit is 1, however, the garbage collection EBB handler disregards the SDAR and determines the pointer address at operation 1232 by reading the ldmx instruction image to determine the source registers, reading the source registers, and calculating the address that was accessed by the ldmx instruction (i.e. the pointer address). When the garbage collection is completed, the handler is exited at operation 1234. In this manner, the SDAR is shared such that the SDAR always contains a valid address when the Performance Monitor occurs. In at least one embodiment, the SIER_SDAR_VALID is set to one in the above process only when an asynchronous performance monitor event occurs immediately after the garbage collection EBB occurs in box 1226 but before the SDAR is read at operation 1230. Since this represents a very short period of time, the SDAR is almost always valid upon entry into the garbage collection EBB handler such that the pointer address can almost always read directly from the SDAR.
As described above, various non-limiting embodiments provide a multi-section garbage collection system including a shared performance monitor register. Accordingly, a SDAR may be shared between Performance Monitor interrupt handler processes and garbage collection EBB processes such that the address of the object pointer may be directly provided to the garbage collection hardware. This feature eliminates the need for the garbage collector EBB process to execute a large number of instructions to determine the address corresponding to the ldmx image. In addition, by sharing the SDAR between the garbage collection EBB process and the Shared Monitor interrupt handler process, the logic, circuitry, and cost of the overall system is reduced. Further, at least one embodiment shares the SDAR such that Performance Monitor data is never lost—even if a Performance Monitor interrupt occurs immediately after entry into the garbage collector EBB handler but before the garbage collector EBB handler has time to read the SDAR.
In a similar manner described above with respect to FIG. 9, one or more aspects of the ldmx instruction used in conjunction with the SDAR as described above may be used for other than garbage collection. For example, since one or more aspects described herein may be used to detect when a pointer to a specified storage address range is loaded, it may be used to provide an advance warning about imminent access into a restricted memory space. In this case, a memory region is initialized to be the restricted memory region. Subsequently, when a pointer is read that points to a restricted area, an EBB occurs.
The handler may also perform additional operations as described above. For example, the handler may provide an alert, optionally prevent access to the specified memory area, and then continue processing at the next instruction. As a further example, the handler may obtain the pointer address (e.g., read it from the SDAR), read the pointer, modify the pointer, store the modified pointer back in the location from which it was read, and return control to the instruction and re-executes the instruction, such that the specified memory area is not accessed. Other possibilities also exist.
Referring now to FIG. 13, a computer system/server (1312) is shown in the form of a general-purpose computing device (1300). The components of computer system/server (1312) may include, but are not limited to, one or more processors or processing units (1316), a system memory (1328), and a bus (1318) that couples various system components, including system memory (1328) to processor (1316).
Bus (1318) represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include industry standard bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer system/server (1312) typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer system/server (1312), and it includes both volatile and non-volatile media, removable and non-removable media.
System memory (1328) can include computer system readable media in the form of volatile memory, such as random access memory (RAM) (1330) and/or cache memory (1332). Computer system/server (1312) may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, storage system (1334) can be provided for reading from and writing to a non-removable, non-volatile magnetic media (not shown and typically called a “hard drive”). Although not shown, a magnetic disk drive for reading from and writing to a removable, non-volatile magnetic disk (e.g., a “floppy disk”), and an optical disk drive for reading from or writing to a removable, non-volatile optical disk such as a CD-ROM, DVD-ROM or other optical media can be provided. In such instances, each can be connected to bus (1318) by one or more data media interfaces. As will be further depicted and described below, memory (1328) may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
Program/utility (1340), having a set (at least one) of program modules (1342), may be stored in memory (1328) by way of example, and not limitation, as well as an operating system, one or more application programs, other program modules, and program data. Each of the operating system, one or more application programs, other program modules, and program data or some combination thereof, may include an implementation of a networking environment. Program modules (1342) generally carry out the functions and/or methodologies of embodiments of the invention as described herein.
Computer system/server (1312) may also communicate with one or more external devices (1314) such as a keyboard, a pointing device, a display (1324), etc.; one or more devices that enable a user to interact with computer system/server (1312); and/or any devices (e.g., network card, modem, etc.) that enable computer system/server (1312) to communicate with one or more other computing devices. Such communication can occur via Input/Output (I/O) interfaces (1322). Still yet, computer system/server (1312) can communicate with one or more networks such as a local area network (LAN), a general wide area network (WAN), and/or a public network (e.g., the Internet) via network adapter (1320). As depicted, network adapter (1320) communicates with the other components of computer system/server (1312) via bus (1318). It should be understood that although not shown, other hardware and/or software components could be used in conjunction with computer system/server (1312). Examples, include, but are not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
Referring to FIG. 14, an illustrative cloud computing environment (1400) is depicted. As shown, cloud computing environment (1400) comprises one or more cloud computing nodes (1410) with which local computing devices used by cloud consumers, such as, for example, personal digital assistant (PDA) or cellular telephone (1454A), desktop computer (1454B), laptop computer (1454C), and/or automobile computer system (1454N) may communicate. Nodes (1410) may communicate with one another. They may be grouped (not shown) physically or virtually, in one or more networks, such as Private, Community, Public, or Hybrid clouds as described hereinabove, or a combination thereof. This allows cloud computing environment (1400) to offer infrastructure, platforms and/or software as services for which a cloud consumer does not need to maintain resources on a local computing device. It is understood that the types of computing devices (1454A)-(1454N) shown in FIG. 14 are intended to be illustrative only and that computing nodes (1410) and cloud computing environment (1400) can communicate with any type of computerized device over any type of network and/or network addressable connection (e.g., using a web browser).
Referring now to FIG. 15, a set of functional abstraction layers (1500) provided by cloud computing environment (1400) of FIG. 14 is shown. It should be understood in advance that the components, layers, and functions shown in FIG. 15 are intended to be illustrative only and embodiments of the invention are not limited thereto. As depicted, the following layers and corresponding functions are provided:
Hardware and software layer (1510) includes hardware and software components. Examples of hardware components include mainframes (1520); RISC (Reduced Instruction Set Computer) architecture based servers (1522); servers (1524); blade servers (1526); storage devices (1528); networks and networking components (1530). In some embodiments, software components include network application server software (1532) and database software (1534).
Virtualization layer (1540) provides an abstraction layer from which the following examples of virtual entities may be provided: virtual servers (1542); virtual storage (1544); virtual networks (1546), including virtual private networks; virtual applications and operating systems (1548); and virtual clients (1550).
In one example, management layer (1560) may provide the functions described below. Resource provisioning (1562) provides dynamic procurement of computing resources and other resources that are utilized to perform tasks within the cloud computing environment.
Metering and Pricing (1564) provide cost tracking as resources are utilized within the cloud computing environment, and billing or invoicing for consumption of these resources. In one example, these resources may comprise application software licenses. Security provides identity verification for cloud consumers and tasks, as well as protection for data and other resources.
User portal (1566) provides access to the cloud computing environment for consumers and system administrators. Service level management (1568) provides cloud computing resource allocation and management such that required service levels are met. Service Level Agreement (SLA) planning and fulfillment (1570) provide pre-arrangement for, and procurement of, cloud computing resources for which a future requirement is anticipated in accordance with an SLA.
Workloads layer (1580) provides examples of functionality for which the cloud computing environment may be utilized. Examples of workloads and functions which may be provided from this layer include: mapping and navigation (1582); software development and lifecycle management (1584); virtual classroom education delivery (1686); data analytics processing (1588); transaction processing (1590); and garbage collection processing of one or more aspects of the present invention (1592).
Various embodiments of the invention may be employed as a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device capable of retaining and storing instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting-data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.
As used herein, the term “module” refers to an application specific integrated circuit (ASIC), an electronic circuit, an electronic computer processor (shared, dedicated, or group) and memory that executes one or more software or firmware programs, a combinational logic circuit, and/or other suitable components that provide the described functionality. When implemented in software, a module can be embodied in memory as a non-transitory machine-readable storage medium readable by a processing circuit and storing instructions for execution by the processing circuit for performing a method.
The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

## Claims

1. A system, comprising:
memory including a load-monitored region register (LMRR) and a sampled data address register (SDAR); and
a hardware processor configured to exchange data with the memory, the hardware processor configured to perform a garbage collection process that reclaims unused objects of the memory and a performance monitoring process performed independent of the garbage collection process, the performance monitoring process providing information indicating a utilization of an instruction execution performed by the hardware processor,
wherein the SDAR is configured to store first data generated according to the garbage process and second data generated according to the performance monitoring process, and
wherein the first data in the SDAR is accessed during the garbage collection process when a SDAR control bit is set to a first bit, the second data in the SDAR is accessed during the performance monitoring process when the SDAR control bit is set to a second bit different from the first bit.

2. The system of claim 1, wherein the SDAR control bit, when set to the first bit, blocks the performance monitoring process from accessing the SDAR and, when set to the second bit, allows the performance monitoring to access the SDAR so as to control loading of the first data and the second data into the SDAR.

3. The system of claim 2, wherein the first data is an address in the LMRR at which a pointer was attempting to access pursuant to the garbage collection process, and the second data is a one of a load address or store address referenced in a most-recent sampling request pursuant to the performance monitoring process performed independently from the garbage collection process.

4. The system of claim 3, wherein the performance monitoring process is blocked from loading the second data into the SDAR when the SDAR control bit is set to the first bit, and loads the second data into the SDAR when the SDAR control bit is set to the second bit.

5. The system of claim 4, wherein the SDAR control bit is set to the second bit in response to the garbage collection process reading the first data from the SDAR.

6. The system of claim 3, wherein the hardware processor performs operations comprising:
enabling a load-monitored event-based branch configured to occur in response to
executing a first type of CPU instruction to load a pointer that points to a first location in the LMRR indicated by the address;
performing the garbage collection process in background without pausing executing in a runtime environment;
executing a CPU instruction of the first type to load a pointer that points to the first location in the LMRR; and
in response to triggering a load-monitored event-based branch, moving an object pointed to by the pointer with a handler from the first location in memory to a second location in memory.

7. A method of managing a memory unit, the method comprising:
designating a load-monitored region register (LMRR) and a sampled data address register (SDAR) in the memory unit;
sharing the SDAR between a garbage collection process that reclaims unused objects of the memory; and
performing a performance monitoring process independently from the garbage collection process, the performance monitoring process providing information indicating a utilization of an instruction execution performed by the hardware processor,
wherein the SDAR stores first data generated according to the garbage process and second data generated according to the performance monitoring process, and
wherein the first data in the SDAR is accessed during the garbage collection process when a SDAR control bit is set to a first bit, the second data in the SDAR is accessed during the performance monitoring process when the SDAR control bit is set to a second bit different from the first bit.

8. The method of claim 7, further comprising loading the first data and the second data into the SDAR based on the SDAR control bit, wherein the SDAR control bit, when set to the first bit, blocks the performance monitoring process from accessing the SDAR and, when set to the second bit, allows the performance monitoring to access the SDAR.

9. The method of claim 8, wherein the first data is an address of the LMRR at which a pointer was attempting to access pursuant to the garbage collection process, and the second data is a one of a load address or store address referenced in a most-recent sampling request pursuant to the performance monitoring process performed independently from the garbage collection process.

10. The method of claim 9, further comprising preventing loading of the second data into the SDAR when the SDAR control bit is set to the first bit.

11. The method of claim 10, further comprising setting the SDAR control bit to the second bit in response to the garbage collection process reading the first data from the SDAR.

12. The method of claim 9, further comprising:
enabling a load-monitored event-based branch configured to occur in response to
executing a first type of CPU instruction to load a pointer that points to a first location in the LMRR;
performing the garbage collection process in background without pausing executing in a runtime environment;
executing a CPU instruction of the first type to load a pointer that points to the first location in the LMRR indicated by the address; and
in response to triggering the load-monitored event-based branch, moving an object pointed to by the pointer with a handler from the first location in memory to a second location in memory.

13. A computer program product to manage a memory unit, the computer program product comprising a non-transitory computer readable storage medium having program instructions embodied therewith, the program instructions executable by an electronic computer processor to perform operations comprising:
designating a load-monitored region register (LMRR) and a sampled data address register (SDAR) in the memory unit;
sharing the SDAR between a garbage collection process that reclaims unused objects of the memory; and
executing a performance monitoring process independently from the garbage collection process, the performance monitoring process providing information indicating a utilization of an instruction execution performed by the hardware processor,
wherein the SDAR stores first data generated according to the garbage process and second data generated according to the performance monitoring process, and
wherein the first data in the SDAR is accessed during the garbage collection process when a SDAR control bit is set to a first bit, the second data in the SDAR is accessed during the performance monitoring process when the SDAR control bit is set to a second bit different from the first bit.

14. The method of claim 13, further comprising loading the first data and the second data into the SDAR based on an the SDAR control bit register, wherein the SDAR control bit, when set to the first bit, blocks the performance monitoring process from accessing the SDAR and, when set to the second bit, allows the performance monitoring to access the SDAR.

15. The method of claim 14, wherein the first data is an address of the LMRR at which a pointer was attempting to access pursuant to the garbage collection process, and the second data is a one of a load address or store address referenced in a most-recent sampling request pursuant to the performance monitoring process performed independently from the garbage collection process.

16. The method of claim 15, further comprising preventing loading of the second data into the SDAR when the SDAR control bit register is set to the first bit.

17. The method of claim 16, further comprising setting the SDAR control bit to the second bit in response to the garbage collection process reading the first data from the SDAR.

18. The method of claim 15, further comprising:
enabling a load-monitored event-based branch configured to occur in response to
executing a first type of CPU instruction to load a pointer that points to a first location in the LMRR;
performing the garbage collection process in background without pausing executing in a runtime environment;
executing a CPU instruction of the first type to load a pointer that points to the first location in the LMRR indicated by the address; and
in response to triggering the load-monitored event-based branch, moving an object pointed to by the pointer with a handler from the first location in memory to a second location in memory.