A system and method for partial object dematerialization within a virtual machine (VM), and particularly Java Virtual Machines. In accordance with an embodiment, the system allows for applying partial object dematerialization to situations where the object is either created locally, or is retrieved from external code where it might have already escaped. In accordance with an embodiment, the system comprises a computer; a virtual machine for executing a software application; memory space for the application byte code and the generated machine code; and a compiler with an object dematerializer, and dematerializer injector. Runtime partial object dematerialization code is injected into the intermediate code representation in such a way that additional or standard optimizer techniques can be applied to it.
Legal claims defining the scope of protection, as filed with the USPTO.
1. A system for generating machine code from byte code in virtual machines, comprising: a computer including a virtual machine running thereon, for executing a software application, and further including a memory space or storage medium for storing byte code as part of the software application; and a compiler, further comprising an object dematerializer that determines, during compilation of the software application, that an object is suitable for dematerialization, and, if the object is suitable for dematerialization, generates machine code that initializes fields of a dematerialized object, to create a first code path, and a dematerializer injector that simultaneously, during compilation, injects dematerialization code to create a second code path, by receiving a normal object reference, and transforming a code path with the normal object reference into the second code path using dematerialized object fields; wherein the compiler then joins the first and second code paths together into a resultant code path that continues to use the dematerialized object.
2. The system of claim 1 , wherein one or more indirect null checks are used to preserve application behavior on null pointer exceptions.
3. The system of claim 2 , wherein the indirect null checks are implemented using nullness communicator variables.
4. The system of claim 3 , wherein the nullness communicator variables are implemented using single static assignment variables.
5. The system of claim 2 , wherein the compiler moves one or more indirect null checks into the code paths where the null checks would fail.
6. The system of claim 1 , wherein the compiler performs the steps of: detecting that an object is not explicitly escaping after it has been injected, verifying that read fields of the object are not volatile, determining that that all uses of the object join into a single code path, and that the code paths do not contain any synchronization points, verifying that the object is created locally or injected as a return value from another function or as an argument, injecting a runtime object dematerializer after each call containing nullness communicator variables for the object, inserting a null indicator before each use of fields in the object, checking if a null check move optimization can be applied, and performing an object dematerialization where a constructor is inlined and temporary variables are used for storage instead of the actual object.
7. A method for generating machine code from byte code in virtual machines, comprising the steps of: providing a computer including a virtual machine running thereon, for executing a software application, and further including a memory space or storage medium for storing byte code as part of the software application; and compiling the software application using a compiler, further comprising determining that an object is suitable for dematerialization, and, if the object is suitable for dematerialization, generating machine code that initializes fields of a dematerialized object, to create a first code path, simultaneously injecting dematerializer code to create a second code path, by receiving a normal object reference, and transforming a code path with the normal object reference into the second code path using dematerialized object fields, and joining the first and second code paths together into a resultant code path that continues to use the dematerialized object.
8. The method of claim 7 , wherein one or more indirect null checks are used to preserve application behavior on null pointer exceptions.
9. The method of claim 8 , wherein the indirect null checks are implemented using nullness communicator variables.
10. The method of claim 9 , wherein the nullness communicator variables are implemented using single static assignment variables.
11. The method of claim 8 , wherein the compiler moves one or more indirect null checks into the code paths where the null checks would fail.
12. The method of claim 7 , wherein the compiler performs the steps of: detecting that an object is not explicitly escaping after it has been injected, verifying that read fields of the object are not volatile, determining that that all uses of the object join into a single code path, and that the code paths do not contain any synchronization points, verifying that the object is created locally or injected as a return value from another function or as an argument, injecting a runtime object dematerializer after each call containing nullness communicator variables for the object, inserting a null indicator before each use of fields in the object, checking if a null check move optimization can be applied, and performing an object dematerialization where a constructor is inlined and temporary variables are used for storage instead of the actual object.
13. A computer readable medium, including instructions stored thereon which when read and executed by a computer cause the computer to perform the steps comprising: running a virtual machine, for executing a software application, and further including a memory space or storage medium for storing byte code as part of the software application; and compiling the software application using a compiler, further comprising determining that an object is suitable for dematerialization, and, if the object is suitable for dematerialization, generating machine code that initializes fields of a dematerialized object, to create a first code path, simultaneously injecting dematerializer code to create a second code path, by receiving a normal object reference, and transforming a code path with the normal object reference into the second code path using dematerialized object fields, and joining the first and second code paths together into a resultant code path that continues to use the dematerialized object.
14. The computer readable medium of claim 13 , wherein one or more indirect null checks are used to preserve application behavior on null pointer exceptions.
15. The computer readable medium of claim 14 , wherein the indirect null checks are implemented using nullness communicator variables.
16. The computer readable medium of claim 15 , wherein the nullness communicator variables are implemented using single static assignment variables.
17. The computer readable medium of claim 14 , wherein the compiler moves one or more indirect null checks into the code paths where the null checks would fail.
18. The computer readable medium of claim 13 , wherein the compiler performs the steps of: detecting that an object is not explicitly escaping after it has been injected, verifying that read fields of the object are not volatile, determining that that all uses of the object join into a single code path, and that the code paths do not contain any synchronization points, verifying that the object is created locally or injected as a return value from another function or as an argument, injecting a runtime object dematerializer after each call containing nullness communicator variables for the object, inserting a null indicator before each use of fields in the object, checking if a null check move optimization can be applied, and performing an object dematerialization where a constructor is inlined and temporary variables are used for storage instead of the actual object.
19. The system of claim 1 , wherein the virtual machine is a Java virtual machine, and wherein the software application is a Java application.
20. The method of claim 7 , wherein the virtual machine is a Java virtual machine, and wherein the software application is a Java application.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
May 12, 2009
September 2, 2014
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.