A_Raw Function
A_RawFunction is an interface that specifies the operations specific to function implementations in Avail.
An A_Function refers to its raw function, plus any outer values captured during function closure.
Author
Mark van Gulik
Types
Functions
Turn the receiver into an indirection to the specified object.
Answer this raw function's Primitive or null.
Utility method for decomposing this object in the debugger.
Retrieve the object's {@linkplain AbstractDescriptor descriptor}.
Answer whether the receiver and the argument, both A_BasicObjects, are equal in value.
{@inheritDoc}
Answer whether the receiver, an object, and the argument, a byte string, are equal in value.
Answer whether the receiver, an object, and the argument, a byte tuple, are equal in value.
Answer whether the arguments, an object and a compiled code, are equal.
Answer whether the receiver equals the argument.
Answer whether the receiver equals the argument.
Determine whether the receiver is an enumeration with the given set of instances.
Answer whether the receiver, an object, and the argument, a fiber type, are equal in value.
Answer whether the receiver, an object, and the argument, a function type, are equal.
Answer whether the receiver equals the argument.
Answer whether this value equals the given list phrase type.
Answer whether the receiver equals the argument.
Dispatch to the descriptor.
Dispatch to the descriptor.
Dispatch to the descriptor.
Dispatch to the descriptor.
Dispatch to the descriptor.
Dispatch to the descriptor.
Dispatch to the descriptor.
Answer whether the receiver equals the argument.
Extract a field from an object.
Extract a field from an object, using a one-based index into the field slots. This requires knowledge of the ObjectLayoutVariant, since the same field is at different indices in different variants.
Extract a field from an object, or answer null if it's not present.
Add or replace a field of an object.
Extract a field type from an object type.
Extract a field type from an object type, using the given field index, which is specific to an ObjectLayoutVariant.
Extract a field type from an object type, or null if it's not present.
Answer the function type associated with this raw function's closures.
Dispatch to the descriptor.
Answer the number of integer slots. All variable integer slots occur following the last fixed integer slot.
Dispatch to the descriptor.
Dispatch to the descriptor.
Dispatch to the descriptor.
The receiver is marked with an IMMUTABLE descriptor, but its subobjects have not yet been made immutable. Scan them now, and do any additional fix-ups necessary for the kind of object.
Dispatch to the descriptor.
The receiver is marked with a SHARED descriptor, but its subobjects have not yet been made shared. Scan them now, and do any additional fix-ups necessary for the kind of object.
Dispatch to the descriptor.
Dispatch to the descriptor.
Answer a name suitable for labeling a field containing this object.
Answer the number of object slots in this AvailObject. All variable object slots occur following the last fixed object slot.
Recursively print the receiver to the builder unless it is already present in the recursionMap. Printing will begin at the specified indent level, measured in horizontal tab characters.
Dispatch to the descriptor.
Answer whether the objects occupy the same memory addresses.
Dispatch to the descriptor.
Replace the object's {@linkplain AbstractDescriptor descriptor}.
Dispatch to the descriptor.
Replace my descriptor field with a FillerDescriptor. This blows up for most messages, catching incorrect (all, by definition) further accidental uses of this object.
Helper method for transferring this object's longSlots into an L1InstructionDecoder. The receiver's descriptor must be a CompiledCodeDescriptor.
Answer whether to show value-specific content in the file name for the debugger.
Follow indirections until a non-indirection is reached. Replace each indirection's target with the ultimate target.
Follow indirections until a non-indirection is reached. Replace each indirection's target with the ultimate target, even if it would cause the otherwise-forbidden immutable->mutable references. Only used during makeImmutable.
Follow indirections until a non-indirection is reached. Replace each indirection's target with the ultimate target, even if it would cause the otherwise-forbidden shared->unshared references. Only used during makeShared.
Answer the number of variable integer slots in this object. This does not include the fixed integer slots.
Answer the number of variable object slots in this AvailObject. This does not include the fixed object slots.
Properties
Is the receiver an Avail extended integer?
Is the receiver an Avail IntTupleDescriptor? This is conservative, in that some object tuples may only contain ints but not be reported as being int tuples.
Is the receiver an Avail LongTupleDescriptor? This is conservative, in that some object tuples may only contain longs but not be reported as being long tuples.
Is the receiver an Avail two-byte string?
Is the receiver an Avail unsigned byte?
Inheritors
Extensions
Answer the starting line number for the block phrase that defines this raw function.
Answer the type of the index-th local constant.
Set the countdown until reoptimization by the Level Two translator.
For this raw function, compute the tuple of its declaration names (arguments, locals, constants, 0..1 labels, outers). This is useful for decompilation, for giving meaningful names to registers in L2 translations, and for presenting reified continuations. Note that the outers are not part of the stack frame, and apply to the continuation's function instead.
For this raw function, compute the tuple of its declaration names (arguments, locals, constants, 0..1 labels). This is useful for decompilation, for giving meaningful names to registers in L2 translations, and for presenting reified continuations.
This raw function was found to be running in an interpreter during a periodic poll. Decrease its countdown to reoptimization by the indicated amount, being careful not to drop below one (1).
Atomically decrement the countdown to reoptimization by the L2Generator. If the count reaches zero (0), then lock this raw function, thereby blocking concurrent applications of A_Functions derived from this raw function, and then evaluate the argument in order to effect reoptimization.
Answer the tuple of line number deltas for this ram function. Each entry encodes a signed offset in an unsigned entry. There's an entry for each nybblecode (not for each nybble). The encoding uses the absolute value of the delta from the previous instruction's line number, shifted left once, adding one for negatives. This allows nybble tuples and byte tuples to be the usual representations for small functions.
Answer the index-th literal value of this A_RawFunction.
Answer the type of the index-th local variable.
Answer the maximum depth of the stack needed by an A_Continuation representing the invocation of some A_Function that closes this A_RawFunction.
Answer the A_Module that contains the block phrase that defines this raw function.
Answer the number of arguments expected by this raw function.
Answer the number of local constants specified by this A_RawFunction.
Answer the number of literal values embedded into this A_RawFunction.
Answer the number of local variables specified by this A_RawFunction.
Answer how many nybbles are taken up by the nybblecodes of this raw function.
Answer the number of outer variables specified by this A_RawFunction.
Answer the number of slots to reserve in a A_Continuation based on this raw function. This is the arity, plus number of local variables and constants, plus number of stack slots.
Answer the tuple of nybblecodes that implements this raw function.
Answer the block phrase from which this raw function was constructed. Answer nil if this information is not available.
The index into the module's lazily-loaded tuple of phrases, or -1 if the phrase was not written to a module, in which case originatingPhrase must already contain the A_Phrase. If this code was generated (say from a pragma), this may be -1, and the originatingPhrase will be nil.
Answer the type of the index-th outer variable.
Answer an A_String containing the concatenated names of the originating block's declarations.
Answer a Statistic for recording returns into this raw function.
Answer a Statistic for recording returns from this raw function.
Answer the type that this raw function will produce if there is no primitive, or if the primitive fails and the nybblecodes run.
Set the chunk that implements this A_RawFunction, and the countdown to reoptimization by the L2Generator.
Answer the L2Chunk that the interpreter will run to simulate execution of this A_RawFunction.
Atomically increment the total number of invocations of A_Functions based on this A_RawFunction.
Answer the total number of invocations of this raw function.