Skip to content

gmscTypeInferenceClass

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.


Prototype

int TypeInference_HostFile = 0

The TypeInference_HostFile field specifies the offset of current file information.


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:

ParameterDescription
iCallspecifies 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.
subRootspecifies the root offset of the component whose code is being modified.
icodespecifies 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.
castTypespecifies type of the array cast.
rankspecifies the rank of the array cast.

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


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:

ParameterDescription
iCallspecifies 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.
subRootspecifies the root offset of the component whose code is being modified.
icodespecifies 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.
typeOperspecifies the opcode to be used to cast the type.
castTypespecifies subcode value which is the output type of the operation.
castOperspecifies 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.


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:

ParameterDescription
iCallspecifies 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,“
subRootspecifies the root offset of the component whose code is being modified.
icodespecifies 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.
conversionspecifies 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.


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:

ParameterDescription
iCallspecifies 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,“.
varVasespecifies the root offset of the component that is to be made ObjectOnly.
typespecifies the low level type to be assigned to the component. THis is normally
TYP_VARIANT or TYP_OBJECT.


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:

ParameterDescription
iCallspecifies 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,“.
varVasespecifies the root offset of the component whose context flags are being changed.
newFlagsspecifies the new context flags.
subRootspecifies the root offset of the component whose code is causing the context
change.
iNewspecifies 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.


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:

ParameterDescription
iCallspecifies 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,“.
varVasespecifies the root offset of the component whose binany type is being changed.
newTypespecifies the new binary type. A negative type indicates that any FixedType
attribute associated with the quantity should be ignored.
referTypespecifies the reference of than new binary type or zerot if there is no
associated reference.
subRootspecifies the root offset of the component whose code is causing the type change.
iNewspecifies the offset of the last NEW operation found before the decision to do
the type change, if greater than zero.