Serializer Operation
A SerializerOpcode describes how to disassemble and assemble the various kinds of objects encountered in Avail.
The ordinal is passed in the constructor as a cross-check, to increase the difficulty of (accidentally) changing the serialized representation without due care for migration of existing serialized data.
Author
Mark van Gulik
Parameters
Whether, during serialization, this operation should record the provided object as a value to capture for use in pumping other serializers and deserializers.
The ordinal of this enum value, supplied as a cross-check to reduce the chance of accidental incompatibility due to the addition of new categories of Avail objects.
The list of operands that describe the interpretation of a stream of bytes written with this SerializerOperation.
Entries
The Avail integer 0. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 1. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 2. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 3. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 4. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 5. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 6. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 7. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 8. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 9. Note that there are no operands, since the value is encoded in the choice of instruction itself.
The Avail integer 10. Note that there are no operands, since the value is encoded in the choice of instruction itself.
An Avail integer in the range 11..255. Note that 0..10 have their own special cases already which require very little space.
An Avail integer in the range 256..65535. Note that 0..255 have their own special cases already which require less space. Don't try to compress the short value for this reason.
An Avail integer in the range -231 through 2^31-1, except the range 0..65535 which have their own special cases already.
An Avail integer that cannot be represented as an Int.
This special opcode causes a previously built object to be produced as an actual checkpoint output from the Deserializer.
One of the special objects that the AvailRuntime maintains.
One of the special atoms that the AvailRuntime maintains.
A character whose code point fits in an unsigned byte (0..255).
A character whose code point requires an unsigned short (256..65535).
A character whose code point requires three bytes to represent (0..16777215, but technically only 0..1114111).
A tuple of arbitrary objects. Write the size of the tuple then the elements as object identifiers.
A tuple of characters with code points in Latin-1. Write the size of the tuple then the sequence of character bytes.
A tuple of characters whose code points all fall in the range 0..65535. Write the compressed number of characters then each compressed character.
A tuple of characters with arbitrary code points. Write the compressed number of characters then each compressed character.
A tuple of integers whose values all fall in the range 0..255.
A tuple whose values fall in the range 0..15.
A map. Convert it to a tuple (key1, value1, ... key``[N]``, value``[N]``) and work with that, converting it back to a map when deserializing.
An atom. Output the atom name and the name of the module that issued it. Look up the corresponding atom during reconstruction, recreating it if it's not present and supposed to have been issued by the current module.
A compiled code object. Output any information needed to reconstruct the compiled code object.
A function with no outer (lexically captured) variables.
A function with one or more outer (lexically captured) variables.
A non-global variable. Deserialization reconstructs a new one, since there's no way to know where the original one came from.
A global variable. It's serialized as the type, the module that defined it, the variable's name within that module, and a flag byte.
A token.
This special opcode causes a previously built variable to have a previously built value to be assigned to it at this point during deserialization.
The representation of a continuation, which is just its level one state.
A reference to a method that should be looked up during deserialization. A method can have multiple message bundles, and each pair is recorded during serialization. For system atoms we output nil for the module name. During deserialization, the list is searched for a module that has been loaded, and if the corresponding name is an atom, and if that atom has a bundle associated with it, that bundle's method is used.
A reference to a method, which should be reconstructed by looking it up.
A reference to a macro, which should be reconstructed by looking it up.
A reference to an abstract, which should be reconstructed by looking it up.
A reference to a forward, which should be reconstructed by looking it up.
A reference to a message bundle, which should be reconstructed by looking it up.
An atom which is used for creating explicit subclasses. Output the atom name and the name of the module that issued it. Look up the corresponding atom during reconstruction, recreating it if it's not present and supposed to have been issued by the current module.
The raw pojo for the Java null value.
An instance of Method, likely created as part of P_CreatePojoInstanceMethodFunction. The method may be an instance method or a static method.
An instance of Constructor, likely created as part of P_CreatePojoConstructorFunction.
A block phrase.
A list phrase.
A send phrase.
A marker phrase. These should not be created during normal parsing, and must be transformed into other phrases by some means before code generation.
An arbitrary primitive type that is not already a special object. Exists primarily to support hidden types that are not exposed directly to an Avail programmer but which must still be visible to the serialization mechanism.
A variable bound to a static Java field.
A sequence-as-expression phrase.
Reserved for future use.
Reserved for future use.
A fiber type.
A tuple type.
A pojo type for which AvailObject.isPojoFusedType is false. This indicates a representation with a juicy class filling, which allows a particularly compact representation involving the class name and its parameter types.
A pojo type for which AvailObject.isPojoFusedType is true. This indicates a representation without the juicy class filling, so we have to say how each ancestor is parameterized.
A pojo type representing a Java array type. We can reconstruct this array type from the content type and the range of allowable sizes (a much stronger model than Java itself supports).
A set of class standing in for a pojo type representing a "self type". A self type is used for for parameterizing a Java class by itself. For example, in the parametric type Enum<E extends Enum<E>>, we parameterize the class Enum with such a self type. To reconstruct a self type all we need is a way to get to the raw Java classes involved, so we serialize their names.
The bottom pojo type, representing the most specific type of pojo.
The bottom pojo type, representing the most specific type of pojo.
The bottom pojo type, representing the most specific type of pojo.
An Avail enumeration, a type that has an explicit finite list of its instances.
An Avail singular enumeration, a type that has a single (non-type) instance.
An Avail instance meta, a type that has an instance i, which is itself a type. Subtypes of type i are also considered instances of this instance meta.
A token type.
A variable type for which the read type and write type are equal.
A variable type for which the read type and write type are (actually) unequal.