The disclosed system represents an improvement over conventional systems for initializing static arrays by reducing the amount of code executed by the virtual machine to statically initialize an array. To realize this reduction, when consolidating class files, the preloader identifies all <clinit> methods and play executes these methods to determine the static initialization performed by them. The preloader then creates an expression indicating the static initialization performed by the <clinit> method and stores this expression in the .mclass file, replacing the <clinit> method. As such, the code of the <clinit> method, containing many instructions, is replaced by a single expression instructing the virtual machine to perform static initialization, thus saving a significant amount of memory. The virtual machine is modified to recognize this expression and perform the appropriate static initialization of an array. |
Citations|
| US5361350 | Dec 12, 1991 | Nov 1, 1994 | International Business Machines Corporation | Object oriented method management system and software for managing class method names in a computer system | | US5367685 | Dec 22, 1992 | Nov 22, 1994 | FirstPerson, Inc. | Method and apparatus for resolving data references in generated code | | US5421016 | Dec 12, 1991 | May 30, 1995 | International Business Machines Corporation | System and method for dynamically invoking object methods from an application designed for static method invocation | | US5437025 | Jan 26, 1993 | Jul 25, 1995 | International Business Machines Corporation | System and method for run time configuration of objects in an object oriented computing environment | | US5615400 | Jun 30, 1993 | Mar 25, 1997 | Apple Computer, Inc. | System for object oriented dynamic linking based upon a catalog of registered function set or class identifiers | | US5668999 | Dec 20, 1994 | Sep 16, 1997 | Sun Microsystems, Inc. | System and method for pre-verification of stack usage in bytecode program loops | | US5812828 | Apr 24, 1997 | Sep 22, 1998 | Centerline Software, Inc. | Function simulation | | US5815718 | May 30, 1996 | Sep 29, 1998 | Sun Microsystems, Inc. | Method and system for loading classes in read-only memory | | US5903899 | Apr 23, 1997 | May 11, 1999 | Sun Microsystems, Inc. | System and method for assisting exact Garbage collection by segregating the contents of a stack into sub stacks | | US5966702 | Oct 31, 1997 | Oct 12, 1999 | Sun Microsystems, Inc. | Method and apparatus for pre-processing and packaging class files | | US5999732 | Mar 23, 1998 | Dec 7, 1999 | Sun Microsystems, Inc. | Techniques for reducing the cost of dynamic class initialization checks in compiled code | | US6003038 | Mar 31, 1997 | Dec 14, 1999 | Sun Microsystems, Inc. | Object-oriented processor architecture and operating method |
Referenced by|
| US6339841 | Apr 16, 1999 | Jan 15, 2002 | International Business Machines Corporation | Class loading model | | US6658492 | Mar 20, 1998 | Dec 2, 2003 | Sun Microsystems, Inc. | System and method for reducing the footprint of preloaded classes | | US6760019 | Jun 1, 2000 | Jul 6, 2004 | Sun Microsystems, Inc. | Methods and apparatus for facilitating the sharing of computer graphics operations | | US6813762 | Feb 22, 2000 | Nov 2, 2004 | Freescale Semiconductor, Inc. | Method for processing program files in a programming language capable of dynamic loading | | US6832369 | Aug 1, 2000 | Dec 14, 2004 | International Business Machines Corporation | Object oriented method and apparatus for class variable initialization | | US6915508 | Apr 24, 2001 | Jul 5, 2005 | Sun Microsystems, Inc. | Method and apparatus for eliminating C recursion from a Java™ bytecode interpreter | | US6978448 | Apr 24, 2001 | Dec 20, 2005 | Sun Microsystems, Inc. | Method and apparatus for rewriting bytecodes to minimize runtime checks | | US7024657 | Feb 20, 2001 | Apr 4, 2006 | Matsushita Electric Industrial Co., Ltd. | Program generation apparatus for program execution system, replaces variable name in each class file by assigned offset number so that same offset numbers are assigned to non-dependent variables with same variable name | | US7051323 | Oct 8, 2002 | May 23, 2006 | SUN Microsystems, Inc. | Method and apparatus for initializing romized system classes at virtual machine build time | | US7055133 | Apr 12, 2005 | May 30, 2006 | Sun Microsystems, Inc. | Method and apparatus for eliminating C recursion from a Java programming language bytecode interpreter | | US7197750 | Jun 28, 2001 | Mar 27, 2007 | Sun Microsystems, Inc. | Java Bytecode instruction for determining hashcode values | | US7222336 | Sep 20, 2002 | May 22, 2007 | NXP B.V. | Method of compiling bytecode to native code | | US7272827 | Apr 3, 2002 | Sep 18, 2007 | International Business Machines Corporation | Statically detecting externally referenced interfaces of a program | | US7434212 | Jul 1, 2004 | Oct 7, 2008 | International Business Machines Corporation | Method and apparatus to guarantee type and initialization safety in multithreaded programs | | US7450631 | Oct 26, 2001 | Nov 11, 2008 | Intel Corporation | Metric correction for multi user detection, for long codes DS-CDMA | | US7493616 | May 30, 2002 | Feb 17, 2009 | Research In Motion Limited | Mobile communication device application processing system | | US8099729 | Jun 5, 2006 | Jan 17, 2012 | Freescale Semiconductor, Inc. | Method and device for creating and using pre-internalized program files |
Claims1. A method in a data processing system for statically initializing an array, comprising the steps of: - compiling source code containing the array with static values to generate a class file with a clinit method containing byte codes to statically initialize the array to the static values;
- receiving the class file into a preloader;
- simulating execution of the byte codes of the clinit method against a memory without executing the byte codes to identify the static initialization of the array by the preloader;
- storing into an output file an instruction requesting the static initialization of the array; and
- interpreting the instruction by a virtual machine to perform the static initialization of the array.
2. The method of claim 1 wherein the storing step includes step of: - storing a constant pool entry into the constant pool.
3. The method of claim 1 wherein the play executing step includes the steps of: - allocating a stack;
- reading a byte code from the clinit method that manipulates the stack; and
- performing the stack manipulation on the allocated stack.
4. The method of claim 1 wherein the play executing step includes the steps of: - allocating variables;
- reading a byte code from the clinit method that manipulates local variables of the clinit method; and
- performing the manipulation of the local variables on the allocated variables.
5. The method of claim 1 wherein the play executing step includes the steps of: - obtaining a reference to a constant pool of the clinit method;
- reading a byte code from the clinit method that manipulates the constant pool; and
- performing the constant pool manipulation.
6. A method in a data processing system, comprising the steps of: - receiving code to be run on a processing component to perform an operation;
- play executing the code without running the code on the processing component to identify the operation if the code were run by the processing component; and
- creating an instruction for the processing component to perform the operation.
7. The method of claim 6 wherein the operation initializes a data structure, and wherein the play executing step includes the step of: - play executing the code to identify the initialization of the data structure.
8. The method of claim 6 wherein the operation statically initializes an array and wherein the play executing step includes the step of: - play executing the code to identify the static initialization of the array.
9. The method of claim 6 further including the step of: - running the created instruction on the processing component to perform the operation.
10. The method of claim 6 further including the step of: - interpreting the created instruction by a virtual machine to perform the operation.
11. The method of claim 6 wherein the operation has an effect on memory, and wherein the play executing step includes the step of: - play executing the code to identify the effect on the memory.
12. A data processing system comprising: - a storage device containing:
- a program with source code that statically initializes a data structure; and
- class files, wherein one of the class files contains a clinit method that statically initializes the data structure;
- a memory containing:
- a compiler for compiling the program and generating the class files; and
- a preloader for consolidating the class files, for play executing the clinit method to determine the static initialization the clinit method performs, and for creating an instruction to perform the static initialization; and
- a processor for running the compiler and the preloader.
13. The data processing system of claim 12 wherein the preloader includes a mechanism for generating an output file containing the created instruction. 14. The data processing system of claim 13 wherein the memory further includes a virtual machine that interprets the created instruction to perform the static initialization. 15. The data processing system of claim 12, wherein the data structure is an array. 16. The data processing system of claim 12 wherein the clinit method has byte codes that statically initialize the data structure. 17. The data processing system of claim 12 wherein the created instruction includes an entry into a constant pool. 18. A computer-readable medium containing instructions for controlling a data processing system to perform a method, comprising the steps of: - receiving code to be run on a processing component to perform an operation;
- simulating execution of the code without running the code on the processing component to identify the operation if the code were run by the processing component; and
- creating an instruction for the processing component to perform the operation.
19. The computer-readable medium of claim 18 wherein the operation initializes a data structure, and wherein the simulating step includes the step of: - simulating execution of the code to identify the initialization of the data structure.
20. The computer-readable medium of claim 18 wherein the operation statically initializes an array and wherein the simulating step includes the step of: - simulating execution of the code to identify the static initialization of the array.
21. The computer-readable medium of claim 18 further including the step of: - running the created instruction on the processing component to perform the operation.
22. The computer-readable medium of claim 18 further including the step of: - interpreting the created instruction by a virtual machine to perform the operation.
23. The computer-readable medium of claim 18 wherein the operation has an effect on memory, and wherein the simulating step includes the step of: - simulating execution of the code to identify the effect on the memory.
|