The present invention relates to object-based programming environments, and more specifically, to techniques to address dispatch speed when dealing with reified generics.
A number of new programming languages have been developed by commercial companies. Some of these languages include Fortress, Chapel, and X10. When these languages are designed to use the resources of existing languages, productivity is improved and past investment is more effectively utilized. One of these existing languages is Java, for example, and developers of many of the new programming languages strive to ensure compatibility with Java.
One of the important things that allow compatibility of new programming languages with existing languages, such as Java, is the use of generics of existing languages. Two types of generics are erased generics, in which the value of the type parameter is not available at runtime, and reified generics, in which the value of the type parameter is available at runtime. Two implementation techniques for reified generics are the type specialization technique, which generates a non-generic type for each different instantiation of a generic type, and the type lifting technique, which represents the value of the type parameter as a type descriptor.
When using the type lifting technique, a method (dispatch method) is invoked with particular type descriptor objects, and the dispatch method then calls the actual method that corresponds to the type descriptor objects in a technique called self dispatching. A dispatch method corresponds to multiple original methods with different return types. Thus, the return type of a dispatch method is a reference type. Consequently, primitives are converted to objects (boxed) in the callee and are restored to primitives (unboxed) in the caller. This boxing/unboxing creates an overhead cost with respect to execution time and memory usage. As a result, efficient self dispatching would be appreciated in programming languages.
USPTO Backgrounds
USPTO Backgrounds