Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The TypeInference Service Class

The service class TypeInference contains methods related to the type inference operations made during migrations. There are two types of operations performed in this context -- first, the actual changing of a components binary types or context flags and second, the insertion of a conversion operator into the code to compenstate for a type or status mismatch. Though currently incomplete the eventual goal of this class is not only to reform the indicated operations but also to record those operations for later analysis.

The field TypeInference_HostFile

Prototype


 int TypeInference_HostFile = 0
The TypeInference_HostFile field specifies the offset of current file information.

The method TypeInference_ArrayCast

Prototype


 int TypeInference_ArrayCast(int iCall,int subRoot,int icode,int castType,int rank)
The TypeInference_ArrayCast method inserts a simple object case within a cast to a one or two dimensional array of a certain type expanding the code by the number of bytes needed. In addition, if the select flag TraceChanges is on then information about the insertion is recorded for later review. This method actually inserts two different semantic operations into the code -- a cast that changes the representation of a primitive value and a box that asserts that a certain reference has a specified type. Its parameters are as follows:

Parameter Description
iCall specifies a unique number relative to this method defining which at which particular point in the migration process it was called. Though these are magic numbers, a particular call n can be located by searching for "TypeInference_ArrayCast(n," in the code.
subRoot specifies the root offset of the component whose code is being modified.
icode specifies the offset in the code block at which operation is to be inserted. In some cases the calling method has already allocated the space for the operation. In this case a negative icode value is passed.
castType specifies type of the array cast.
rank specifies the rank of the array cast.

The method returns the number of bytes the the code block was expanded by.

The method TypeInference_InsertCast

Prototype


 int TypeInference_InsertCast(int iCall,int subRoot,int icode,int typeOper,int castType,int castOper);
The TypeInference_InsertCast method inserts a type specification operation followed by a CNV operation into the current code block by expanding the code by the number of bytes needed. In addition, if the select flag TraceChanges is on then information about the insertion is recorded for later review. This method actually inserts two different semantic operations into the code -- a cast that changes the representation of a primitive value and a box that asserts that a certain reference has a specified type. Its parameters are as follows:

Parameter Description
iCall specifies a unique number relative to this method defining which at which particular point in the migration process it was called. Though these are magic numbers, a particular call n can be located by searching for "TypeInference_InsertCast(n," in the code.
subRoot specifies the root offset of the component whose code is being modified.
icode specifies the offset in the code block at which operation is to be inserted. In some cases the calling method has already allocated the space for the operation. In this case a negative icode value is passed.
typeOper specifies the opcode to be used to cast the type.
castType specifies subcode value which is the output type of the operation.
castOper specifies the CNV subcode to be used to form the final operation.

The method returns the number of bytes the the code block was expanded by.

The method TypeInference_InsertConversion

Prototype


 int TypeInference_InsertConversion(int iCall,int subRoot,int icode, int conversion)
The TypeInference_InsertConversion method inserts an CNV operation into the current code block by expanding the code by the number of bytes needed. In addition, if the select flag TraceChanges is on then information about the insertion is recorded for later review. This method has the fopllowing parameters:

Parameter Description
iCall specifies a unique number relative to this method defining which at which particular point in the migration process it was called. Though these are magic numbers, a particular call n can be located by searching for "TypeInference_InsertConversion(n,"
subRoot specifies the root offset of the component whose code is being modified.
icode specifies the offset in the code block at which operation is to be inserted. In some cases the calling method has already allocated the space for the operation. In this case a negative icode value is passed.
conversion specifies the CNV subcode to be used to form the final operation.

The method returns the number of bytes the the code block was expanded by.


The method TypeInference_ObjectOnly

Prototype


 void TypeInference_ObjectOnly(int iCall,int varBase,int type)
The TypeInference_ObjectOnly method marks a component to be 'ObjectOnly' -- i.e. specifies that the type of the component should not be strengthened. In addition, if the select flag TraceChanges is on then information about the change is recorded for later review. Its parameters are as follows:

Parameter Description
iCall specifies a unique number relative to this method defining which at which particular point in the migration process it was called. Though these are magic numbers, a particular call n can be located by searching for "TypeInference_ObjectOnly(n,".
varVase specifies the root offset of the component that is to be made ObjectOnly.
type specifies the low level type to be assigned to the component. THis is normally TYP_VARIANT or TYP_OBJECT.


The method TypeInference_QuantityContext

Prototype


 void TypeInference_QuantityContext(int iCall,int varBase,int newFlags,int subRoot,int iNew)
The TypeInference_QuantityContext method changes the context flags of a component. In addition, if the select flag TraceChanges is on then information about the change is recorded for later review. Its parameters are as follows:

Parameter Description
iCall specifies a unique number relative to this method defining which at which particular point in the migration process it was called. Though these are magic numbers, a particular call n can be located by searching for "TypeInference_QuantityContext(n,".
varVase specifies the root offset of the component whose context flags are being changed.
newFlags specifies the new context flags.
subRoot specifies the root offset of the component whose code is causing the context change.
iNew specifies the offset of the last NEW operation found before the decision to do the change, if greater than zero. It is used to get the line number of the statement that caused the change.


The method TypeInference_QuantityType

Prototype


 void TypeInference_QuantityType(int iCall,int varBase,int newType,int referType,int subRoot,int iNew)
The TypeInference_QuantityType method changes the binary type of a component and marks it as having an inferred type. In addition, if the select flag TraceChanges is on then information about the type change is recorded for later review. Its parameters are as follows:

Parameter Description
iCall specifies a unique number relative to this method defining which at which particular point in the migration process it was called. Though these are magic numbers, a particular call n can be located by searching for "TypeInference_QuantityType(n,".
varVase specifies the root offset of the component whose binany type is being changed.
newType specifies the new binary type. A negative type indicates that any FixedType attribute associated with the quantity should be ignored.
referType specifies the reference of than new binary type or zerot if there is no associated reference.
subRoot specifies the root offset of the component whose code is causing the type change.
iNew specifies the offset of the last NEW operation found before the decision to do the type change, if greater than zero.


Table of Contents

  • No labels