Unknown object subclass identification

By using the first comparison test and NOP test in a multi-subclass environment to identify subclasses of unknown objects, the problems of difficulty in identifying and high resource occupancy in the prior art are solved, and more efficient processor performance and resource savings are achieved.

CN119998790APending Publication Date: 2025-05-13INTERNATIONAL BUSINESS MACHINE CORPORATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380070624.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-10-04
Filing Date
2023-05-09
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the presence of multiple subclasses, it is difficult for the prior art to efficiently identify subclasses of unknown objects, and the execution of the second comparison test will occupy a large amount of memory and processing resources.

Method used

It is determined whether the unknown object is an instance of the first subclass by performing the first comparison test, and if not, it is determined by NOP test whether there are additional subclasses other than the first subclass and the second subclass, thereby preventing the execution of the second comparison test and assuming that the unknown object is an instance of the second subclass.

Benefits of technology

It effectively avoids multiple explicit comparison tests, reduces the size of the instruction set, saves storage space and processing resources, and improves processor performance and throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119998790A_ABST
    Figure CN119998790A_ABST
Patent Text Reader

Abstract

The present specification describes a computer-implemented method. A first comparison test is performed to determine whether the unknown object belongs to a first subclass of the object class. In response to determining that the unknown object does not belong to the first subclass, it is determined whether the unknown object is an instance of the second subclass by determining whether there is an additional subclass other than the first subclass and the second subclass. In response to determining that there is an additional subclass, the second code snippet is executed while avoiding assuming that the unknown object is a particular subclass.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0001] The present invention relates to identifying subclasses of unknown objects in a program instruction set, and more particularly, to identifying an unknown object when there are two or more subclasses associated with an identified class of the object, the identification preventing 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. According to the computer-implemented method, a processor performs a first comparison test to determine whether an unknown object is an instance of a first subclass of an object class. In response to the processor determining that the unknown object is not an instance of the first subclass, the processor determines whether the unknown object is an instance of a second subclass by determining whether there are additional subclasses of the object class other than the first subclass and the second subclass, preventing a second comparison test. In response to determining that there are no additional subclasses, the processor executes a second code segment that assumes that the unknown object is an instance of the second subclass.

[0003] The 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. The instructions include instructions for performing a first comparison test to determine whether an unknown object is an instance of a first subclass of an object class. The memory device also includes instructions for preventing a second comparison test by performing a no-operation (NOP) test to determine whether there are additional subclasses of the object class other than the first subclass and the second subclass in response to determining that the unknown object is not an instance of the first subclass. The memory device also includes instructions for executing a second code snippet assuming that the unknown object is an instance of the second subclass in response to determining that there are no additional subclasses.

[0004] The specification also describes a computer program product. The computer program product includes a computer-readable storage medium having program instructions implemented thereon. The program instructions are executable by a processor and cause the processor to perform a first comparison test to determine whether an unknown object is an instance of a first subclass of an object class. 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 there are additional subclasses of the object class other than the first subclass and the second subclass. In response to determining that there are no additional subclasses, the program instructions are executable by the processor to execute a second code fragment, which assumes that the unknown object is an instance of the second subclass. BRIEF DESCRIPTION OF THE DRAWINGS

[0005] Figure 1 Depicted is a computing environment for performing unknown object subclass identification according to an example of the principles described herein.

[0006] Figure 2 Depicted is a computer-implemented method for identifying unknown object subclasses according to an example of principles described herein.

[0007] Figure 3 Depicted is a computer-implemented method for identifying unknown object subclasses according to an example of principles described herein.

[0008] Figure 4

[0013] Depicted is a system for identifying subclasses of unknown objects according to an example of the principles described herein.

[0009] Figure 5 A computer program product having a computer-readable storage medium for identifying unknown object subclasses is depicted according to an example of the principles described herein. DETAILED DESCRIPTION

[0010] Various aspects of the present disclosure are described by narrative text, flow charts, block diagrams of computer systems, and / or block diagrams of machine logic included in computer program product (CPP) embodiments. With respect to any flow chart, depending on the technology involved, the operations may be performed in an order different from the order shown in a given flow chart. For example, again depending on the technology involved, two operations shown in consecutive flow chart blocks may be performed in reverse order, as a single integrated step, simultaneously, or in a manner that at least partially overlaps in time.

[0011] Computer program product embodiments ("CPP embodiments" or "CPP") are terms used in this disclosure to describe any collection of one or more storage media (also referred to as "media") collectively included in a collection of one or more storage devices that collectively include 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. Without limitation, a computer-readable storage medium may be 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: magnetic disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), static random access memories (SRAM), compact disk read-only memories (CD-ROM), digital versatile disks (DVD), memory sticks, floppy disks, mechanical encoding devices (such as punch cards or pits / lands formed in a major surface of a disk), or any suitable combination of the foregoing. Computer-readable storage media, as the term is used in this disclosure, should not be construed as storing in the form of transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides, light pulses through fiber optic cables, electrical signals transmitted through wires, and / or other transmission media. As will be appreciated by those skilled in the art, data is typically moved at certain occasional points in time during normal operation of the storage device, such as during access, defragmentation, or garbage collection, but this does not make the storage device transitory because the data is not transitory while it is stored.

[0012] A computing device such as a desktop computer, laptop computer, all-in-one device, etc. executes an instruction set to perform the intended operation. That is, in order to perform the millions of operations it is capable of performing, the computing device is fed with an instruction set in a computing language that the hardware components of the computing device can understand and interpret to perform the intended operation. As a specific example, a word processing application can print a text document by executing a print instruction set. Before executing the instruction set, the instruction set is constructed or compiled. Compilation of an instruction set refers to the operation of converting a user-generated human-readable source code into a machine code executable by the processor of the computing device. During compilation, the validity of the file including the instruction set is evaluated or "debugged". There are various forms of compiling instruction sets. For example, with static languages, the file is compiled before runtime execution. In contrast, with dynamic languages, compilation is performed during runtime execution. A particularly relevant feature of dynamic languages ​​is that the "type" of a variable that is a component of an instruction set is not identified before runtime execution. That is, with static languages, the type or class of an object is identified before the instruction set is executed. By comparison with dynamic languages, the object class or subclass is determined during runtime execution.

[0013] As a specific example, the 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 described above, when executing a dynamic language, the object type is determined at runtime, rather than by a pre-runtime compiler. There may be overhead associated with executing a dynamic language instruction set to test the class of an object because there is the possibility of loading / reclassifying classes at any time. There are many ways that the JVM can determine the type of a particular unknown object. As a first example, the JVM can run an "instanceof" test that appears in the application (i.e., Java) source code. An example is provided below.

[0014] if(x instance of A)

[0015] {

[0016] …Code fragment C1, which assumes x is an instance of A

[0017] }

[0018] else

[0019] {

[0020] …code fragment C2, which does not assume any subclasses of x

[0021] }

[0022] In another example, type tests may be added by a just-in-time (JIT) compiler to protect inlined or devirtualized code paths. An example is provided below.

[0023] if(x.class == A)

[0024] {

[0025] ...inline code C3 is used for A.foo, which assumes x is an instance of A

[0026] }

[0027] else

[0028] {

[0029] ...virtually calls x.foo

[0030] }

[0031] 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 loaded by the JVM when the program is run, and B is the second non-abstract subclass of X loaded by the JVM when the program is run. foo is a virtual method declared in class X, and thus should be valid for calls to variables (e.g., x) declared to be of class type X (which can be X, A, or B at runtime). That is, virtual calls are a feature of object-oriented languages ​​that make calls to objects without knowing their runtime type.

[0032] Also in this example, C1 is a code snippet that is executed knowing that x belongs to subclass type A in the original code (written by the user in the program or created by the JIT compiler due to optimizations such as inlining). Similarly, C2 is a code snippet that is executed knowing that x belongs to subclass type B in the original code (written by the user in the program or created by the JIT compiler due to optimizations such as inlining). C3 is similarly a code snippet assuming a subclass type of x. As a practical example, X can be a class "Vehicle", while A is a subclass "Car" and B is a subclass "Truck". In this example, foo can be a virtual method "Drive" that is valid for calling method "Drive" as long as x belongs to class type "Vehicle". Based on whether the runtime-determined subclass of x is A (e.g., "Car") or B (e.g., "Truck"), different "Drive" methods that implement the driving functionality for a "Car" variable or a "Truck" variable are called.

[0033] In either example, the JVM performs a comparison test (e.g., an "instanceof" test or a type test added by the JIT compiler), which is a set of instructions that are compared. For example, a type test "ifx.class==B" added by the JIT compiler will result in a comparison instruction followed by a conditional branch instruction.

[0034] The dynamic compiler can access information that the static compiler cannot because the program has 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, the JIT compiler can pick which of A or B is the more frequently encountered class, and can inline the more frequently executed methods first, and the less frequently executed methods second.

[0035] Other benefits include knowing which code paths are executed more frequently, and ordering those code paths to be adjacent to each other.The JIT compiler may also facilitate platform development and hardware development that uses information about the platform and hardware components of a computing device to optimize code execution.

[0036] Due to the removal of pre-runtime compilation, dynamic languages ​​and JIT compilers provide reduced development time. The above code snippets can be further developed to further improve the efficiency of the base code. For example, if there is a single concrete subclass A in the class hierarchy rooted in X, the JIT compiler can optimize these type tests by performing no-operation (NOP) tests. By performing NOP tests, the JVM can skip explicitly performing comparison tests to determine the subclasses of x. Alternatively, the JVM can rely on runtime assumptions registered with the JIT compiler to save functional correctness. In other words, as long as a single concrete subclass A is loaded in the class hierarchy rooted in X, comparison tests can be avoided because only one x can be a possible subclass of its instance (e.g., A). If a new subclass B in the class hierarchy rooted in X is loaded after the compiled code is generated, the compiled code will be patched to maintain functional correctness, even if this will be at the cost of performance cost. A revised version of the sample code is provided as follows together with the patch. With reference to the first example, the patch code can be:

[0037] if (NOPed tests that A is the only concrete subclass in the hierarchy rooted at X)

[0038] {

[0039] …Code fragment C1, which assumes x is an instance of A

[0040] }

[0041] else

[0042] {

[0043] if(x instance A)

[0044] }

[0045] …code fragment C1, which assumes x is an instance of A

[0046] }

[0047] else

[0048] {

[0049] …code fragment C2 does not assume any subclasses of x

[0050] }

[0051] For the second example, the patch code could be:

[0052] if (NOPed tests that A is the only concrete subclass in the hierarchy rooted at X)

[0053] {

[0054] ...inline code C3 is used for A.foo, which assumes x is an instance of A

[0055] }

[0056] else

[0057] {

[0058] ...virtually calls x.foo

[0059] }

[0060] However, note that when generating compiled code, there are more than one concrete subclasses (e.g., A and B) in the class hierarchy rooted in X, NOP testing may not be implemented. Therefore, the present disclosure describes a method, system, and computer program product that improves the efficiency of the JIT compiler when there are two concrete subclasses (e.g., A and B) in the class hierarchy rooted in X when generating source code. Typically, there is a sequence with a single comparison test and a single NOP test (wherein in some examples, only the comparison test is performed), which optimizes the concrete subclasses A and B in the hierarchy rooted in X. This is more efficient than performing two explicit tests (once for A and B). That is, the NOP test avoids generating comparison test instructions. In other words, the execution of a single comparison test and a single NOP test can improve the efficiency of the compiled code generated by the JIT compiler. Instead, the JVM tracks the point in the source code at which the JVM drops the NOP instruction, which should be patched at runtime if certain conditions change.

[0061] For example, in the case where 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, since that is the only possible option (if it is declared to be of type X, it may have no other classes). However, if a new subclass B is loaded in the future, the JVM will patch (i.e., change) the code location where the NOP instruction is instead to be converted to an unconditional JUMP instruction. The JUMP instruction will branch to a fallback path where some appropriately correct code will be executed so that the program remains functional in this case, such as performing a virtual call.

[0062] However, for the NOP test, if there are no changes in the future where a new subclass B is loaded, then performing the NOP test is more efficient than performing the comparison test because it is a single instruction (sometimes no instruction). In this example, the NOP test used takes the lead in the JIT compiler because there are other situations where a single code location can be patched under "composite" conditions (e.g., A and B are the only concrete subclasses in a hierarchy rooted at X) in the corresponding runtime assumptions. 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.

[0063] Using the system, method, and computer program product, instruction sets guarded by test types can be better optimized by propagating more refined type information across more JIT compiled code. As a specific example, assuming the system knows the method being called, if the code snippet has another call to a method that uses x (e.g., x.goo()), then these calls can be unconditionally inlined. For example, if x is known to be of type A, then A.goo can be inlined without any tests (explicit or NOPs).

[0064] The system, method, and computer program product improve the functionality of a computing device. For example, because the computing device does not have to perform two comparison tests (e.g., one test to see if x belongs to subclass A and a second test to see if x belongs to subclass B), the total size of the instruction set is smaller, resulting in reduced storage space on a memory device. That is, the computing device has a limited amount of storage space, and the instruction set occupies the storage space. By providing an instruction set that occupies less memory resources of a memory device, more space on the memory device is reserved for other instruction sets.

[0065] Furthermore, since the instruction set is smaller by replacing the second comparison test with a NOP test, processor performance is increased 1) by increasing processor bandwidth and 2) by increasing processor throughput. That is, with fewer instructions executed, the determination of the subclass type of the unknown variable is performed faster, allowing other operations to be performed simultaneously.

[0066] Furthermore, as described above, NOP testing was previously unavailable when there is more than one subclass rooted in X. Thus, this specification describes a system that utilizes NOP testing in a novel manner. Specifically, it is determined to which of two subclasses an unknown variable belongs.

[0067] As yet another example, the processor can automatically address and resolve any potential problems in the instruction set more efficiently. Specifically, as the overall code length is reduced, there are fewer defects to fix, and the processor can evaluate the instruction set faster.

[0068] Thus, the present methods, systems, and computer program products provide improvements to computing devices by: 1) utilizing a NOP test to determine the subclass type when more than one compile-time generated subclass exists, which was previously unavailable, 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 required for all embodiments.

[0069] As used in this specification and the appended claims, the term "plurality" or similar language is meant to be broadly interpreted to include any positive number from 1 to infinity.

[0070] Now turning to the attached figure, Figure 1 Depicted is a computing environment 100 for performing unknown object subclass identification according to an example of the principles described herein.

[0071] The computing environment 100 includes an example of an environment for executing at least some of the computer codes involved in performing the methods of the present invention, such as the subclass identification code 200. In addition to the block 200, the computing environment 100 includes, for example, a computer 101, a wide area network (WAN) 102, an end user device (EUD) 103, a remote server 104, a public cloud 105, and a private cloud 106. In this embodiment, the computer 101 includes a processor set 110 (including a processing circuit 120 and a cache 121), a communication architecture 111, a volatile memory 112, a permanent storage device 113 (including an operating system 122 and the block 200, as described above), a peripheral device set 114 (including a user interface (UI) device set 123, a storage device 124, and an Internet of Things (IoT) sensor set 125), and a network module 115. The remote server 104 includes a remote database 130. Public cloud 105 includes a gateway 140 , a cloud orchestration module 141 , a host physical machine set 142 , a virtual machine set 143 , and a container set 144 .

[0072] Computer 101 may take the form of a desktop computer, laptop computer, tablet computer, smart phone, smart watch or other wearable computer, mainframe computer, quantum computer, or any other form of computer or mobile device now known or to be developed in the future that is capable of running programs, accessing a network, or querying a database such as remote database 130. As is well known in the art of computer technology, and depending on the technology, the performance of computer-implemented methods may be distributed among multiple computers and / or among multiple locations. On the other hand, in this presentation of computing environment 100, the detailed discussion focuses on a single computer, particularly computer 101, to keep the presentation as simple as possible. Computer 101 may be located in the cloud, even though it is not yet fully understood. Figure 1 On the other hand, computer 101 need not be in the cloud except to any extent that can be positively indicated.

[0073] Processor set 110 includes one or more computer processors of any type now known or to be developed in the future. Processing circuit 120 may be distributed over multiple packages, such as multiple cooperating integrated circuit chips. Processing circuit 120 may implement multiple processor threads and / or multiple processor cores. Cache 121 is a memory located in the processor chip package (one or more) and is typically used for data or code that should be quickly accessed by threads or cores running on processor set 110. Cache memory is typically organized into multiple levels based on relative proximity to the processing circuit. Alternatively, some or all of the caches of the processor set may be located "off chip". In some computing environments, processor set 110 may be designed to work with qubits and perform quantum computing.

[0074] Computer readable program instructions are typically loaded onto the computer 101 to cause the processor set 110 of the computer 101 to perform a series of operating steps to implement a computer-implemented method, so that the instructions so executed will instantiate the method specified in the flow chart and / or the narrative description of the computer-implemented method included in this document (collectively referred to as the "inventive method"). These computer readable program instructions are stored in various types of computer readable storage media, such as cache 121 and other storage media discussed below. The program instructions and related data are accessed by the processor set 110 to control and direct the execution of the inventive method. In the computing environment 100, at least some of the instructions for executing the inventive method may be stored in a block 200 in a permanent storage device 113.

[0075] The communication fabric 111 is the signaling paths that allow the various components of the computer 101 to communicate with each other. Typically, the fabric is made up of switches and conductive paths, such as those that make up a bus, a bridge, physical input / output ports, etc. Other types of signal communication paths may be used, such as fiber optic communication paths and / or wireless communication paths.

[0076] The volatile memory 112 is any type of volatile memory now known or to be developed in the future. Examples include dynamic random access memory (RAM) or static RAM. Typically, the volatile memory 112 is characterized by random access, but this is not required unless expressly stated. In the computer 101, the volatile memory 112 is located in a single package and is internal to the computer 101, but, alternatively or additionally, the volatile memory can be distributed in multiple packages and / or located externally relative to the computer 101.

[0077] Permanent storage device 113 is any form of non-volatile memory for computers known now or to be developed in the future. The non-volatility of the storage device means that the stored data is maintained regardless of whether power is supplied to computer 101 and / or directly to permanent storage device 113. Permanent storage device 113 can be a read-only memory (ROM), but usually at least a portion of the permanent storage device allows the writing of data, the deletion of data, and the rewriting of data. Some common forms of permanent storage devices include disks and solid-state storage devices. Operating system 122 can take several forms, such as various known proprietary operating systems using a kernel or an operating system of an open source portable operating system interface type. The code included in block 200 generally includes at least some of the computer codes involved in the execution of the method of the present invention.

[0078] The peripheral device set 113 includes a peripheral device set of the computer 101. The data communication connection between the peripheral device and other components of the computer 101 can be implemented in various ways, such as a Bluetooth connection, a near field communication (NFC) connection, a connection made by a cable (such as a universal serial bus (USB) type cable), a plug-in type connection (e.g., a secure digital (SD) card), a connection made through a local area communication network, and even a connection made through a wide area network such as the Internet. In various embodiments, the UI device set 123 may include components such as display screens, speakers, microphones, wearable devices (such as goggles and smart watches), keyboards, mice, printers, touchpads, game controllers, and tactile devices. The storage device 124 is an external storage device, such as an external hard drive, or a pluggable storage device, such as an SD card. The storage device 124 can be permanent and / or volatile. In some embodiments, the storage device 124 can take the form of a quantum computing storage device for storing data in the form of quantum bits. In embodiments where the computer 101 needs to have a large amount of storage (e.g., where the computer 101 locally stores and manages a large database), the 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. The IoT sensor set 125 is made up of sensors that can be used in IoT applications. For example, one sensor may be a thermometer, while another sensor may be a motion detector.

[0079] The network module 115 is a collection of computer software, hardware, and firmware that allows the computer 101 to communicate with other computers via the WAN 102. The network module 115 may include hardware, such as a modem or Wi-Fi signal transceiver, software for packetizing and / or depacketizing data transmitted over a communication network, and / or web browser software for transmitting data over the Internet. In some embodiments, the network control function and the network forwarding function of the network module 115 are executed on the same physical hardware device. In other embodiments (e.g., embodiments utilizing software defined networks (SDN)), the control function and the forwarding function of the network module 115 are executed on physically separated devices, so that the control function manages several different network hardware devices. Computer-readable program instructions for executing the method of the present invention can generally be downloaded to the computer 101 from an external computer or an external storage device via a network adapter card or a network interface included in the network module 115.

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

[0081] End-user device (EUD) 103 is any computer system used and controlled by an end-user (e.g., a customer of an enterprise operating computer 101), and may take any of the forms discussed above in connection with computer 101. EUD 103 typically receives helpful and useful data from the operation of computer 101. For example, in the hypothetical case where computer 101 is designed to provide recommendations to an end-user, the recommendations would typically be transmitted from network module 115 of computer 101 to EUD 103 via WAN 102. In this manner, EUD 103 may 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, a desktop computer, or the like.

[0082] Remote server 104 is any computer system that provides 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(s) that collects and stores helpful 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 that historical data may be provided to computer 101 from remote database 130 of remote server 104.

[0083] The public cloud 105 is any computer system that can be used by multiple entities, which provides on-demand availability of computer system resources and / or other computer capabilities, especially data storage (cloud storage) and computing capabilities, without the need for direct active management by users. Cloud computing generally uses the sharing of resources to achieve consistency and economy of scale. The direct and active management of the computing resources of the public cloud 105 is performed by the computer hardware and / or software of the cloud orchestration module 141. The computing resources provided by the public cloud 105 are generally implemented by virtual computing environments running on various computers that constitute the host physical machine set 142, which is the universe of physical computers in the public cloud 105 and / or available for the public cloud. The virtual computing environment (VCE) is generally in the form of a virtual machine from the virtual machine set 143 and / or a container from the container set 144. It should be understood that these VCEs can be stored as images and can be transmitted between various physical machine hosts as images or after the instantiation of the VCE. The cloud orchestration module 141 manages the transmission and storage of images, deploys new instantiations of VCEs, and manages active instantiations of VCE deployments. Gateway 140 is a collection of computer software, hardware, and firmware that allows public cloud 105 to communicate over WAN 102 .

[0084] Some further explanation of a virtualized computing environment (VCE) will now be provided. A VCE can be stored as an "image". A new active instance of the VCE can be instantiated from that image. Two common types of VCEs are virtual machines and containers. A container is a VCE that uses operating system-level virtualization. This refers to an operating system feature where the kernel allows the existence of multiple isolated user space instances, called containers. From the perspective of the programs running in them, these isolated user space instances typically behave like actual computers. A computer program running on a normal operating system can utilize all of the resources of that computer, such as connected devices, files and folders, network shares, CPU power, and quantifiable hardware capabilities. However, a program running within a container can only use the contents of the container and the devices assigned to the container, a feature known as containerization.

[0085] The private cloud 106 is similar to the public cloud 105, except that the computing resources are only available to a single enterprise. Although the private cloud 106 is depicted as communicating with the WAN 102, in other embodiments, the private cloud can be completely disconnected from the Internet and can only be accessed through a local / private network. A hybrid cloud is a combination of multiple clouds of different types (e.g., private, community, or public cloud types), typically implemented by different vendors. Each of the multiple clouds remains a separate and discrete entity, but the larger hybrid cloud architecture is bound together by standardized or proprietary technologies that enable orchestration, management, and / or data / application portability between the multiple constituent clouds. In this embodiment, the public cloud 105 and the private cloud 106 are both part of a larger hybrid cloud.

[0086] Figure 2 A computer-implemented method 201 for identifying a subclass of an unknown object is depicted, according to an example of the principles described herein. As described above, this specification describes a computer-implemented method 201 that is usable when there are at least two specific subclasses of a class, and 1) prevents the performance 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 belongs to, which is a novel feature. That is, when there are two possible subclasses of the unknown object, the NOP test was previously inoperable. It should be noted that the operations depicted in the computer-implemented method 201 can be performed by Figure 1 The processing circuit 120 depicted in Figure 4 The processor depicted in FIG.

[0087] According to the computer-implemented method 201, the processing circuit 120 and / or the processor may perform (block 202) a first comparison test to determine whether the unknown object x is an instance of a first subclass A of the class X of objects. This comparison test is an explicit test that compares the unknown object x and its characteristics with the characteristics of the first subclass A. If the first subclass A and the unknown object x have the same characteristics and attributes, or have a threshold amount of the same characteristics and attributes, the processor may determine that the unknown object belongs to 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 that tests whether the unknown object is an instance of the first subclass. 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, and the processor may perform various operations.

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

[0089] However, since there are two subclasses that the unknown object may relate to (e.g., subclass A and subclass B), 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 prevent (block 204) a second comparison test to determine the subclass of the unknown object. That is, in the absence of 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 belongs to the second subclass B. This second comparison test takes up space on the memory device and is computationally expensive to perform compared to when such a test is not performed. Therefore, the computer-implemented method 201 of the present invention prevents (block 204) the performance of the second comparison test, specifically, by determining whether there are additional subclasses other than the first subclass and the second subclass. That is, based on the first comparison test, the processor evaluates whether the unknown object belongs to the first subclass. If the processor determines that the unknown object belongs to the first subclass, the processor has successfully identified the subclass of the unknown object. If the processor determines that the unknown object does not belong to the first subclass, the processor determines whether there are only two specific subclasses. If there are only two specific subclasses in the original code and the unknown object is not the first subclass, the processor can identify the unknown object as belonging to the second subclass.

[0090] Thus, in response to determining that there are no additional subclasses in addition to the first subclass and the second subclass, the processor may execute (block 206) a second code snippet that assumes that the unknown object is an instance of the second subclass. In the above example, C2 refers to a code snippet that is executed if it is known that the unknown object belongs to the second subclass type in the original code. In this example, the second comparison test is not performed because the subclass type of the unknown object is first determined to be not subclass A, and the processor determines that A and B are subclasses without performing the second comparison test.

[0091] In the case where the processor determines that there are additional subclasses above the first subclass and the second subclass, the processor may execute a second code snippet or another code snippet that avoids assuming that the unknown object is an instance of any particular subclass. For example, the processor may execute a code snippet that is executed when the subclass type of the unknown object is unknown. For example, once the source code is generated, 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 there are additional subclasses (e.g., subclass C) in addition to subclasses A and B, the processor may execute some other code snippet that does not assume the subclass of the unknown object.

[0092] Example pseudocode is provided below that describes the prevention of the second comparison test and its reliance on the NOP test to determine which of subclasses A and B the unknown object x belongs to. In the first example:

[0093] if(x instanceof A)

[0094] {

[0095] …code fragment C1, which assumes x is an instance of A

[0096] }

[0097] else

[0098] {

[0099] if (NOPed test that A and B are the only concrete subclasses in the hierarchy rooted at X)

[0100] {

[0101] …Code fragment C2, which assumes x is an instance of B

[0102] }

[0103] else

[0104] {

[0105] …code fragment C2 does not assume any subclasses of x

[0106] }

[0107] For the second example:

[0108] if(x.class == A)

[0109] {

[0110] ...inline code C3 is used for A.foo, which assumes x is an instance of A

[0111] }

[0112] else

[0113] {

[0114] if (NOPed test that A and B are the only concrete subclasses in the hierarchy rooted at X)

[0115] {

[0116] Calling B.foo directly

[0117] }

[0118] else

[0119] {

[0120] ...virtually calls x.foo

[0121] }

[0122] In the example code given above, the determination (block 204) is performed by performing a NOP test to determine whether there are additional subclasses for the object class in addition to the first subclass and the second subclass, which does not consume memory space and is more efficient to use than an explicit comparison test. Thus, the implementation of the NOP test saves memory storage space, provides more processing bandwidth, and because the NOP test is performed faster than the second comparison test, it results in higher throughput. In addition, the above code and method 201 implement the NOP test in two subclass environments, which is novel.

[0123] Note that in the second example, executing the first code snippet includes assuming that the unknown object is an instance of the first subclass, inlining the first code snippet as an instance of a function using the first subclass, and executing the second code snippet includes using the unknown object to perform a virtual call to the instance of the function. However, other ways of executing the first and / or second code snippets can be implemented. For example, executing the first code snippet may include using the unknown object to perform a virtual call to the instance of the function, and executing the second code snippet may include assuming that the unknown object is an instance of the second subclass or avoiding assuming a subclass associated with the unknown object, then inlining the second code snippet as an instance of a function using the second subclass. That is, in the second example, the first and / or second code snippets may be inlined, directly called, or virtually called as desired.

[0124] In a specific example, the computer-implemented method 201 can be performed by a processor of a java virtual machine (JVM) of a java development kit (JDK). In this example, the processor or processing circuit 120 can also form a part of the JVM of the JDK. In an even more specific example, the processor forms a part of a just-in-time (JIT) compiler. In this example, code snippets, unknown objects, classes, and subclasses are defined in .class files.

[0125] Using the computer-implemented method 201, the functionality of the computing device implemented therein is improved. For example, because the computing device does not have to perform two comparison tests (e.g., one test to see if x belongs to subclass A, and a second test to see if x belongs to subclass B), the overall size of the instruction set is smaller, resulting in reduced storage space on the memory device. In addition, since the instruction set is smaller due to the replacement of the second comparison test with a NOP test, the processor is made to execute more efficiently and take less time to run, thereby generating more processing bandwidth than would otherwise be possible and increasing throughput.

[0126] Furthermore, as described above, NOP testing was previously inoperable when there was more than one subclass rooted at X. Thus, the present specification describes a system that utilizes NOP testing in a novel manner. As another example, the processor can more efficiently and automatically address and resolve any errors in the instruction set.

[0127] Thus, the present method 201 provides improvements to a computing device by: 1) utilizing a NOP test to determine the subclass type when there is more than one compile-time generated subclass, which was previously unavailable, 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 required for all embodiments.

[0128] Figure 3 A computer-implemented method 301 for identifying a subclass of an unknown object is depicted according to an example of the principles described herein. According to the computer-implemented method 301, the processing circuit 120 and / or the processor determines (block 302) 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 is yes), the processor may execute (block 304) a first code fragment that assumes that the unknown object is an instance of the first subclass as described above. In the above example, C1 refers to a code fragment that is executed if it is known that the unknown object is of the first subclass type in the original code. In this example, when the subclass type of the unknown object has been determined, the second comparison test is not performed.

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

[0130] In response to determining that there are no additional subclasses in addition to the first subclass and the second subclass (block 306, determination is yes), the processor may execute (block 308) a second code snippet assuming that the unknown object is an instance of the second subclass. In the event that the processor determines that there are additional subclasses above the first subclass and the second subclass (block 306, determination is no), the processor executes (block 310) a second code snippet or another code snippet that avoids assuming that the unknown object is an instance of any particular subclass. For example, once the source code is generated, 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 there are additional subclasses (e.g., subclass C) in addition to subclasses A and B, the processor may execute some other code snippet that does not assume the subclass of the unknown object. This is not to say that the unknown object does not belong to the subclass type, but that the processor executes a code snippet that does not depend on the subclass type.

[0131] Thus, the present method 301 provides improvements to a computing device by: 1) utilizing a NOP test to determine the subclass type when there is more than one compile-time generated subclass, which was previously unavailable, 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 required for all embodiments.

[0132] Figure 4 Depicted is a system 402 for identifying unknown object subclasses, according to an example of the principles described herein.

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

[0134] That is, system 402 includes a processor 404 and a memory device 406 communicatively coupled to processor 404. Processor 404 includes circuitry to retrieve executable code (ie, instructions) from memory device 406 and execute the executable code.

[0135] 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 storage disks and magnetic disks, etc. 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.

[0136] As described above, the memory device 406 includes instructions that can be executed by the processor 404. The instructions can be executed by the processor 404 to determine the subclass of the unknown object in the instruction set. Specifically, the memory device 406 includes first comparison test instructions 408 to perform a first comparison test to determine whether the unknown object is an instance of a first subclass of the object class. As described above, the first comparison test can be an instanceof test or a type test added by the JIT compiler.

[0137] The memory device 406 also includes no-operation instructions 410, which, in response to determining that the unknown object is not an instance of the first subclass, prevents a second comparison test by performing a no-operation (NOP) test to determine whether there are additional subclasses above the first subclass and the second subclass. The memory device 406 also includes second code snippet instructions 412, which, in response to determining that there are no additional subclasses, execute a second code snippet assuming that the unknown object is an instance of the second subclass. As described above, the execution of the second code snippet may include assuming that the unknown object is an instance of the second subclass or performing a virtual call to an instance of a function that uses the unknown object, inlining the second code snippet as an instance of a function that uses the second subclass.

[0138] Figure 5 A computer program product 516 with a computer-readable storage medium 518 for identifying unknown object subclasses according to an example of the principles described herein is depicted. To achieve its desired functionality, system 402 includes various hardware components. Specifically, system 402 includes processor 404 and machine-readable storage medium 518. Machine-readable storage medium 518 is communicatively coupled to processor 404. Machine-readable storage medium 518 includes several instructions for performing specified functions. In some examples, the instructions may be machine code and / or script code.

[0139] The machine-readable storage medium 518 enables the processor 404 to perform the specified functions of the instructions 408, 410, 412, 414. The machine-readable storage medium 518 can store data, programs, instructions, or any other machine-readable data that can be used to operate the system 402. The machine-readable storage medium 518 can store machine-readable instructions that the processor 404 of the system 402 can process or execute. The machine-readable storage medium 518 can be an electronic, magnetic, optical, or other physical storage device that contains or stores executable instructions. The machine-readable storage medium 518 can 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 can be a non-transitory machine-readable storage medium 518.

[0140] refer to Figure 5 , the first comparison test instructions 408, when executed by the processor 404, cause the processor 404 to perform a first comparison test to determine whether the unknown object is an instance of a first subclass of the object class. The first code snippet instructions 514, when executed by the processor 404, may cause the processor 404 to execute a first code snippet assuming that the unknown object is an instance of the first subclass in response to determining that the unknown object is an instance of the first subclass. The no-operation test instructions 410, when executed by the processor 404, may cause the processor 404 to prevent a second comparison test by performing a no-operation (NOP) test to determine whether there are additional subclasses for the object class on the first subclass and the second subclass in response to determining that there are no additional subclasses. The second code snippet instructions 412, when executed by the processor 404, may cause the processor 404 to execute a second code snippet assuming that the unknown object is an instance of the second subclass in response to determining that there are additional subclasses. The second code snippet instructions 412, when executed by the processor 404, may cause the processor 404 to execute the second code snippet in response to determining that there are additional subclasses s, while avoiding assuming that the unknown object is an instance of any particular subclass.

Claims

1. A computer-implemented method comprising: 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 objects; 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 a second subclass by determining whether an additional subclass of the object class exists in addition to the first and second subclasses; as well as In response to determining that there are no additional subclasses, a second code segment is executed by the processor to assume that the unknown object is an instance of the second subclass.

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 segment assuming 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 instanceof test.

4. 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 a type test added by a just-in-time (JIT) compiler.

5. The computer-implemented method of claim 2, wherein executing the first code snippet comprises at least one of: Assuming that the unknown object is an instance of a first subclass, inlining the first code snippet as an instance of a function using the first subclass; and Performs a virtual call to an instance of a function that uses the unknown object.

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

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

8. The computer-implemented method of claim 4, wherein executing the second code snippet comprises at least one of: Assuming that the unknown object is an instance of a second subclass, inlining the second code snippet as an instance of a function using the second subclass; and Performs a virtual call to an instance of a function that uses the unknown object.

9. A system comprising: processor; a memory device communicatively coupled to the processor, the memory device comprising 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 object class; 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 if there are additional subclasses of the object class in addition to the first and second subclasses; and Instructions for executing, in response to determining that no additional subclasses exist, a second code snippet assuming that the unknown object is an instance of the second subclass.

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

11. The system of claim 9, further comprising instructions executable by the processor to cause the processor to execute the second code segment that avoids assuming that the unknown object belongs to any particular subclass in response to determining that additional subclasses exist.

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

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

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

15. A computer program product, the computer program product comprising a computer readable storage medium having program instructions embodied thereon, the program instructions being executable by a processor to cause the processor to: performing a first comparison test to determine whether the unknown object is an instance of a first subclass of the object class; 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 if there are additional subclasses of the object class in addition to the first and second subclasses; and In response to determining that no additional subclasses exist, a second code segment is executed that assumes that the unknown object is an instance of the second subclass.

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

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

18. 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. The computer program product of claim 15, wherein the code snippets, unknown objects, and classes are defined in .class files.

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