Immutable empty array, can be used to avoid repeated allocations.
Immutable empty IndexedSeq, can be used to avoid repeated allocations.
RType descriptors for predefined types used in AOTC-based interpreter.
All pre-defined types should be listed here.
All pre-defined types should be listed here. Note, NoType is not listed. Should be in sync with sigmastate.lang.Types.predefTypes.
Checks that the type of the value corresponds to the descriptor tpe
.
Checks that the type of the value corresponds to the descriptor tpe
.
If the value has complex structure only root type constructor is checked.
NOTE, this method is used in ErgoTree evaluation to systematically check that each
tree node evaluates to a value of the expected type.
Shallow runtime checks are enough if:
1) ErgoTree is well-typed, i.e. each sub-expression has correct types (agree with
the argument type).
2) isValueOfType == true
for each tree leaf
3) isValueOfType == true
for each sub-expression
type descriptor to check value against
true if the given value
is of type tpe
Named type variables and parameters used in generic types and method signatures.
Named type variables and parameters used in generic types and method signatures.
Generic type terms like (Coll[IV],(IV) => Boolean) => Boolean
are used to represent
method types of Coll
and
Option
in the example above) STypeVar instances
are used. types. Each such type is an instance of SFunc.
To represent variables (such as
IV
Generic types are not supported by ErgoTree serialization format and STypeVars are used internally and never serialized (there is no serializer for STypeVar). Thus the usage of type variables is limited.
All necessary type variables can be declared in advance and reused across all code base. This allows to avoid allocation of many duplicates and also improve performance of SType values.
Costructs a collection type with the given type of elements.
A mapping of object types supporting MethodCall operations.
A mapping of object types supporting MethodCall operations. For each serialized typeId this map contains a companion object which can be used to access the list of corresponding methods.
NOTE: in the current implementation only monomorphic methods are supported (without type parameters)
NOTE2: in v3.x SNumericType.typeId is silently shadowed by SGlobal.typeId as part of
toMap
operation. As a result, the methods collected into SByte.methods cannot be
resolved (using SMethod.fromIds()) for all numeric types (SByte, SShort, SInt,
SLong, SBigInt). See the corresponding regression property("MethodCall on numerics")
.
However, this "shadowing" is not a problem since all casting methods are implemented
via Downcast, Upcast opcodes and the remaining toBytes
, toBits
methods are not
implemented at all.
In order to allow MethodCalls on numeric types in future versions the SNumericType.typeId
should be changed and SGlobal.typeId should be preserved. The regression tests in
property("MethodCall Codes")
should pass.