Type inference optimization
AssigneeOracle International Corporation
InventorsMaurizio Cimadamore, Daniel Smith
Life of this patent
Estimating the term…
Abstract
Operations include (a) identifying bounds corresponding to two or more inference variables corresponding to a nested method invocation context, (b) determining that resolution of a first inference variable can be determined as a function of a resolution of a second inference variable, (c) propagating bounds corresponding to the second inference variable from the nested method invocation context to an outer method invocation context without propagating bounds corresponding to the first inference variable, (d) resolving a constraint set to resolve the second inference variable, and (e) resolving the first inference variable based on the resolution of the second inference variable.
Claims20
One or more non-transitory machine-readable media storing instructions which, when executed by one or more processors, cause:
- identifying one or more instructions:
- (a) to invoke a first method associated with a first set of one or more inputs comprising a first argument;
- (b) to invoke a second method associated with a second set of one or more inputs comprising a first return value from the first method;
- and
- (c) to invoke a third method associated with a third set of one or more inputs comprising a second return value from the second method;
- wherein the first method is nested within the second method, and the second method is nested within the third method;
- wherein a first bound for a first inference variable associated with the first method is determined based on a first requirement that a first type of the first return value be one of a subtype of or a same type as a second type of a first parameter of the second method;
- wherein a second bound for a second inference variable associated with the second method is determined based on a second requirement that a third type of the second return value be one of a subtype of or a same type as a fourth type of a second parameter of the third method;
- wherein a third inference variable associated with the third method is resolved into a particular type based on (a) only one of the first bound or the second bound and (b) zero or more other bounds;
- based on the one or more instructions:
- executing the first method, based at least on a first type resolved for the first inference variable, to obtain the first return value;
- executing the second method, based at least on a second type resolved for the second inference variable, to obtain the second return value;
- executing the third method, based at least on the particular type resolved for the third inference variable, to obtain a third return value.
A system, comprising:
- one or more devices including one or more hardware processors;
- and
- the system being configured to perform operations comprising:
- identifying one or more instructions:
- (a) to invoke a first method associated with a first set of one or more inputs comprising a first argument;
- (b) to invoke a second method associated with a second set of one or more inputs comprising a first return value from the first method;
- and
- (c) to invoke a third method associated with a third set of one or more inputs comprising a second return value from the second method;
- wherein the first method is nested within the second method, and the second method is nested within the third method;
- wherein a first bound for a first inference variable associated with the first method is determined based on a first requirement that a first type of the first return value be one of a subtype of or a same type as a second type of a first parameter of the second method;
- wherein a second bound for a second inference variable associated with the second method is determined based on a second requirement that a third type of the second return value be one of a subtype of or a same type as a fourth type of a second parameter of the third method;
- wherein a third inference variable associated with the third method is resolved into a particular type based on (a) only one of the first bound or the second bound and (b) zero or more other bounds;
- based on the one or more instructions:
- executing the first method, based at least on a first type resolved for the first inference variable, to obtain the first return value;
- executing the second method, based at least on a second type resolved for the second inference variable, to obtain the second return value;
- executing the third method, based at least on the particular type resolved for the third inference variable, to obtain a third return value.
A method, comprising:
- identifying one or more instructions:
- (a) to invoke a first method associated with a first set of one or more inputs comprising a first argument;
- (b) to invoke a second method associated with a second set of one or more inputs comprising a first return value from the first method;
- and
- (c) to invoke a third method associated with a third set of one or more inputs comprising a second return value from the second method;
- wherein the first method is nested within the second method, and the second method is nested within the third method;
- wherein a first bound for a first inference variable associated with the first method is determined based on a first requirement that a first type of the first return value be one of a subtype of or a same type as a second type of a first parameter of the second method;
- wherein a second bound for a second inference variable associated with the second method is determined based on a second requirement that a third type of the second return value be one of a subtype of or a same type as a fourth type of a second parameter of the third method;
- wherein a third inference variable associated with the third method is resolved into a particular type based on (a) only one of the first bound or the second bound and (b) zero or more other bounds;
- based on the one or more instructions:
- executing the first method, based at least a first type resolved for the first inference variable, to obtain the first return value;
- executing the second method, based at least on a second type resolved for the second inference variable, to obtain the second return value;
- executing the third method, based at least on the particular type resolved for the third inference variable, to obtain a third return value;
- wherein the method is executed by one or more devices including one or more hardware processors.
Dependencies are inferred from the claim text.