Generation of specialized methods based on generic methods and type parameterizations
First Claim
1. A non-transitory, computer-readable storage medium storing program instructions that when executed on a computing device cause the computing device to perform:
- passing a generic method and specialization metadata to a specialized method generator, wherein the specialization metadata comprises information identifying one or more program elements of the generic method to be adjusted when specializing the generic method for a particular type parameterization;
generating, by the specialized method generator in response to said passing, a specialized method based, at least in part, on the generic method and the specialization metadata, wherein the specialized method is a version of the generic method specialized for the particular type parameterization; and
storing, as a result of the specialized method being generated, a handle to the specialized method, such that the handle is usable to invoke the specialized method.
1 Assignment
0 Petitions
Accused Products
Abstract
Generic method specialization represents the ability to specialize generic methods over various types. When implementing generic method specialization an annotated class file may include a generic method declaration that is annotated with specialization metadata indicating elements of the generic method to be adjusted during specialization. The annotated method may be usable directly as an erased method implementation (e.g., to load the method when instantiated with reference types) and may also be usable as a template for specialization. When a generic method is being prepared for execution, such as when it is first invoked during runtime, a specialization method generator function may be used to specialize the generic method based on the specialization metadata in the generic method declaration. The specialization method generator function may use the annotated generic method declaration as a template for specialization.
58 Citations
20 Claims
-
1. A non-transitory, computer-readable storage medium storing program instructions that when executed on a computing device cause the computing device to perform:
-
passing a generic method and specialization metadata to a specialized method generator, wherein the specialization metadata comprises information identifying one or more program elements of the generic method to be adjusted when specializing the generic method for a particular type parameterization; generating, by the specialized method generator in response to said passing, a specialized method based, at least in part, on the generic method and the specialization metadata, wherein the specialized method is a version of the generic method specialized for the particular type parameterization; and storing, as a result of the specialized method being generated, a handle to the specialized method, such that the handle is usable to invoke the specialized method. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A method, comprising:
-
passing, by a platform-independent, object-oriented, runtime environment implemented on one or more computing devices comprising one or more hardware processors and memory, a generic method and specialization metadata to a specialized method generator of the platform-independent, object-oriented, runtime environment, wherein the specialization metadata comprises information identifying one or more program elements of the generic method to be adjusted when specializing the generic method for a particular type parameterization; generating, by the specialized method generator in response to said passing, a specialized method based, at least in part, on the generic method and the specialization metadata, wherein the specialized method is a version of the generic method specialized for the particular type parameterization; and storing, as a result of the specialized method being generated, a handle to the specialized method, such that the handle is usable to invoke the specialized method. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17, 18)
-
-
19. A non-transitory, computer-readable storage medium storing program instructions that when executed on a computing device cause the computing device to perform:
generating, by a compiler, a class file comprising a generic method declaration, wherein said generating comprises; applying a type erasure operation to a stream of instructions in the generic method declaration, wherein the stream of instructions is configured for execution by a virtualized runtime environment, and wherein the generic method declaration includes one or more type variables; wherein applying the type erasure operation comprises; creating an encoded form of a program element of the generic method declaration, wherein the encoded form of the program element comprises metadata specifying specialization information regarding the program element such that the encoded form can be specialized by the virtualized runtime environment according to a particular type parameterization; and including the encoded form of the program element in the class file, wherein the program element is usable by the virtualized runtime environment to load the program element without regard to the metadata being present in the encoded form. - View Dependent Claims (20)
Specification