Method and apparatus for loading classes and re-organizing class archives
First Claim
Patent Images
1. A method for loading a class to a virtual machine, comprising:
- separating, using a separator module, each of a plurality of classes of a class archive into a skeleton, contents, and an index file having references to the contents associated with the skeleton of each class;
organizing the class archive before class loading such that the organized class archive includes a class contraction portion and a rest portion, wherein the class contraction portion comprises a plurality of skeletons, one skeleton for each class, and the rest portion comprises a plurality of contents, one content for each corresponding skeleton;
verifying a security of the class archive using a security verification module, wherein verification comprises loading and carrying out verification of a plurality of symbolic references except a verification of bytecodes on a loaded skeleton;
loading only the class contraction portion of the class archive to the virtual machine using a load tracker;
wherein the class contraction portion comprises only a basic class information portion of each of the plurality of classes in the class archive and the rest portion comprises a detailed class information portion of each of the plurality of classes that is not included in the class contraction portion, andwherein the basic class information consists of a magic code, a major version number, a minor version number, a count of constants, a constant pool and access flags and wherein the detailed class information comprises variables, methods and attributes and counts thereof;
executing a program using the class archive at the virtual machine;
loading, during runtime using a load tracker, a plurality of needed contents not loaded prior to executing the program;
recording class usage information at runtime using a run recorder, wherein the class usage information comprises one or more of a miss rate of skeletons or contents, missed skeletons or contents and a non-usage rate of skeletons or contents, the missed skeletons or contents being recorded in a first-in first-out manner using a storage space with a fixed size; and
optimizing the class archive by removing a plurality of unused skeletons during runtime from the class contraction portion of the class archive, and adding a plurality of contents loaded during runtime to the class contraction portion of the class archive.
1 Assignment
0 Petitions
Accused Products
Abstract
A method and apparatus for loading classes to virtual machines and a method and apparatus for reorganizing class archives. The method for loading a class to a virtual machine includes organizing a class archive before class loading such that the organized class archive includes a class contraction portion and loading only the class contraction portion of the class archive to the virtual machine at the moment of class loading. By first loading the class contraction portion from the organized class archive to the virtual machine at the moment of loading, the present invention curtails code redundancy, shortens loading time and reduces occupied memory resources.
-
Citations
15 Claims
-
1. A method for loading a class to a virtual machine, comprising:
-
separating, using a separator module, each of a plurality of classes of a class archive into a skeleton, contents, and an index file having references to the contents associated with the skeleton of each class; organizing the class archive before class loading such that the organized class archive includes a class contraction portion and a rest portion, wherein the class contraction portion comprises a plurality of skeletons, one skeleton for each class, and the rest portion comprises a plurality of contents, one content for each corresponding skeleton; verifying a security of the class archive using a security verification module, wherein verification comprises loading and carrying out verification of a plurality of symbolic references except a verification of bytecodes on a loaded skeleton; loading only the class contraction portion of the class archive to the virtual machine using a load tracker; wherein the class contraction portion comprises only a basic class information portion of each of the plurality of classes in the class archive and the rest portion comprises a detailed class information portion of each of the plurality of classes that is not included in the class contraction portion, and wherein the basic class information consists of a magic code, a major version number, a minor version number, a count of constants, a constant pool and access flags and wherein the detailed class information comprises variables, methods and attributes and counts thereof; executing a program using the class archive at the virtual machine; loading, during runtime using a load tracker, a plurality of needed contents not loaded prior to executing the program; recording class usage information at runtime using a run recorder, wherein the class usage information comprises one or more of a miss rate of skeletons or contents, missed skeletons or contents and a non-usage rate of skeletons or contents, the missed skeletons or contents being recorded in a first-in first-out manner using a storage space with a fixed size; and optimizing the class archive by removing a plurality of unused skeletons during runtime from the class contraction portion of the class archive, and adding a plurality of contents loaded during runtime to the class contraction portion of the class archive. - View Dependent Claims (2, 3, 4, 5)
-
-
6. An apparatus for loading a class into a memory of a virtual machine, comprising:
-
a class loader having a load tracker configured to record a loading sequence of the class; a class archive comprising a plurality of classes and each of the plurality of classes having a class contraction portion, a rest portion; wherein the class archive is organized before class loading such that the organized class archive includes the class contraction portion of the class archive; wherein the class loader is configured to load only the class contraction portion of the class archive to the virtual machine; a separator module configured to separate each of the plurality of classes of the class archive into a skeleton, contents, and an index file, wherein the class contraction portion comprises a plurality of skeletons, one skeleton for each class, the rest portion comprises a plurality of contents, one content for each corresponding skeleton, and the index file comprises references to the rest portion associated with the skeleton portion of each class; a security verification module configured to verify a security of the class archive, wherein verification comprises loading and carrying out verification of a plurality of symbolic references except a verification of bytecodes on a loaded skeleton; wherein the class contraction portion comprises only a basic class information portion of each of the plurality of classes in the class archive and the rest portion comprises a detailed class information portion of each of the plurality of classes that is not included in the class contraction portion, wherein the basic class information consists of a magic code, a major version number, a minor version number, a count of constants, a constant pool and access flags and wherein the detailed class information comprises variables, methods and attributes and counts thereof; and a run recorder configured to record class usage information at runtime, wherein the class usage information comprises one or more of a miss rate of skeletons or contents, missed skeletons or contents and a non-usage rate of skeletons or contents, the missed skeletons or contents being recorded in a first-in first-out manner using a storage space with a fixed size; and a processor configured to optimize the class archive by removing a plurality of unused skeletons during runtime from the class contraction portion of the class archive, and adding a plurality of contents loaded during runtime to the class contraction portion of the class archive. - View Dependent Claims (7, 8, 9, 10)
-
-
11. A method for reorganizing a class archive comprising a plurality of classes, comprising:
-
separating, using a separator module, each of the plurality of classes of the class archive into a skeleton, contents, and an index file having references to the contents associated with the skeleton of each class; organizing the class archive before class loading such that the organized class archive includes a class contraction portion and a rest portion, wherein the class contraction portion comprises a plurality of skeletons, one skeleton for each class and the rest portion comprises a plurality of contents, one content for each corresponding skeleton; verifying a security of the class archive using a security verification module, wherein verification comprises loading and carrying out verification of a plurality of symbolic references except a verification of bytecodes on a loaded skeleton; loading only the class contraction portion of the class archive to a virtual machine using a load tracker; wherein the class contraction portion comprises only a basic class information portion of each of the plurality of classes in the class archive and the rest portion comprises a detailed class information portion of each of the plurality of classes that is not included in the class contraction portion, wherein the basic class information consists of a magic code, a major version number, a minor version number, a count of constants, a constant pool and access flags and wherein the detailed class information comprises variables, methods and attributes and counts thereof; executing a program using the class archive at the virtual machine; loading, during runtime using the load tracker, a plurality of needed contents not loaded prior to executing the program; recording class usage information at runtime using a run recorder, wherein the class usage information comprises one or more of a miss rate of skeletons or contents, missed skeletons or contents and a non-usage rate of skeletons or contents, the missed skeletons or contents being recorded in a first-in first-out manner using a storage space with a fixed size; and optimizing the class archive by removing a plurality of unused skeletons during runtime from the class contraction portion of the class archive, and adding a plurality of contents loaded during runtime to the class contraction portion of the class archive. - View Dependent Claims (12, 13, 14, 15)
-
Specification