Module dependency based incremental compiler and method
Abstract
A compiler and compiling method minimizes recompilation of a computer program after an edit. The program is organized in plural program units, such as modules. The units are each compiled through a sequence of compilation states, including plural intermediate compilation states. In compiling each of the program units, dependencies between units are recorded in a table. When an edit to a program unit is later attempted, the edited unit is decompiled to one of various intermediate compilation states according to the edit performed. Units dependent of the edited unit are decompiled to one of various intermediate compilation states according to the dependency of the dependent unit on the edited unit. When next compiling the program, the units are compiled from their respective intermediate compilation state. Units also can be saved in various intermediate compilation states to minimize compiling when the program is again loaded.
Claims
exact text as granted — not AI-modifiedWe claim:
1. A method for incrementally compiling a computer program organized as a plurality of modules, comprising the steps of: compiling the program a first time; compiling the program a second time after an edit is preformed to one of the module's source code, the edit affecting a dependency of a dependent module on the edited module; wherein the step of compiling the first time comprises compiling each of the modules through a sequence of compilation states, the sequence including at least an uncompiled state, a plurality of intermediate compilation states, and a complied state, the compilation states being associated with the modules; and wherein the step of compiling the second time comprises the steps of: decompiling the dependent module to one of the intermediate compilation states according to the type of the dependency affected by the edit; and compiling the dependent module to the coupled state from the intermediate compilation state.
2. The method of claim 1 wherein the step of compiling the first time comprises the step of: for the dependency of the first dependent module on the edited module, recording data in an entry of an import table indicative of the type of the dependency out of a plurality of dependency types, including dependency types relating to at least one of the dependent module's layout, frame, and code; and wherein the step of compiling the second time comprises the step of: detecting that the dependency of the dependent module recorded in the import table is affected by the edit.
3. The method of claim 2 wherein the step of compiling the first time comprises the step of: recording data in the import table entry indicative of an identify of the module on which the dependent module has the type of dependency.
4. The method of claim 3 wherein the step of compiling the first time comprises the step of: recording data in the import table entry indicative of an identity of a member of the module on which the dependent module has the type of dependency.
5. The method of claim 1 wherein, when the edit affects a layout type dependency of the dependent module on the edited module: the step of decompiling the dependent module to said intermediate state comprises decompiling the dependent module to an undeclared compilation state; and the step of compiling the dependent module to the complied state comprises compiling the dependent module form the undeclared compilation state.
6. The method of claim 1 wherein, when the edit affects a frame type dependency of the dependent module on the edited module: the step of decompiling the dependent module to said intermediate state comprises decompiling the dependent module to a declared compilation state; and the step of compiling the dependent module to the compiled state comprises compiling the dependent module from the declared compilation state.
7. The method of claim 1 wherein, when the edit affects a code type dependency of the dependent module on the edited module: the step of decompiling the dependent module to said intermediate state comprises decompiling the dependent module to a regenerate compilation state; and the steps of compiling the dependent module to the compiled state comprises compiling the dependent module form the regenerate compilation state.
8. The method of claim 1 comprising: where the edit affects a code type dependency of the dependent module on the edited module, the step of decompiling the dependent module to said intermediate state comprises decompiling the dependent module to a regenerate compilation state and the step of compiling the dependent module to the compiled state comprises compiling the dependent module from the regenerate compilation state; where the edit affects a frame type dependency of the dependent module on the edited module, the step of decompiling the dependent module to said intermediate state comprises decompiling the dependent module to a declared compilation state and the step of compiling the dependent module to the compiled state comprises compiling the dependent module from the declared compilation state, and wherein the edit affects a layout type dependency of the dependent module on the edited module, the step of decompiling the dependent module to said intermediate state comprises decompiling the dependent module to an undeclared compilation state and the step of compiling the dependent module to the compiled state comprises compiling the dependent module from the undeclared compilation state.
9. A computer program stored on a computer readable storage medium and having code for performing the method of claim 8 on a computer.
10. The method of claim 1 comprising: storing the dependent module in a first one out of the sequence of compilation states into a non-volatile storage between the steps of compiling the first time and compiling the second time; and wherein the step of compiling the second time comprises: decompiling the dependent module to one of the intermediate compilation state according to the type of the dependency upon loading the dependent module from the non-volatile storage.
11. A computer program stored on a computer readable storage medium and having code for performing the method of claim 10 on a computer.
12. A computer program stored on a computer readable storage medium and having code for performing the method of claim 1 on a computer.
13. A method for incrementally compiling a program having a plurality of modules and a statement in a first module which creates an intermodule dependency on a second module, the intermodule dependency having one of a plurality of dependency types, the method comprising: compiling the program through a sequence of compilation states into code executable on a computer, the sequence including a plurality of intermediate compilation states; performing an edit on the program affecting the intermodule dependency; decompiling the first module to one of the intermediate compilation states responsive to the type of the intermodule dependency; and compiling the first module from the intermediate compilation state.
14. The method of claim 13, comprising; recording data indicative of the intermodule dependency on the second module and its type in a table; and determining whether the edit to the second module affects the intermodule dependency of the first module from the data in the table.
15. A computer program stored on a computer readable storage medium and having code for performing the method of claim 13 on a computer.
16. A method of incrementally compiling source code, comprising: compiling the source code from one of more modules into executable code, a module having a layout, a frame, and code; editing the source code; for each module affected by the editing, decompiling the module to a first intermediate compilation state if the editing affected the module's layout; decompiling the module to a second intermediate compilation state if the editing affected the module's frame; decompiling the module to a third intermediate compilation state if the editing affected the module's code; and compiling the module from its respective intermediate compilation state.
17. A computer program stored on a computer readable storage medium and having code for performing the method of claim 16 on a computer.
18. A compiler for generating executable code of a program having a plurality of modules, comprising: an import table for storing data relating to dependencies between modules of the program; a layout generator for generating a layout of each of the modules to thereby compile the modules from a first compilation state to a second compilation state, the layout generator recording data in the import table relating to layout dependencies of the modules; a frame generator for generating procedure flames of each of the program's modules to thereby compile the modules from the second compilation state to a third compilation state, the frame generator recording data in the import table relating to frame dependencies of the modules; a code generator for generating executable code for each of the program's modules to thereby compile the modules from the third compilation state into a final state, the code generator recording data in the import table relating to code dependencies of the modules; a program editor for performing an edit to the program; and a decompiler for decompiling modules having a layout dependency affected by the edit to the first compilation state, for decompiling modules having a frame dependency affected by the edit to the second compilation state, and for decompiling modules having a code dependency affected by the edit to the third compilation state; the layout generator, frame generator, and code generator compiling those modules which are decompiled to the first compilation state, second compilation state, and third compilation state, respectively.
19. The compiler of claim 18 wherein the executable code generated by the code generator is virtual machine code, the compiler comprising: a virtual machine engine for executing the executable code of the modules generated by the code generator.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.