Method and system for identifying subclasses of unknown objects

By employing a NOP test to determine the subclass of an unknown object in a computing environment with multiple subclasses, the method optimizes processor performance and reduces memory usage, addressing inefficiencies in subclass identification.

JP2025533639APending Publication Date: 2025-10-07INTERNATIONAL BUSINESS MACHINE CORPORATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2025519053
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-10-04
Filing Date
2023-05-09
Publication Date
2025-10-07

AI Technical Summary

Technical Problem

Existing computing systems face inefficiencies in determining the subclass of an unknown object when there are multiple subclasses associated with a class, leading to unnecessary comparison tests that occupy memory and processing resources.

Method used

Implementing a method and system that utilize a no-operation (NOP) test to prevent redundant comparison tests by determining if additional subclasses exist, allowing the system to efficiently identify the subclass of an unknown object when there are two known subclasses.

Benefits of technology

This approach reduces memory usage and processing time by avoiding multiple comparison tests, optimizing processor performance and reducing the overall size of the instruction set, thereby improving computing device efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025533639000001_ABST
    Figure 2025533639000001_ABST
Patent Text Reader

Abstract

A method and system for identifying subclasses of unknown objects is provided. A first comparison test determines whether the unknown object is of a first subclass of a class of the object. In response to determining that the unknown object is not of the first subclass, a determination is made as to whether the unknown object is an instance of a second subclass by determining whether additional subclasses exist other than the first and second subclasses. In response to determining that additional subclasses exist, a second code fragment is executed while avoiding assuming that the unknown object is of a specific subclass.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to identifying subclasses of unknown objects in a set of program instructions, and more particularly to identifying unknown objects when there are two or more subclasses associated with an identified class of object, which identification prevents a second comparison test from being performed. Summary of the Invention

[0002] According to an embodiment of the present invention, a computer-implemented method is described in which a processor performs a first comparison test to determine whether the unknown object is an instance of a first subclass of a class of the object. In response to the processor determining that the unknown object is not an instance of the first subclass, the processor prevents a second comparison test by determining whether additional subclasses of the class of the object other than the first subclass and the second subclass exist, thereby determining whether the unknown object is an instance of a second subclass. In response to determining that no additional subclasses exist, the processor executes a second code fragment that assumes the unknown object is an instance of the second subclass.

[0003] This specification also describes a system that includes a processor and a memory device communicatively coupled to the processor. The memory device includes instructions executable by the processor, including instructions for performing a first comparison test to determine whether an unknown object is an instance of a first subclass of a class of objects. The memory device also includes instructions for, in response to determining that the unknown object is not an instance of the first subclass, performing a no operation (NOP) test to prevent a second comparison test by determining whether additional subclasses of the class of objects other than the first subclass and the second subclass exist. The memory device also includes instructions for, in response to determining that no additional subclasses exist, executing a second code fragment that assumes the unknown object is an instance of the second subclass.

[0004] This specification also describes a computer program product. The computer program product includes a computer-readable storage medium having program instructions embodied thereon. The program instructions are executable by a processor and cause the processor to perform a first comparison test to determine whether the unknown object is an instance of a first subclass of a class of objects. In response to determining that the unknown object is not an instance of the first subclass, the program instructions are executable by the processor to prevent a second comparison test by performing a no-operation (NOP) test to determine whether additional subclasses of the class of objects other than the first subclass and a second subclass exist. In response to determining that no additional subclasses exist, the program instructions are executable by the processor to execute a second code fragment that assumes the unknown object is an instance of a second subclass. [Brief explanation of the drawings]

[0005] [Figure 1] 1 illustrates a computing environment for performing subclass identification of unknown objects, according to an example of principles described herein.

[0006] [Figure 2] 1 illustrates a computer-implemented method for identifying subclasses of unknown objects according to an example of principles described herein.

[0007] [Figure 3] 1 illustrates a computer-implemented method for identifying subclasses of unknown objects according to an example of principles described herein.

[0008] [Figure 4] 1 illustrates a system for identifying subclasses of unknown objects according to an example of principles described herein.

[0009] [Figure 5] 1 illustrates a computer program product having a computer-readable storage medium for identifying subclasses of unknown objects, according to an example of principles described herein. DETAILED DESCRIPTION OF THE INVENTION

[0010] Various aspects of the present disclosure are described through text, flowcharts, block diagrams of computer systems, and / or block diagrams of machine logic included in embodiments of a computer program product (CPP). For any flowchart, depending on the relevant technology, operations may be performed in an order different from that shown in a given flowchart. For example, again depending on the relevant technology, two operations shown in successive flowchart blocks may be performed in the reverse order, as a single integrated step, simultaneously, or in an at least partially overlapping manner.

[0011] A computer program product embodiment ("CPP embodiment" or "CPP") is a term used in this disclosure to describe any set of one or more storage media (also referred to as "media"), collectively contained in one or more storage devices, that collectively contain machine-readable code corresponding to instructions and / or data for performing the computer operations specified in a given CPP claim. A "storage device" is any tangible device that can hold and store instructions for use by a computer processor. The computer-readable storage medium may be, but is not limited to, an electronic storage medium, a magnetic storage medium, an optical storage medium, an electromagnetic storage medium, a semiconductor storage medium, a mechanical storage medium, or any suitable combination of the foregoing. Some known types of storage devices that include these media include diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), compact disc read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, floppy disk, mechanically encoded device (such as pits / lands formed on a major surface of a punch card or disk), or any suitable combination of the foregoing. A computer-readable storage medium, as the term is used in this disclosure, is not to be construed as storage in the form of a transitory signal per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide, light pulses passing through fiber optic cables, electrical signals communicated through wires, and / or other transmission media. As will be appreciated by those skilled in the art, data is typically moved at some infrequent time during the normal operation of a storage device, such as during access, defragmentation, or garbage collection, but this does not make the storage device transient because the data is not transient while it is stored.

[0012] Computing devices, such as desktop computers, laptop computers, all-in-one devices, and the like, execute instruction sets to perform intended operations. That is, to perform the millions of operations it is capable of performing, a computing device is supplied with a set of instructions in a computing language that the hardware components of the computing device can understand and interpret to perform the intended operations. As a specific example, a word processing application may print a text document by executing a print instruction set. Before an instruction set is executed, it is constructed or compiled. Compiling an instruction set refers to the act of converting human-readable source code generated by a user into machine code that is executable by the processor of the computing device. During compilation, a file containing the instruction set is validated or "debugged." There are various forms in which instruction sets are compiled. For example, with static languages, files are compiled before runtime execution. By comparison, with dynamic languages, compilation is performed during runtime execution. One particularly relevant feature of dynamic languages ​​is that the "types" of variables that are components of the instruction set are not identified until runtime execution. That is, with static languages, the type or class of an object is identified before the instruction set is executed. In comparison, with dynamic languages, the class or subclass of an object is determined during runtime execution.

[0013] As one specific example, a Java Virtual Machine (JVM) is a language environment for executing the Java instruction set. Source code is stored in .class files that the JVM receives and executes. As explained above, when executing dynamic languages, the type of an object is determined at runtime, not via a pre-runtime compiler. Because classes may be loaded / subclassed at any time, there may be overhead associated with executing the dynamic language instruction set to test the class of an object. There are several ways in which the JVM may determine the type of a particular unknown object. As a first example, the JVM may execute an "instanceof" test that appears in the application (i.e., Java) source code. An example is provided below. if (x instance of A) { … code fragment C1 that assumes x is an instance of A } else { …code fragment C2 that does not assume any sub-class for x }

[0014] In another example, type tests may be added by a just-in-time (JIT) compiler to guard inlined or devirtualized code paths. An example is provided below. if (x.class == A) { … inlined code C3 for A.foo that assumes x is an instance of A } else { …virtual call x.foo }

[0015] In these examples, x is a variable in the program and X is the declared class type of variable x. A is the first non-abstract subclass of X that is loaded by the JVM when the program is executed, and B is the second non-abstract subclass of X that is loaded by the JVM when the program is executed. foo is a virtual method declared in class X and should therefore be valid to invoke a variable (e.g., x) declared as being of class type X (the runtime type can be X, A, or B). That is, a virtual call is a feature of object-oriented languages ​​that invokes an object without knowing the runtime type of the object.

[0016] Furthermore, in this example, C1 is a code fragment (either written into the program by the user or created by the JIT compiler due to optimizations such as inlining) that is executed if x is known to be of subclass type A in the original code. Similarly, C2 is a code fragment (either written into the program by the user or created by the JIT compiler due to optimizations such as inlining) that is executed if x is known to be of subclass type B in the original code. C3 is a code fragment that similarly assumes the subclass type of x. As a practical example, X may be of class "Vehicle," while A is a subclass "Car" and B is a subclass "Truck." In this example, foo may be a virtual method "Drive," which is valid to invoke the method "Drive" as long as x is of class type "Vehicle." Depending on whether the subclass of x, as determined by the runtime, is A, e.g., "Car," or B, e.g., "Truck," a different "Drive" method is invoked that implements the driving functionality of the "Car" variable or the "Truck" variable.

[0017] In either example, the JVM is executing a comparison test (e.g., an "instanceof" test or a type test added by a JIT compiler), which is a set of instructions to perform the comparison. For example, a type test added by a JIT compiler of "if x.class == B" would result in a comparison instruction followed by a conditional branch instruction.

[0018] A dynamic compiler has access to information that a static compiler would not have because the program has already been running for a while. That is, the dynamic compiler can know which classes have been loaded and called during execution, and can therefore adjust its optimizations accordingly. For example, a JIT compiler can choose which of A or B is the more frequently encountered class, and inline the more frequently executed method first and the less frequently executed method second.

[0019] Other benefits include knowing which code paths are executed more frequently and ordering those code paths so that they are adjacent (proximity) to one another. JIT compilers can also facilitate platform and hardware exploitation, which uses information about the platform and hardware components of a computing device to optimize code execution.

[0020] Due to the elimination of pre-runtime compilation, dynamic languages ​​and JIT compilers are provided for reduced development time. Further developments can be made to the above code sections to further improve the efficiency of the underlying code. For example, if there is a single concrete subclass A in the class hierarchy rooted at X, then the JIT compiler can optimize these type tests by performing no-operation (NOP) tests. By performing NOP tests, the JVM can explicitly skip performing comparison tests to determine the subclass of x. Instead, the JVM can rely on runtime assumptions registered with the JIT compiler to maintain functional correctness. In other words, as long as there is a single concrete subclass A loaded in the class hierarchy rooted at X, the comparison test can be avoided because there is only one possible subclass (e.g., A) of which x can be an instance. If a new subclass B in the class hierarchy rooted at X is loaded after the compiled code is generated, then the compiled code will be patched to maintain functional correctness, even though this comes at a performance cost. A corrected version of the example code is provided below along with the described patch. Referring to the first example, the patched code may be as follows: if (NOPed test that A is the only concrete sub-class in hierarchy rooted at X) { … code fragment C1 that assumes x is an instance of A } else { if (x instance A) } … code fragment C1 that assumes x is an instance of A } else { …code fragment C2 that does not assume any sub-class for x }

[0021] For the second example, the patched code may be as follows: if (NOPed test that A is the only concrete sub-class in hierarchy rooted at X) { … inlined code C3 for A.foo that assumes x is an instance of A } else { …virtual call x.foo }

[0022] However, it should be noted that in situations where one or more concrete subclasses (e.g., A and B) exist in the class hierarchy of X at the time the compiled code is generated, it may not be possible to implement a NOP test. Accordingly, this disclosure describes a method, system, and computer program for improving the efficiency of a JIT compiler when two concrete subclasses (e.g., A and B) exist in the class hierarchy rooted at X at the time the source code is generated. Generally, there is a sequence with a single comparison test and a single NOP test (in some instances, only the comparison test is performed) that optimizes both concrete subclasses A and B in the hierarchy rooted at X. This is more efficient than performing two explicit tests (one for each of A and B). That is, the NOP test can avoid generating a comparison test instruction. In yet another approach, performing a single comparison test and a single NOP test may improve the efficiency of compiled code generated by a JIT compiler. Instead, the JVM keeps track of source code locations where it places NOP instructions that are to be patched at runtime if some condition changes.

[0023] For example, if there is a single non-abstract subclass A of class X, the JVM may not need to test whether x.class is of type A, because that is the only possible option (since it is declared to be of type X, there are no other classes it could be). However, if a new subclass B is loaded in the future, the JVM will then patch (i.e., change) the code location where the NOP instruction was and turn it into an unconditional JUMP instruction instead. This JUMP instruction will branch to a fallback path where some conservative corrective code is executed to maintain functionality in that case, e.g., perform a virtual call.

[0024] However, if a NOP test is used and there are no changes in the future when a new subclass B is loaded, then it is more efficient to perform the NOP test than to perform a comparison test because it is a single instruction (or even no instructions). In this example, the NOP test used is preempted in the JIT compiler because there are other scenarios where a single code location is patched to a "complex" condition in the corresponding runtime assumption (e.g., A and B are the only concrete subclasses in the hierarchy rooted at X). All the compiler has to do is detect any future loads of classes that subclass X, A, or B in order to patch the code location at runtime.

[0025] Using this system, method, and computer program product, instruction sets guarded by test types can be better optimized by propagating more refined type information throughout more of the JIT-compiled code. As a specific example, if a code fragment has another call to a method using x (e.g., x.goo()), then those calls can be unconditionally inlined, assuming the system knows that the method will be called. For example, A.goo can be inlined without any testing (explicit or NOP) if it is known that x was known to be of type A.

[0026] The system, method, and computer program product improve the functionality of a computing device. For example, because the computing device does not need to perform two comparison tests (e.g., one to test whether x is of subclass A and the second to test whether x is of subclass B), the overall size of the instruction set is smaller, thus resulting in reduced storage space on the memory device. That is, a computing device has a finite amount of storage space, and instruction sets occupy storage space. By providing an instruction set that occupies fewer memory resources of the memory device, more space on the memory device is preserved for other instruction sets.

[0027] Also, because the instruction set is smaller due to replacing the second comparison test with a NOP test, processor performance is increased by 1) increasing processor bandwidth and 2) increasing processor throughput. That is, with fewer instructions to execute, the determination of the subclass type of an unknown variable is performed more quickly, so that other operations can be performed simultaneously.

[0028] Furthermore, as noted above, the NOP test is previously disabled when there is more than one subclass rooted at X. Accordingly, this specification describes a system that utilizes the NOP test in a novel manner, specifically to determine to which of two subclasses an unknown variable pertains.

[0029] As yet another example, the processor may automatically address and more efficiently resolve any potential problems in the instruction set: in particular, because the overall code length has been reduced, there are fewer bugs to fix and the processor may evaluate the instruction set more quickly.

[0030] Thus, the present method, system, and computer program product provide improvements to computing devices by: 1) utilizing a NOP test to determine previously unavailable subclass types when more than one compile-time generated subclass exists, and 2) saving memory and processing resources by avoiding multiple explicit comparison tests to determine whether an unknown object is one of two identified subclasses. Note that some embodiments may not have these potential advantages, and these potential advantages are not necessarily required for all embodiments.

[0031] As used in this specification and the appended claims, the term "multiple" or similar language is intended to be broadly understood as any positive number from 1 to infinity, inclusive.

[0032] Referring now to the figures, FIG. 1 illustrates a computing environment 100 for performing subclass identification of unknown objects according to an example of the principles described herein.

[0033] Computing environment 100 includes an example environment for execution of at least some of the computer code associated with performing the method of the invention, such as subclass identification code 200. In addition to block 200, computing environment 100 includes, for example, computer 101, wide area network (WAN) 102, end user device (EUD) 103, remote server 104, public cloud 105, and private cloud 106. In this embodiment, computer 101 includes a set of processors 110 (including processing circuitry 120 and cache 121), communication fabric 111, volatile memory 112, persistent storage 113 (including the above-identified operating system 122 and block 200), a set of peripheral devices 114 (including a set of user interface (UI) devices 123, storage 124, and a set of Internet of Things (IoT) sensors 125), and network module 115. Remote server 104 includes a remote database 130. The public cloud 105 includes a gateway 140, a cloud orchestration module 141, a set of host physical machines 142, a set of virtual machines 143, and a set of containers 144.

[0034] Computer 101 may take the form of a desktop computer, a laptop computer, a tablet computer, a smartphone, a smartwatch or other wearable computer, a mainframe computer, a quantum computer, or any other form of computer or mobile device now known or later developed that is capable of executing programs, accessing a network, or querying a database, such as remote database 130. As is well understood and consistent with the art of computer technology, execution of a computer-implemented method may be distributed among multiple computers and / or among multiple locations. While in this presentation of computing environment 100, to keep the presentation as simple as possible, the detailed discussion focuses on a single computer, specifically computer 101. Computer 101 may be located within a cloud, even though it is not depicted in the cloud of FIG. 1 . However, computer 101 is not required to be in a cloud except to any extent expressly indicated.

[0035] Processor set 110 includes one or more computer processors of any type now known or later developed. Processing circuitry 120 may be distributed across multiple packages, e.g., multiple tailored integrated circuit chips. Processing circuitry 120 may implement multiple processor threads and / or multiple processor cores. Cache 121 is memory located within the processor chip package and is typically used for data or code that should be available for fast access by threads or cores executing on processor set 110. Cache memory is typically organized into multiple levels depending on relative proximity to the processing circuitry. Alternatively, some or all of the cache for a processor set may be located “off-chip.” In some computing environments, processor set 110 may be designed for operation with qubits and for performing quantum computing.

[0036] Computer-readable program instructions are typically loaded into computer 101 to cause processor set 110 of computer 101 to perform a series of operational steps, thereby affecting a computer-implemented methodology, such that the instructions so executed instantiate the methods specified in the computer-implemented method flowcharts and / or descriptions contained in this document (collectively, the "methods of the present invention"). These computer-readable program instructions are stored on various types of computer-readable storage media, such as cache 121 and other storage media described below. The program instructions and associated data are accessed by processor set 110 to control and direct the execution of the methods of the present invention. In computing environment 100, at least some of the instructions for performing the methods of the present invention may be stored in persistent storage 113 in block 200.

[0037] Communications fabric 111 is the signal-conducting pathway that allows various components of computer 101 to communicate with one another. Typically, this fabric is made up of switches and conductive pathways, such as those that make up buses, bridges, physical input / output ports, and the like. Other types of signal communication pathways, such as fiber optic and / or wireless communication pathways, may also be used.

[0038] Volatile memory 112 may be any type of volatile memory now known or later developed. Examples include dynamic random access memory (RAM) or static RAM. Typically, volatile memory 112 is characterized by random access, although this is not required unless affirmatively indicated. In computer 101, volatile memory 112 is located in a single package and internal to computer 101, although alternatively or additionally, volatile memory may be distributed across multiple packages and / or located external to computer 101.

[0039] Persistent storage 113 is any form of non-volatile computer storage, now known or later developed. The non-volatility of this storage means that stored data remains regardless of whether power is supplied to computer 101 and / or to persistent storage 113 directly. Persistent storage 113 may be read-only memory (ROM), but typically is at least a portion of persistent storage that allows data to be written, data to be erased, and data to be rewritten. Some well-known forms of persistent storage include magnetic disks and solid-state storage devices. Operating system 122 can take several forms, such as various known proprietary operating systems employing a kernel or open-source Portable Operating System Interface-style operating systems. The code contained in block 200 typically includes at least some of the computer code involved in performing the methods of the present invention.

[0040] Peripheral device set 114 includes a set of peripheral devices of computer 101. Data communication connections between peripheral devices and other components of computer 101 may be implemented in various ways, such as Bluetooth connections, near field communication (NFC) connections, connections made by cable (such as a universal serial bus (USB)-type cable), insertable connections (e.g., Secure Digital (SD) cards), connections made by local area communication networks, and even connections made by wide area networks such as the Internet. In various embodiments, UI device set 123 may include components such as display screens, speakers, microphones, wearable devices (such as goggles and smartwatches), keyboards, mice, printers, touchpads, game controllers, and haptic devices. Storage 124 may be external storage, such as an external hard drive, or insertable storage, such as an SD card. Storage 124 may be persistent and / or volatile. In some embodiments, storage 124 may take the form of a quantum computing storage device for storing data in the form of qubits. In embodiments where computer 101 is required to have a large amount of storage (e.g., computer 101 stores and manages a large database locally), this storage may be provided by a peripheral storage device designed to store very large amounts of data, such as a storage area network (SAN) shared by multiple geographically distributed computers. IoT sensor set 125 consists of sensors that can be used in Internet of Things applications. For example, one sensor may be a thermometer and another sensor may be a motion detector.

[0041] Network module 115 is a collection of computer software, hardware, and firmware that enables computer 101 to communicate with other computers over WAN 102. Network module 115 may include hardware such as a modem or Wi-Fi® signal transceiver, software for packetizing and / or depacketizing data for communication network transmission, and / or web browser software for communicating data over the Internet. In some embodiments, the network control and network forwarding functions of network module 115 are performed on the same physical hardware device. In other embodiments (e.g., embodiments utilizing Software-Defined Networking (SDN)), the control and forwarding functions of network module 115 are performed on physically separate devices, such that the control function manages several different network hardware devices. Computer-readable program instructions for implementing the methods of the present invention may be downloaded to computer 101, typically from an external computer or external storage device, through a network adapter card or network interface included in network module 115.

[0042] The WAN 102 is any wide area network (e.g., the Internet) capable of communicating computer data over non-local distances by any technology for communicating computer data, now known or later developed. In some embodiments, the WAN 102 may be replaced and / or supplemented by a local area network (LAN) designed to communicate data between devices located in a local area, such as a Wi-Fi network. WANs and / or LANs typically include copper transmission cables, optical fiber transmissions, wireless transmissions, and computer hardware such as routers, firewalls, switches, gateway computers, and edge servers.

[0043] End-user device (EUD) 103 is any computer system used and controlled by an end user (e.g., a customer of the enterprise operating computer 101) and may take any of the forms described above with respect to computer 101. EUD 103 typically receives useful and useful data from the operation of computer 101. For example, in a hypothetical case where computer 101 is designed to provide recommendations to the end user, the recommendations would typically be communicated from computer 101's network module 115 over WAN 102 to EUD 103. In this manner, EUD 103 can display or otherwise present the recommendations to the end user. In some embodiments, EUD 103 may be a client device, such as a thin client, a heavy client, a mainframe computer, or a desktop computer.

[0044] Remote server 104 is any computer system that services at least some data and / or functionality to computer 101. Remote server 104 may be controlled and used by the same entity that operates computer 101. Remote server 104 represents a machine that collects and stores useful and useful data for use by other computers, such as computer 101. For example, in the hypothetical case where computer 101 is designed and programmed to provide recommendations based on historical data, then this historical data may be provided to computer 101 from remote database 130 of remote server 104.

[0045] A public cloud 105 is any computer system available for use by multiple entities that provides on-demand availability of computer system resources and / or other computer capabilities, particularly data storage (cloud storage) and computing power, without direct, active management by users. Cloud computing typically leverages resource sharing to achieve coherence and economies of scale. Direct, active management of the computing resources of the public cloud 105 is performed by computer hardware and / or software in a cloud orchestration module 141. The computing resources provided by the public cloud 105 are typically implemented by virtual computing environments running on various computers comprising a host physical machine set 142, which is the universe of physical computers within and / or available in the public cloud 105. A virtual computing environment (VCE) typically takes the form of a virtual machine from a virtual machine set 143 and / or a container from a container set 144. It is understood that these VCEs are stored as images and can be transferred among and between various physical machine hosts either as images or after instantiation of the VCE. The cloud orchestration module 141 manages the transfer and storage of images, deploys new instantiations of the VCE, and manages active instantiations of VCE deployments. The gateway 140 is a collection of computer software, hardware, and firmware that enables the public cloud 105 to communicate over the WAN 102.

[0046] Some further description of virtualized computing environments (VCEs) is provided here. A VCE can be stored as an "image." A new, active instance of a VCE can be instantiated from the image. Two well-known types of VCEs are virtual machines and containers. A container is a VCE that uses operating system-level virtualization. This refers to a feature of an operating system in which the kernel allows the existence of multiple isolated user space instances, called containers. These isolated user space instances typically behave as real computers from the perspective of programs running within them. A computer program running on a typical operating system can utilize all of the computer's resources, such as connected devices, files and folders, network shares, CPU power, and quantifiable hardware capabilities. However, a program running inside a container can only use the contents of the container and the devices assigned to the container, a feature known as containerization.

[0047] A private cloud 106 is similar to a public cloud 105, except that computing resources are available only for use by a single enterprise. While the private cloud 106 is shown in communication with the WAN 102, in other embodiments, the private cloud may be entirely disconnected from the Internet and accessible only through a local / private network. A hybrid cloud is a composite of multiple clouds of different types (e.g., private, community, or public cloud types), often each implemented by a different vendor. While each of the multiple clouds remains a separate, discrete entity, the larger hybrid cloud architecture is bound together by standardized or proprietary technologies that enable orchestration, management, and / or data / application portability between the constituent clouds. In this embodiment, both the public cloud 105 and the private cloud 106 are part of a larger hybrid cloud.

[0048] 2 illustrates a computer-implemented method 201 for identifying subclasses of an unknown object, according to an example of the principles described herein. As noted above, this specification describes a computer-implemented method 201 that can be used when there are at least two concrete subclasses of a class, and that 1) prevents the execution of two comparison tests to determine the subclass of the unknown object, and 2) facilitates the use of a NOP test to determine which of the two subclasses the unknown object relates to (a novel feature). That is, the NOP test is pre-disabled when there are two possible subclasses of the unknown object. Note that the operations illustrated in computer-implemented method 201 may be performed by processing circuitry 120 illustrated in FIG. 1 or the processor illustrated in FIG. 4.

[0049] According to the computer-implemented method 201, the processing circuit 120 and / or the processor may (block 202) perform a first comparison test to determine whether an unknown object, x, is an instance of a first subclass, A, of a class of objects, X. Such a comparison test is an explicit test that compares the unknown object, x, and its characteristics against the characteristics of the first subclass, A. If the first subclass, A, and the unknown object, x, have the same characteristics and properties, or a threshold amount of the same characteristics and properties, the processor may determine that the unknown object is of the first subclass type. There are various types of explicit comparison tests that can be performed to make such a determination. In one example, the processor determines that the unknown object is an instance of the first subclass by performing an "instanceof" test, which tests whether the unknown object is a first subclass instance. In another example, the processor determines that the unknown object is an instance of the first subclass by performing a type test added by the JIT manager. For example, the processor may evaluate "if (x.class == A)." Based on the result of the first comparison test, the processor may perform various actions.

[0050] For example, in response to determining that the unknown object is an instance of the first subclass, the processor may execute a first code fragment that assumes that the unknown object is an instance of the first subclass. In the above example, C1 refers to a code fragment that is executed if the unknown object is known to be of the first subclass type in the original code. In this example, because the subclass type of the unknown object has been determined, the second comparison test is not performed.

[0051] However, because there are two subclasses (e.g., subclass A and subclass B) to which the unknown object may relate, it may be the case that the unknown object is not an instance of the first subclass. In this example, in response to determining that the unknown object is not an instance of the first subclass, the processor may (block 204) prevent a second comparison test to determine the subclass of the unknown object. That is, without the method described herein, the processor may perform a second comparison test (i.e., a second instanceof test or a second “if (x.class == B)” test) to determine whether the unknown object relates to the second subclass. Such a second comparison test occupies space on a memory device and is computationally expensive to perform compared to a case in which such a test is not performed. Accordingly, the computer-implemented method 201 specifically prevents the performance of the second comparison test by determining (block 204) whether additional subclasses exist other than the first subclass and the second subclass. That is, based on the first comparison test, the processor evaluates whether the unknown object is of the first subclass. If the processor determines that the unknown object is of the first subclass, the processor has successfully identified the subclass of the unknown object. If the processor determines that the unknown object is not of the first subclass, the processor then determines whether only two concrete subclasses exist. If only two concrete subclasses exist in the original code and the unknown object is not of the first subclass, the processor may identify the unknown object as being of the second subclass.

[0052] Thus, in response to determining that no additional subclasses exist other than the first subclass and the second subclass, the processor may (block 206) execute a second code fragment that assumes the unknown object is an instance of the second subclass. In the above example, C2 refers to the code fragment that would be executed if the unknown object was known to be of the second subclass type in the original code. In this example, the second comparison test is not performed because it was initially determined that the subclass type of the unknown object was not subclass A, and the processor determined that A and B were subclasses without performing the second comparison test.

[0053] If the processor determines that additional subclasses exist above the first and second subclasses, the processor may execute a second code fragment or another code fragment that avoids assuming that the unknown object is an instance of any specific subclass. For example, the processor may execute a code fragment that is executed when the subclass type of the unknown object is unknown. For example, during source code generation, it may be the case that there are three subclasses A, B, and C. In this example, once it is determined that the unknown object is not an instance of subclass A and that there is an additional subclass (e.g., subclass C) in addition to subclasses A and B, the processor may execute some other code fragment that does not assume the subclass of the unknown object.

[0054] Exemplary pseudocode illustrating the prevention of the second comparison test and relying on a NOP test to determine whether an unknown object x pertains to subclasses A and B is provided below. In the first example: if (x instanceof A) { … code fragment C1 that assumes x is an instance of A } else { if (NOPed test that A and B are the only concrete sub-class in hierarchy rooted at X) { … code fragment C2 that assumes x is an instance of B } else { …code fragment C2 that does not assume any sub-class for x }

[0055] In the case of the second example: if (x.class == A) { … inlined code C3 for A.foo that assumes x is an instance of A } else { if (NOPed test that A and B are the only concrete sub-class in hierarchy rooted at X) { direct call B.foo } else {<l …virtual call x.foo }

[0056] In the exemplary code presented above, determining (block 204) whether additional subclasses of the object's class exist in addition to the first and second subclasses is performed by performing a NOP test, which does not consume memory space and is more efficient to use than an explicit comparison test. Therefore, implementing a NOP test saves memory storage space and provides more processing bandwidth, resulting in higher throughput because the NOP test executes more quickly than the second comparison test. Additionally, the above code and method 201 implements a NOP test in a two-subclass environment, which is novel.

[0057] Note that in the second example, executing the first code fragment comprises inlining the first code fragment as an instance of a function using the first subclass, assuming that the unknown object is an instance of the first subclass, and executing the second code fragment comprises performing a virtual call on the instance of the function using the unknown object. However, other manners of executing the first and / or second code fragments may be implemented. For example, executing the first code fragment may include performing a virtual call on the instance of the function using the unknown object, and executing the second code fragment may include inlining the second code fragment as an instance of a function using the second subclass, assuming that the unknown object is an instance of the second subclass, or avoiding assuming a subclass associated with the unknown object. That is, in the second example, the first and / or second code fragments may be inlined, directly invoked, or virtually invoked as needed.

[0058] In a particular example, the computer-implemented method 201 may be performed by a processor of a Java Virtual Machine (JVM) of a Java Development Kit (JDK). In this example, the processor or processing circuitry 120 may also form part of the JVM of the JDK. In an even more particular example, the processor forms part of a just-in-time (JIT) compiler. In this example, the code fragment, unknown object, class, and subclass are defined in a .class file.

[0059] This computer-implemented method 201 is used to improve the functionality of a computing device in which it is implemented. For example, because the computing device does not need to perform two comparison tests (e.g., one to test whether x is of subclass A and a second to test whether x is of subclass B), the overall size of the instruction set is smaller, thus resulting in reduced storage space on the memory device. Also, because the instruction set is smaller due to replacing the second comparison test with a NOP test, the processor execution is more efficient and takes less time to execute, thus creating more processing bandwidth than would otherwise be possible and increasing throughput.

[0060] Also, as noted above, the NOP test is pre-disabled if there is more than one subclass rooted at X. Accordingly, this specification describes a system that utilizes the NOP test in a novel manner. As yet another example, a processor may automatically address and more efficiently resolve any bugs in the instruction set.

[0061] Thus, method 201 provides improvements to computing devices by: 1) utilizing a NOP test to determine previously unavailable subclass types when more than one compile-time generated subclass exists, and 2) saving memory and processing resources by avoiding multiple explicit comparison tests to determine whether an unknown object is one of two identified subclasses. Note that some embodiments may not have these potential advantages, and these potential advantages are not necessarily required for all embodiments.

[0062] FIG. 3 illustrates a computer-implemented method 301 for identifying a subclass of an unknown object according to an example of principles described herein. According to the computer-implemented method 301, the processing circuit 120 and / or processor (block 302) determines whether the unknown object is an instance of a first subclass, which may be performed as described above. In response to determining that the unknown object is an instance of the first subclass (block 302, determination YES), the processor may execute a first code fragment (block 304) that assumes the unknown object is an instance of the first subclass, as described above. In the above example, C1 refers to the code fragment that is executed if the unknown object is known to be of the first subclass type in the original code. In this example, the second comparison test is not performed because the subclass type of the unknown object has been determined.

[0063] In response to determining that the unknown object is not an instance of the first subclass (block 302, decision NO), the processor may determine (block 306) whether additional subclasses exist in addition to the first and second subclasses. As noted above, this determination may be made by performing a NOP test or by performing some other operation.

[0064] In response to determining that no additional subclasses exist beyond the first and second subclasses (block 306, decision YES), the processor may execute (block 308) a second code fragment that assumes that the unknown object is an instance of the second subclass. If the processor determines that additional subclasses exist above the first and second subclasses (block 306, decision NO), the processor may execute (block 310) the second code fragment or another code fragment that avoids assuming that the unknown object is an instance of any specific subclass. For example, during source code generation, it may be the case that three subclasses A, B, and C exist. In this example, once it is determined that the unknown object is not an instance of subclass A and that an additional subclass (e.g., subclass C) exists in addition to subclasses A and B, the processor may execute some other code fragment that does not assume the unknown object's subclass. It is not that the unknown object does not have a subclass type; rather, the processor executes a code fragment that is independent of the subclass type.

[0065] Thus, method 301 provides improvements to computing devices by: 1) utilizing a NOP test to determine previously unavailable subclass types when more than one compile-time generated subclass exists, and 2) saving memory and processing resources by avoiding multiple explicit comparison tests to determine whether an unknown object is one of two identified subclasses. Note that some embodiments may not have these potential advantages, and these potential advantages are not necessarily required for all embodiments.

[0066] FIG. 4 illustrates a system 402 for identifying subclasses of unknown objects according to an example of the principles described herein.

[0067] The system 402 may be implemented on any number of computing devices, including desktop computers, laptop computers, mobile devices, servers, computing devices relying on remote operating systems, and gaming systems, among others. Although specific reference is made to a specific computing device, the system 402 may be implemented as any number of computing devices having a processor 404 and a memory device 406.

[0068] That is, system 402 includes a processor 404 and a memory device 406 communicatively coupled to processor 404. Processor 404 includes circuitry for retrieving executable code, i.e., instructions, from memory device 406 and executing the executable code.

[0069] The memory device 406 may include a non-transitory storage medium. The memory device 406 may take many forms, including volatile and non-volatile memory devices 406. For example, the memory device 406 may include random-access memory (RAM), read-only memory (ROM), optical memory disks, and magnetic disks, among others. The executable code, when executed by the processor 404, may cause the processor 404 to implement the functions described herein. The memory device 406 may include a single memory element or multiple memory elements.

[0070] As described above, memory device 406 includes instructions executable by processor 404. The instructions are executable by processor 404 to determine the subclass of an unknown object in the instruction set. Specifically, memory device 406 includes first comparison test instructions 408 for performing a first comparison test to determine whether the unknown object is an instance of a first subclass of the class of the object. As described above, this first comparison test may be an instanceof test or a type test added by the JIT compiler.

[0071] Memory device 406 also includes no-operation instructions 410 for, in response to determining that the unknown object is not an instance of the first subclass, performing a no-operation (NOP) test to prevent a second comparison test by determining whether an additional subclass exists above the first subclass and the second subclass. Memory device 406 also includes second code fragment instructions 414 for, in response to determining that no additional subclass exists, executing a second code fragment that assumes the unknown object is an instance of a second subclass. As described above, executing the second code fragment may include inlining the second code fragment as an instance of a function using the second subclass and assuming that the unknown object is an instance of the second subclass, or performing a virtual call to an instance of a function using the unknown object.

[0072] 5 illustrates a computer program product 516 having a computer-readable storage medium 518 for identifying subclasses of unknown objects, according to examples of principles described herein. To achieve its desired functionality, the system 402 includes various hardware components. Specifically, the system 402 includes a processor 404 and a machine-readable storage medium 518. The machine-readable storage medium 518 is communicatively coupled to the processor 404. The machine-readable storage medium 518 includes a number of instructions for performing specified functions. In some examples, the instructions may be machine code and / or script code.

[0073] The machine-readable storage medium 518 causes the processor 404 to perform the specified functions of the instructions 408, 410, 412, and 414. The machine-readable storage medium 518 may store data, programs, instructions, or any other machine-readable data utilized to operate the system 402. The machine-readable storage medium 518 may store machine-readable instructions that the processor 404 of the system 402 may process or execute. The machine-readable storage medium 518 may be an electronic, magnetic, optical, or other physical storage device that contains or stores executable instructions. The machine-readable storage medium 518 may be, for example, a random access memory (RAM), an electrically erasable programmable read-only memory (EEPROM), a storage device, an optical disk, etc. The machine-readable storage medium 518 may be a non-transitory machine-readable storage medium 518.

[0074] 5 , first comparison test instruction 408, when executed by processor 404, may cause processor 404 to perform a first comparison test to determine whether an unknown object is an instance of a first subclass of a class of object. First code fragment instructions 514, when executed by processor 404, may cause processor 404, in response to determining that the unknown object is an instance of the first subclass, to execute a first code fragment that assumes the unknown object is an instance of the first subclass. No-operation test instructions 410, when executed by processor 404, may cause processor 404, in response to determining that the unknown object is not an instance of the first subclass, to prevent a second comparison test by performing a no-operation (NOP) test to determine whether an additional subclass of the class of object exists above the first subclass and second subclass. The second code fragment instructions 412, when executed by the processor 404, may cause the processor 404, in response to determining that no additional subclasses exist, to execute a second code fragment that assumes the unknown object is an instance of the second subclass. The second code fragment instructions 412, when executed by the processor 404, may cause the processor 404, in response to determining that additional subclasses exist, to execute the second code fragment while avoiding assuming the unknown object is an instance of any specific subclass.

Claims

1. performing, by the processor, a first comparison test to determine whether the unknown object is an instance of a first subclass of the class of the object; In response to determining that the unknown object is not an instance of the first subclass: preventing, by the processor, a second comparison test to determine whether the unknown object is an instance of the second subclass by determining whether there are additional subclasses of the object's class in addition to the first and second subclasses; and responsive to determining that no additional subclasses exist, executing, by the processor, a second code fragment that assumes that the unknown object is an instance of the second subclass. A computer-implemented method comprising:

2. 2. The computer-implemented method of claim 1, further comprising, in response to determining that the unknown object is an instance of the first subclass, executing, by the processor, a first code fragment that assumes that the unknown object is an instance of the first subclass.

3. The computer-implemented method of claim 2 , wherein determining, by the processor, whether the unknown object is an instance of the first subclass comprises performing an instance of test.

4. 3. The computer-implemented method of claim 2, wherein determining, by the processor, whether the unknown object is an instance of the first subclass comprises performing type tests added by a just-in-time (JIT) compiler.

5. Executing the first code fragment includes: inlining the first code fragment as an instance of a function using the first subclass, assuming that the unknown object is an instance of the first subclass; and performing a virtual call to an instance of a function using the unknown object; The computer-implemented method of claim 2 , comprising at least one of:

6. 2. The computer-implemented method of claim 1, further comprising, in response to determining that additional subclasses exist, executing, by the processor, the second code fragment that avoids assuming the unknown object is of any particular subclass.

7. 2. The computer-implemented method of claim 1, wherein determining by the processor whether additional subclasses exist comprises performing a no-operation (NOP) test.

8. Executing the second code fragment includes: inlining the second code fragment as an instance of a function using the second subclass, assuming that the unknown object is an instance of the second subclass; and performing a virtual call to an instance of a function using the unknown object; The computer-implemented method of claim 4 , comprising at least one of:

9. processor; a memory device communicatively coupled to the processor, the memory device having instructions executable by the processor; the instructions comprising: instructions for performing a first comparison test to determine whether the unknown object is an instance of a first subclass of the class of the object; In response to determining that the unknown object is not an instance of the first subclass: instructions for preventing a second comparison test by performing a no-operation (NOP) test to determine whether additional subclasses of the object's class exist in addition to the first and second subclasses; and instructions for executing a second code fragment in response to determining that no additional subclasses exist, the second code fragment assuming that the unknown object is an instance of the second subclass; Including, the system.

10. 10. The system of claim 9, further comprising instructions executable by the processor to cause the processor to execute, in response to determining that the unknown object is an instance of the first subclass, a first code fragment that assumes that the unknown object is an instance of the first subclass.

11. 10. The system of claim 9, further comprising instructions executable by the processor to cause the processor to execute the second code fragment in response to determining that additional subclasses exist, the second code fragment avoiding assuming the unknown object is of any specific subclass.

12. The system of claim 9 , wherein the processor forms part of a just-in-time (JIT) compiler.

13. 10. The system of claim 9, wherein executing the second code fragment comprises inlining the second code fragment as an instance of a function using the second subclass under the assumption that the unknown object is an instance of the second subclass.

14. 10. The system of claim 9, wherein executing the second code fragment comprises performing a virtual call to an instance of a function using the unknown object.

15. 1. A computer program product comprising a computer-readable storage medium having program instructions embodied therein, the program instructions comprising: performing a first comparison test to determine whether the unknown object is an instance of a first subclass of the class of the object; In response to determining that the unknown object is not an instance of the first subclass: preventing a second comparison test by performing a no-operation (NOP) test to determine whether additional subclasses of the object's class exist in addition to the first and second subclasses; and In response to determining that no additional subclasses exist, executing a second code fragment that assumes that the unknown object is an instance of the second subclass. a computer program product executable by a processor to cause the processor to execute the

16. 16. The computer program product of claim 15, further comprising instructions executable by the processor to cause the processor to execute, in response to determining that the unknown object is an instance of the first subclass, a first code fragment that assumes that the unknown object is an instance of the first subclass.

17. 16. The computer program product of claim 15, further comprising instructions executable by the processor to cause the processor to execute the second code fragment in response to determining that additional subclasses exist, the second code fragment avoiding assuming the unknown object is of any particular subclass.

18. 16. The computer program product of claim 15, wherein the instructions are executed within a Java Virtual Machine (JVM) of a Java Development Kit (JDK).

19. 16. The computer program product of claim 15, wherein the code fragment, the unknown object, and the class are defined in a .class file.

20. 16. The computer program product of claim 15, wherein the processor forms part of a just-in-time (JIT) compiler.