Lazy compilation of template-generated classes in dynamic...

Data processing: software development – installation – and managem – Software program development tool – Translation of code

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C717S136000, C717S140000, C717S153000

Reexamination Certificate

active

06760905

ABSTRACT:

BACKGROUND OF THE INVENTION
Compilers typically convert source code into object code or some other intermediate code representation, such as byte codes. Source code is a set of instructions written in a programming language by a software developer. Object code, in general, is machine code or other low level code, translated from source code toward execution by a system's central processing unit (CPU). Compilation of source code can occur either statically or dynamically.
Statically compiled programs are compiled once and the resulting binary object code is used repeatedly. Typically, static compilation occurs prior to shipping the program to the end user. Therefore, the time required to compile a program in static compilation environments does not effect the performance of the program when executed by the end user.
Dynamic compilation execution environments, such as web browsers, involve the compilation of source code simultaneously or time-sharing with the execution of a program. Dynamic compilation is advantageous because code is shipped in a platform independent form and the compilation can use information about the target machine and security environment. However, the time required to dynamically compile the source code directly impacts the speed of the program execution.
Programming and scripting languages provide the software developer with a set of features and tools for organizing source code within a program. Class templates and classes generated from class templates (hereinafter template-generated classes) are examples of tools provided by some programming and scripting languages within static compilation environments.
In object-oriented programming, a class is a descriptive tool used in source code for characterizing an object as a set of data structures (i.e. fields) or a set of routines (i.e. methods). For example, an array of integers can be represented in a class, IntegerArray. Such a class may include a field for storing the size of the array and another field comprising a data structure for representing the integers stored in an IntegerArray. In addition, the IntegerArray class may include methods for accessing the contents of the array, such as “get” and “set” methods.
Once compiled, the class is represented as an object defining storage allocation for the class fields and specifying the types of data that can be stored within them. In addition, the class object provides access to executable object code for executing class methods. Instances of a class are generated from this class representation.
An instance is an object that exists during program execution that functions in accordance with the guidelines specified by the class representation. An instance stores its own values in the storage allocated for the class fields and executes methods compiled and stored by the class representation. An instance is created when a class is instantiated during program execution. Instantiation is the process of creating an instance of a class, typically, by calling a special operator or function (e.g., “new { }”).
Class templates are useful programming tools for generating classes that provide the same basic functionality, but differ with respect to the types of data that are stored and serviced within the class.
FIG. 1
is a block diagram illustrating an object hierarchy involving class templates. A class template
10
generates class
30
which is used to declare and instantiate class instances
50
a
and
50
b
. Likewise, class template
10
generates class
35
which is used to declare and instantiate class instances
55
a
and
55
b.
A class template has source code forming the foundation for new template-generated classes. Different template-generated classes can be generated from the same class template definition by specifying different parameters. A parameter can be a primitive data type, class, value, or other data structure. Therefore, the use of class templates facilitates the reuse of source code.
The use of class templates also leads to more robust software, because such template-generated classes can be type-checked when compiled. In addition, the use of class templates in generating classes leads to faster software, because the compiler can generate efficient code with the knowledge of the parameters defining such classes.
SUMMARY OF THE INVENTION
Using static compilation techniques for dynamically compiling a software program would be slow and inefficient. For example, compiling an entire program may be wasteful of both time and memory when some portions of a program, such as an error handling routine, may not be used.
With respect to template-generated classes, the unnecessary object code results, is in part, from compiling source code that defines the body of class methods that are never invoked during program execution. In addition, unnecessary object code results from the generation of method bindings for class methods that are never referenced in the program code. A method binding is an object that stores information about an individual class method and is used to compile instructions in the program code that reference that method. Program code is the source code for the program in general.
The excess object code results in the program requiring more space on disk and, possibly, more memory (i.e. RAM) during program execution. When a program is statically compiled, the extra compilation time is tolerated because performance, in general, is not effected during program execution. However, in dynamic compilation execution environments, the program code is compiled at execution time so that extra compilation time makes the program run more slowly. Therefore, static compilation techniques implemented to compile template-generated classes would be prohibitive in both memory use and program performance.
The Java programming language is used, in part, to develop applets (i.e. programs that only execute within dynamic compilation execution environments, such as a web browser), but does not support class templates in its current language specification. Instead a Java programmer can use the class, Object, to store different data types, values, or structures. However, a disadvantage of using the Object class is that a Java compiler can not perform type-checking on Object-based classes until the program is running. This makes the software less robust, because any type errors are detected only at runtime by a runtime type dispatch.
There is a current proposal to add class templates to the Java programming language. However, the current proposal restricts the usage of parameters within the source code definition of a class template, limiting some of its benefits.
Therefore, it would be useful to be able to compile template-generated classes obtaining the full benefits of class templates without the issues of excess code generation and compilation time in dynamic compilation execution environments.
The following description discloses embodiments of the invention providing lazy compilation of template-generated classes in dynamic compilation execution environments. One embodiment involves creating a representation of the class template, creating a representation of a class generated from the class template, and generating method bindings, stored in the class representation, for only those methods referenced in the program code. This process of generating method bindings for referenced methods decreases the amount of code generated in compiling such classes and decreases the amount of time required to perform the compilation.
In addition, lazy compilation may include delaying compilation of the body of a referenced method until the class method is invoked by the execution of a method call instruction. Embodiments of the invention which provide for the compilation of a method body include execution of stub code initially referenced through an indexed method table for the invoked method. This action occurs in response to the class method being invoked to an instance of a template-generated class. The stub code initiates the compilation of the body of

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Lazy compilation of template-generated classes in dynamic... does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Lazy compilation of template-generated classes in dynamic..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Lazy compilation of template-generated classes in dynamic... will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3225643

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.