Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: 1000
-
Component/s: Compiler: Optimizing
-
Labels:None
-
Number of attachments :
Description
We currently define Operand.copy to return an Operand, if we instead changed the declaration of Operand to:
class Operand<T extends Operand<T>>
or:
class Operand<T extends Operand<?>>
then we can define copy to return T. This would mean, for example, in RegisterOperand we could define copy as:
class RegisterOperand extends Operand<RegisterOperand> { ...
RegisterOperand copy()
We often copy and have to cast so that instructions have unique operands and that the operand is of the correct type. To try to make the matter more elegant we currently have methods like copyRO and asRegister, but generic types appear to make this unnecessary and a little bit more graceful.