AvailObject

AvailObject is the fully realized, and mostly machine generated, implementation of an Avail object. An AvailObject must keep track of its descriptor, its integer data, and its references to other AvailObjects. It specifies the complete complement of messages that can be sent to an AvailObject, and delegates most of those to its descriptor, passing the AvailObject as an additional first argument. The redirected messages in AbstractDescriptor have the prefix "o_", both to make them stand out better and to indicate the additional first argument.

Author

Mark van Gulik

Todd L Smith

Parameters

descriptor

This object's {@link AbstractDescriptor}.

objectSlotsSize

The number of object slots to allocate.

intSlotsSize

The number of integer slots to allocate.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun addDependentChunk(chunk: L2Chunk)

Add the chunk with the given index to the receiver's list of chunks that depend on it. The receiver is a method. A change in the method's membership (e.g., adding a new method definition) will cause the chunk to be invalidated.

Link copied to clipboard
open override fun addWriteReactor(key: A_Atom, reactor: VariableDescriptor.VariableAccessReactor)

Add a write reactor to the VariableDescriptor and associate it with the specified key (for subsequent removal).

Link copied to clipboard
open override fun argumentRestrictionSets(): A_Tuple

Answer the tuple of sets of MessageBundleDescriptor that are forbidden from occurring in the corresponding underscore positions of this GrammaticalRestrictionDescriptor's message bundle.

Link copied to clipboard
open override fun asNativeString(): String

Construct a Java string from the receiver, an Avail string.

Link copied to clipboard
fun assertObjectUnreachableIfMutable()

Set up the object to report nice obvious errors if anyone ever accesses it again.

Link copied to clipboard
open override fun atomicAddToMap(key: A_BasicObject, value: A_BasicObject)

Extract the map from this variable, add the key → value binding to it, and write it back into the variable.

Link copied to clipboard
open override fun atomicRemoveFromMap(key: A_BasicObject)

Extract the map from this variable, remove the key if present, and write it back into the variable.

Link copied to clipboard
fun atomicUpdateSlot(    field: IntegerSlotsEnum,     subscript: Int = 1,     updater: Long.() -> Long): Long

Extract the current value of the indexable Long slot, pass it to the supplied inline Kotlin function, and write the result back to the slot with a compare-and-set, retrying from the beginning if it fails.

fun atomicUpdateSlot(    field: ObjectSlotsEnum,     subscript: Int = 1,     updater: AvailObject.() -> A_BasicObject): AvailObject

Extract the current value of the indexable object slot, pass it to the supplied Kotlin function, and write the result back to the slot with a compare-and-set, retrying from the beginning if it fails.

Link copied to clipboard
open override fun becomeIndirectionTo(anotherObject: A_BasicObject)

Turn the receiver into an indirection to the specified object.

Link copied to clipboard
fun byteSlot(field: IntegerSlotsEnum, byteSubscript: Int): Short

Extract the byte at the given one-based byte subscript within the specified field. Always use little-endian encoding.

Link copied to clipboard
fun checkWriteForField(e: AbstractSlotsEnum)

Sanity check: ensure that the specified field is writable.

Link copied to clipboard
open override fun clearLexingState()

Disconnect this token from its internal cache of what comes next.

Link copied to clipboard
open override fun clearValue()

Clear the variable. This causes the variable to have no value, and subsequent attempts to get the value of this variable will fail.

Link copied to clipboard
open fun code(): A_RawFunction

Answer the raw function (also known as compiled code) on which this function is based. The raw function holds the information that is common to all functions, and each function additionally holds zero or more captured variables and values from its lexical context.

Link copied to clipboard
open fun codePrimitive(): Primitive?

Answer this raw function's Primitive or null.

Link copied to clipboard
fun compareAndSetVolatileSlot(    field: ObjectSlotsEnum,     reference: A_BasicObject,     newValue: A_BasicObject): Boolean

Perform an atomic compare-and-set on a slot of the given array. If the value in the slot is the same Kotlin object (under ===) as the reference, replace it with the newValue and answer true. Otherwise answer false.

Link copied to clipboard
open override fun compareAndSwapValues(reference: A_BasicObject, newValue: A_BasicObject): Boolean

Read the variable's value, compare it to a reference value via semantic equality, and if they're equal, store a provided new value into the variable and answer true. Otherwise answer false. If the variable is potentially shared, then ensure suitable locks bracket this entire sequence of operations.

Link copied to clipboard
open override fun compareAndSwapValuesNoCheck(reference: A_BasicObject, newValue: A_BasicObject): Boolean

Read the variable's value, compare it to a reference value via semantic equality, and if they're equal, store a provided new value into the variable and answer true. Otherwise answer false. If the variable is potentially shared, then ensure suitable locks bracket this entire sequence of operations.

Link copied to clipboard
open override fun copyStringFromToCanDestroy(    start: Int,     end: Int,     canDestroy: Boolean): A_String

A convenience method that exposes the fact that a subtuple of a string is also a string.

Link copied to clipboard
open override fun declarationKind(): DeclarationPhraseDescriptor.DeclarationKind
Link copied to clipboard
open override fun definitionBundle(): A_Bundle

Answer the A_Bundle that this macro is for.

Link copied to clipboard
open override fun definitionMethod(): A_Method

Answer the method that this definition is for.

Link copied to clipboard
open override fun definitionModule(): A_Module

Answer the ModuleDescriptor in which this grammatical restriction was defined.

Link copied to clipboard
open override fun describeForDebugger(): Array<AvailObjectFieldHelper>

Utility method for decomposing this object in the debugger. See AvailObjectFieldHelper for instructions to enable this functionality in IntelliJ.

Link copied to clipboard
fun descriptor(): AbstractDescriptor

Retrieve this object's current descriptor.

Link copied to clipboard
fun destroy()

Replace the descriptor with a filler. This blows up for most messages, catching further uses of this object. Note that all further uses are incorrect by definition.

Link copied to clipboard
open override fun enumerationIncludesInstance(potentialInstance: AvailObject): Boolean
Link copied to clipboard
open override fun equals(another: A_BasicObject): Boolean

Answer whether the receiver and the argument, both AvailObjects, are equal in value.

open operator override fun equals(other: Any?): Boolean

{@inheritDoc}

Link copied to clipboard
open override fun equalsAnyTuple(aTuple: A_Tuple): Boolean

Answer whether the receiver, an AvailObject, and the argument, a tuple, are equal in value.

Link copied to clipboard
open override fun equalsByteArrayTuple(aByteArrayTuple: A_Tuple): Boolean
Link copied to clipboard
open override fun equalsByteBufferTuple(aByteBufferTuple: A_Tuple): Boolean
Link copied to clipboard
open override fun equalsByteString(aByteString: A_String): Boolean

Answer whether the receiver, an AvailObject, and the argument, a byte string, are equal in value.

Link copied to clipboard
open override fun equalsByteTuple(aByteTuple: A_Tuple): Boolean

Answer whether the receiver, an AvailObject, and the argument, a byte tuple, are equal in value.

Link copied to clipboard
open override fun equalsCompiledCode(aCompiledCode: A_RawFunction): Boolean

Answer whether the receiver, an AvailObject, and a compiled code, are equal.

Link copied to clipboard
open override fun equalsCompiledCodeType(aCompiledCodeType: A_Type): Boolean
Link copied to clipboard
open override fun equalsContinuation(aContinuation: A_Continuation): Boolean

Answer whether the receiver equals the argument.

Link copied to clipboard
open override fun equalsContinuationType(aContinuationType: A_Type): Boolean

Answer whether the receiver equals the argument.

Link copied to clipboard
open override fun equalsEnumerationType(anEnumerationType: A_BasicObject): Boolean
Link copied to clipboard
open override fun equalsEnumerationWithSet(aSet: A_Set): Boolean

Determine whether the receiver is an enumeration with the given set of instances.

Link copied to clipboard
open override fun equalsEqualityRawPojoFor(otherEqualityRawPojo: AvailObject, otherJavaObject: Any?): Boolean
Link copied to clipboard
open override fun equalsFiberType(aFiberType: A_Type): Boolean

Answer whether the receiver, an object, and the argument, a FiberTypeDescriptor, are equal in value.

Link copied to clipboard
open override fun equalsFunction(aFunction: A_Function): Boolean

Answer whether the receiver, an object, and the argument, a FunctionDescriptor, are equal in value.

Link copied to clipboard
open override fun equalsFunctionType(aFunctionType: A_Type): Boolean

Answer whether the receiver, an AvailObject, and the argument, a function type, are equal.

Link copied to clipboard
open override fun equalsInstanceTypeFor(anInstanceType: AvailObject): Boolean
Link copied to clipboard
open override fun equalsIntegerIntervalTuple(anIntegerIntervalTuple: A_Tuple): Boolean

Answer whether the receiver, an AvailObject, and the argument, an integer interval, are equal in value.

Link copied to clipboard
open override fun equalsIntegerRangeType(anIntegerRangeType: A_Type): Boolean

Answer whether the receiver equals the argument.

Link copied to clipboard
open override fun equalsIntTuple(anIntTuple: A_Tuple): Boolean

Answer whether the receiver, an AvailObject, and the argument, an int tuple, are equal in value.

Link copied to clipboard
open override fun equalsListNodeType(listNodeType: A_Type): Boolean

Answer whether this value equals the given ListPhraseTypeDescriptor.

Link copied to clipboard
open override fun equalsLiteralTokenType(aLiteralTokenType: A_Type): Boolean
Link copied to clipboard
open override fun equalsLongTuple(aLongTuple: A_Tuple): Boolean

Answer whether the receiver, an AvailObject, and the argument, a long tuple, are equal in value.

Link copied to clipboard
open override fun equalsMap(aMap: A_Map): Boolean

Answer whether the receiver equals the argument.

Link copied to clipboard
open override fun equalsMapType(aMapType: A_Type): Boolean

Answer whether the receiver equals the argument.

Link copied to clipboard
open override fun equalsNybbleTuple(aNybbleTuple: A_Tuple): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun equalsObject(anObject: AvailObject): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun equalsObjectTuple(anObjectTuple: A_Tuple): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun equalsObjectType(anObjectType: AvailObject): Boolean
Link copied to clipboard
open override fun equalsPhrase(aPhrase: A_Phrase): Boolean
Link copied to clipboard
open override fun equalsPhraseType(aPhraseType: A_Type): Boolean
Link copied to clipboard
open override fun equalsPojo(aPojo: AvailObject): Boolean
Link copied to clipboard
open override fun equalsPojoBottomType(): Boolean
Link copied to clipboard
open override fun equalsPojoField(field: AvailObject, receiver: AvailObject): Boolean
Link copied to clipboard
open override fun equalsPojoType(aPojoType: AvailObject): Boolean
Link copied to clipboard
open override fun equalsPrimitiveType(aPrimitiveType: A_Type): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun equalsRawPojoFor(otherRawPojo: AvailObject, otherJavaObject: Any?): Boolean
Link copied to clipboard
open override fun equalsRepeatedElementTuple(aRepeatedElementTuple: A_Tuple): Boolean

Answer whether the receiver, an AvailObject, and the argument, a repeated element tuple, are equal in value.

Link copied to clipboard
open override fun equalsReverseTuple(aTuple: A_Tuple): Boolean

Answer whether the receiver and the argument tuple, both AvailObjects, are equal in value.

Link copied to clipboard
open override fun equalsSetType(aSetType: A_Type): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun equalsSmallIntegerIntervalTuple(aSmallIntegerIntervalTuple: A_Tuple): Boolean

Answer whether the receiver, an AvailObject, and the argument, a small integer interval tuple, are equal in value.

Link copied to clipboard
open override fun equalsToken(aToken: A_Token): Boolean
Link copied to clipboard
open override fun equalsTokenType(aTokenType: A_Type): Boolean
Link copied to clipboard
open override fun equalsTupleType(aTupleType: A_Type): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun equalsTwoByteString(aTwoByteString: A_String): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun equalsVariableType(aVariableType: A_Type): Boolean

Answer whether the receiver equals the argument.

Link copied to clipboard
open override fun extractDumpedLongAt(index: Int): Long

Given a continuation register dump, extract the Long at the given slot index.

Link copied to clipboard
open override fun extractDumpedObjectAt(index: Int): AvailObject

Given a continuation register dump, extract the object at the given slot index.

Link copied to clipboard
open override fun fetchAndAddValue(addend: A_Number): A_Number

Read the variable's value, add the addend to it, and store it back into the variable. This sequence of operations is protected by a lock if the variable is potentially shared among multiple Avail FiberDescriptor. Fail if the variable had no value, if the variable's content type is not a subtype of the IntegerRangeTypeDescriptor.extendedIntegers, if the addend is not an extended integer, if the sum of the old value and the addend is undefined (e.g., ∞ plus -∞), or if the sum does not satisfy the variable's VariableTypeDescriptor.o_WriteType. Return the previous value.

Link copied to clipboard
open override fun fieldAt(field: A_Atom): AvailObject

Extract a field from an ObjectDescriptor.

Link copied to clipboard
open override fun fieldAtIndex(index: Int): AvailObject

Extract a field from an ObjectDescriptor, 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.

Link copied to clipboard
open override fun fieldAtOrNull(field: A_Atom): AvailObject?

Extract a field from an ObjectDescriptor, or answer null if it's not present.

Link copied to clipboard
open override fun fieldAtPuttingCanDestroy(    field: A_Atom,     value: A_BasicObject,     canDestroy: Boolean): A_BasicObject

Add or replace a field of an ObjectDescriptor.

Link copied to clipboard
open override fun fieldMap(): A_Map

Dispatch to the descriptor.

Link copied to clipboard
open override fun fieldTuple(): A_Tuple
Link copied to clipboard
open override fun fieldTypeAt(field: A_Atom): A_Type

Extract a field type from an ObjectTypeDescriptor.

Link copied to clipboard
open override fun fieldTypeAtIndex(index: Int): A_Type

Extract a field type from an ObjectTypeDescriptor, using the given field index, which is specific to an ObjectLayoutVariant.

Link copied to clipboard
open override fun fieldTypeAtOrNull(field: A_Atom): A_Type?

Extract a field type from an ObjectTypeDescriptor, or null if it's not present.

Link copied to clipboard
fun fillSlots(    field: ObjectSlotsEnum,     startSubscript: Int,     count: Int,     anAvailObject: A_BasicObject)

Store the object in the specified slots of the receiver. The caller is responsible for ensuring the value has been marked Mutability.IMMUTABLE if necessary.

Link copied to clipboard
open fun forEach(p0: Consumer<in AvailObject>)
Link copied to clipboard
open override fun function(): A_Function

Answer the function to execute to determine the effect of this semantic restriction on a list of argument static types at a call site.

Link copied to clipboard
open fun functionType(): A_Type

Answer the function type associated with this raw function's closures.

Link copied to clipboard
open override fun getAndSetValue(newValue: A_BasicObject): AvailObject

Read the variable's value and set it to the new value. Answer the old value. Fail if the new value is not suitable for the variable, or if the variable had no value. Ensure that the entire operation runs atomically with respect to other reads and writes of the variable. Use information about whether the variable is potentially shared between Avail FiberDescriptor to determine whether locking operations are needed.

Link copied to clipboard
fun getAndSetVolatileSlot(field: ObjectSlotsEnum, anAvailObject: A_BasicObject): AvailObject

Store the AvailObject in the specified slot of the receiver, and answer the value that was previously in that slot. Use atomic write semantics that are compatible with volatile access. Note that this may answer nil if it's used on an unassigned variable's value slot.

Link copied to clipboard
open override fun getValue(): AvailObject

Extract the current value of the VariableDescriptor. Fail if the variable has no value.

Link copied to clipboard
open override fun getValueClearing(): AvailObject

Extract the current value of the VariableDescriptor. Fail if the variable has no value. Clear the variable afterward.

Link copied to clipboard
open override fun getValueForDebugger(): AvailObject

Read the current value of a variable without tripping any observerless mechanisms or checks. If the variable is unassigned, answer nil.

Link copied to clipboard
open override fun globalModule(): A_Module

Only applicable to VariableSharedGlobalDescriptor. Answer the module in which it's defined.

Link copied to clipboard
open override fun globalName(): A_String

Only applicable to VariableSharedGlobalDescriptor. Answer the name of this global variable or constant.

Link copied to clipboard
open override fun hash(): Int

Compute the 32-bit hash of the receiver.

Link copied to clipboard
open override fun hashCode(): Int

Redirect Kotlin's hashCode to AbstractDescriptor.o_Hash.

Link copied to clipboard
open override fun hashOrZero(): Int

Dispatch to the descriptor.

Link copied to clipboard
open override fun hasValue(): Boolean

Answer true if the variable currently has a value, otherwise answer false. No value is typically represented by the variable's value slot containing nil.

Link copied to clipboard
open fun <T : A_BasicObject> ifNotNil(action: (T) -> Unit)

If the receiver is notNil, evaluate the action with it.

Link copied to clipboard
fun intBinarySearch(    slot: IntegerSlotsEnum,     slotCount: Int,     key: Int): Int

Search for the key in the 32-bit Ints encoded within the longSlots that occur within those slots identified with the specified IntegerSlotsEnum. The int slots must be in ascending sorted order, and must be distinct. If the exact int is found, answer its zero-based index within this repeated slot (i.e., ≥0). If the exact int is not found, answer (-n-1), where n is the zero-based position of the leftmost element of the repeated slot which is greater than the key (if it was equal, the "if found" case would have applied).

Link copied to clipboard
open override fun integerSlotsCount(): Int

Answer the number of Long slots.

Link copied to clipboard
fun intLinearSearch(    slot: IntegerSlotsEnum,     startIndex: Int,     endIndex: Int,     key: Int): Int

Search for the key in the 32-bit Ints encoded within the longSlots that occur within those slots identified with the specified IntegerSlotsEnum. Only search the given range of indices. If the given Int value is found within the given range, answer the index of the intSlot. Otherwise answer zero (0).

Link copied to clipboard
fun intSlot(field: IntegerSlotsEnum, intIndex: Int): Int

Extract a (32-bit signed) Int at the given int-index of the receiver.

Link copied to clipboard
open override fun isGlobal(): Boolean

Answer whether this variable is a module-scoped global.

Link copied to clipboard
open override fun isInCurrentModule(currentModule: A_Module): Boolean

Given a module in the process of being compiled, answer whether this token was constructed by the compiler from the module's source.

Link copied to clipboard
open override fun isInstanceOf(aType: A_Type): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun isInstanceOfKind(aType: A_Type): Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override fun isLiteralToken(): Boolean

Answer whether this token is a LiteralTokenDescriptor, such as a string or number.

Link copied to clipboard
open operator override fun iterator(): Iterator<AvailObject>

Answer an iterator suitable for traversing the elements of the receiver with a Java foreach construct.

Link copied to clipboard
open override fun javaAncestors(): AvailObject
Link copied to clipboard
open override fun javaClass(): AvailObject
Link copied to clipboard
open override fun <T : Any> javaObject(): T?
Link copied to clipboard
open override fun <T : Any> javaObjectNotNull(): T
Link copied to clipboard
open override fun kind(): A_Type

Dispatch to the descriptor.

Link copied to clipboard
open override fun lineNumber(): Int

The line number of this token in the source file.

Link copied to clipboard
open override fun literal(): AvailObject

Extract the literal value from this token. It must be a literal token.

Link copied to clipboard
open override fun <T> lock(body: () -> T): T

Lock the fiber during evaluation of the Supplier, and return the produced value.

Link copied to clipboard
open override fun lowerCaseString(): A_String

Answer this token's string representation converted to lower case.

Link copied to clipboard
open override fun makeImmutable(): AvailObject

Dispatch to the descriptor.

Link copied to clipboard
open override fun makeImmutableInternal(queueToProcess: MutableList<AvailObject>, fixups: MutableList<() -> Unit>)

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.

Link copied to clipboard
open override fun makeShared(): AvailObject

Dispatch to the descriptor.

Link copied to clipboard
open override fun makeSharedInternal(queueToProcess: MutableList<AvailObject>, fixups: MutableList<() -> Unit>)

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.

Link copied to clipboard
open override fun makeSubobjectsImmutable(): AvailObject

Dispatch to the descriptor.

Link copied to clipboard
open override fun makeSubobjectsShared(): AvailObject

Dispatch to the descriptor.

Link copied to clipboard
open fun <T : A_BasicObject, O : A_BasicObject> mapNotNil(action: (T) -> O): O

If the receiver is notNil, evaluate the action with it.

Link copied to clipboard
open override fun marshalToJava(classHint: Class<*>?): Any?
Link copied to clipboard
fun mutableSlot(bitField: BitField): Int

Extract an integer (at most 32 bits) from the given BitField. If the receiver is shared, then acquire its monitor.

fun mutableSlot(field: IntegerSlotsEnum): Long

Extract the (signed 64-bit) integer for the given field enum value, using volatile-read semantics if the receiver is shared.

fun mutableSlot(field: ObjectSlotsEnum): AvailObject

Extract the object at the specified slot of the receiver. If the receiver is shared, then acquire its monitor.

fun mutableSlot(field: IntegerSlotsEnum, subscript: Int): Long

Extract the (signed 64-bit) integer at the given field enum value. If the receiver is shared, then use VolatileSlotHelper.volatileRead to acquire the value.

fun mutableSlot(field: ObjectSlotsEnum, subscript: Int): AvailObject

Extract the AvailObject at the specified slot of the receiver, using volatile-read semantics if the receiver is shared.

Link copied to clipboard
open override fun nameForDebugger(): String

Answer a name suitable for labeling a field containing this object.

Link copied to clipboard
open override fun nextLexingState(): LexingState

Answer the LexingState that follows this token, or null if it hasn't been set yet.

Link copied to clipboard
open override fun nextLexingStatePojo(): AvailObject

Answer the pojo AvailObject containing the ]LexingState that follows this token, or nil if it hasn't been set yet.

Link copied to clipboard
open override fun objectSlotsCount(): Int

Answer the number of AvailObject slots.

Link copied to clipboard
open fun outerVarAt(index: Int): AvailObject

Answer this function's lexically captured variable or constant value that has the specified index.

Link copied to clipboard
open fun outerVarAtPut(index: Int, value: AvailObject)

Set the specified captured variable/constant slot to the given variable or constant value.

Link copied to clipboard
open override fun pojoSelfType(): A_Type
Link copied to clipboard
open override fun prefixFunctions(): A_Tuple

Answer the tuple of macro prefix functions for this MacroDescriptor. Fail if this is not a macro definition.

Link copied to clipboard
open override fun printOnAvoidingIndent(    builder: StringBuilder,     recursionMap: IdentityHashMap<A_BasicObject, Void>,     indent: Int)

Recursively print the receiver to the StringBuilder, unless it is already present in the recursion Map. Printing will begin at the specified indent level, measured in horizontal tab characters.

Link copied to clipboard
open override fun rawPojo(): AvailObject
Link copied to clipboard
open override fun removeDependentChunk(chunk: L2Chunk)

Remove the specified chunk from the receiver's set of dependent chunks.

Link copied to clipboard
open override fun removeWriteReactor(key: A_Atom)

Remove the write reactor associated with the specified AtomDescriptor from the VariableDescriptor.

Link copied to clipboard
open override fun representationCostOfTupleType(): Int

Dispatch to the descriptor.

Link copied to clipboard
open override fun restrictedBundle(): A_Bundle

Answer the MessageBundleDescriptor that is restricted by this grammatical restriction.

Link copied to clipboard
open override fun resultType(): A_Type
Link copied to clipboard
fun sameAddressAs(anotherObject: A_BasicObject): Boolean

Answer whether the objects occupy the same memory addresses.

Link copied to clipboard
override fun scanSubobjects(visitor: (AvailObject) -> AvailObject)

Visit all of the object's object slots, passing the parent and child objects to the provided visitor.

Link copied to clipboard
open override fun serializerOperation(): SerializerOperation
Link copied to clipboard
fun setByteSlot(    field: IntegerSlotsEnum,     byteSubscript: Int,     aByte: Short)

Replace the byte at the given one-based byte subscript within the specified field. Always use little endian encoding.

Link copied to clipboard
fun setContinuationSlotOfFiber(field: ObjectSlotsEnum, aContinuation: A_Continuation)

Store the specified continuation in the receiver, which must be a fiber. This is the only circumstance in all of Avail in which a field of a (potentially) shared object may hold a non-shared object.

Link copied to clipboard
open override fun setCurrentModule(currentModule: A_Module)

Given a module in the process of being compiled, alter this token to indicate that it was created directly from that module's source.

Link copied to clipboard
fun setDescriptor(newDescriptor: AbstractDescriptor)

Replace this object's current currentDescriptorAbstractDescriptor].

Link copied to clipboard
open override fun setHashOrZero(value: Int)

Dispatch to the descriptor.

Link copied to clipboard
fun setIntSlot(    field: IntegerSlotsEnum,     intIndex: Int,     anInt: Int)

Store the (32-bit signed) Int at the given int-index of the receiver.

Link copied to clipboard
fun setMutableSlot(bitField: BitField, anInteger: Int)

Store the signed 32-bit Int into the specified BitField, trimming upper bits beyond the BitField's size. If the receiver is shared, then use VolatileSlotHelper.compareAndSet to ensure only the intended bits are affected.

fun setMutableSlot(field: IntegerSlotsEnum, anInteger: Long)

Store the (signed 64-bit) integer in the eight bytes starting at the given field enum value. If the receiver is Mutability.SHARED, then acquire its monitor.

fun setMutableSlot(field: ObjectSlotsEnum, anAvailObject: A_BasicObject)

Store the AvailObject in the specified slot of the receiver, using volatile-write semantics if the receiver is shared.

fun setMutableSlot(    field: IntegerSlotsEnum,     subscript: Int,     anInteger: Long)

Store the (signed 64-bit) integer in the eight bytes starting at the given field enum value. If the receiver is shared, then use VolatileSlotHelper.volatileWrite to write the value.

Link copied to clipboard
open override fun setNextLexingStateFromPrior(priorLexingState: LexingState)

Set this token's next LexingState.

Link copied to clipboard
fun setShortSlot(    field: IntegerSlotsEnum,     shortIndex: Int,     aShort: Int)

Store the (16-bit unsigned) short at the given short-index of the receiver.

Link copied to clipboard
fun setSlot(bitField: BitField, anInteger: Int)

Replace the value of the BitField within this object.

fun setSlot(field: IntegerSlotsEnum, anInteger: Long)
fun setSlot(    field: IntegerSlotsEnum,     subscript: Int,     anInteger: Long)

Store the (signed 64-bit) integer in the eight bytes starting at the given field enum value.

fun setSlot(field: ObjectSlotsEnum, newValue: A_BasicObject)

Store the A_BasicObject in the specified object slot of the receiver.

fun setSlot(    field: ObjectSlotsEnum,     subscript: Int,     anAvailObject: A_BasicObject)

Store the AvailObject in the specified slot of the receiver.

Link copied to clipboard
fun setSlotsFromArray(    targetField: IntegerSlotsEnum,     startTargetSubscript: Int,     sourceArray: LongArray,     zeroBasedStartSourceSubscript: Int,     count: Int)

Read elements from consecutive slots of a LongArray, writing them to consecutive long slots of the receiver.

fun <T : A_BasicObject> setSlotsFromArray(    targetField: ObjectSlotsEnum,     startTargetSubscript: Int,     sourceArray: Array<T>,     zeroBasedStartSourceSubscript: Int,     count: Int)

Read elements from consecutive slots of an array, writing them to consecutive slots of the receiver. It's the client's responsibility to ensure the values are suitably immutable or shared.

Link copied to clipboard
fun setSlotsFromList(    field: ObjectSlotsEnum,     startSubscript: Int,     sourceList: List<A_BasicObject?>,     zeroBasedStartSourceSubscript: Int,     count: Int)

Write elements from the given List into consecutively numbered object slots. If the receiver is Mutability.SHARED, then the new value must also become shared (by the client) before it can be stored.

Link copied to clipboard
fun setSlotsFromLongSlots(    targetField: IntegerSlotsEnum,     startTargetSubscript: Int,     sourceObject: A_BasicObject,     sourceField: IntegerSlotsEnum,     startSourceSubscript: Int,     count: Int)

Read elements from consecutive integer slots of the sourceObject, writing them to consecutive slots of the receiver. It's the client's responsibility to ensure the values are suitably immutable or shared.

Link copied to clipboard
fun setSlotsFromObjectSlots(    targetField: ObjectSlotsEnum,     startTargetSubscript: Int,     sourceObject: A_BasicObject,     sourceField: ObjectSlotsEnum,     startSourceSubscript: Int,     count: Int)

Read elements from consecutive slots of the sourceObject, writing them to consecutive slots of the receiver. It's the client's responsibility to ensure the values are suitably immutable or shared.

Link copied to clipboard
fun setSlotsFromTuple(    targetField: ObjectSlotsEnum,     startTargetSubscript: Int,     sourceTuple: A_Tuple,     startSourceSubscript: Int,     count: Int)

Read elements from consecutive slots of a tuple, writing them to consecutive slots of the receiver. It's the client's responsibility to ensure the values are suitably immutable or shared.

Link copied to clipboard
open override fun setToInvalidDescriptor()

Replace my descriptor field with a FillerDescriptor. This blows up for most messages, catching incorrect (all, by definition) further accidental uses of this object.

Link copied to clipboard
open override fun setUpInstructionDecoder(instructionDecoder: CompiledCodeDescriptor.L1InstructionDecoder)

Helper method for transferring this object's longSlots into an L1InstructionDecoder. The receiver's descriptor must be a CompiledCodeDescriptor.

Link copied to clipboard
open override fun setValue(newValue: A_BasicObject)

Assign the given value to the VariableDescriptor. Fail if the value does not have a type suitable for the variable.

Link copied to clipboard
open override fun setValueNoCheck(newValue: A_BasicObject)

Assign the given value to the VariableDescriptor. The client should ensure that the value is acceptable for the variable.

Link copied to clipboard
open override fun setValueWasStablyComputed(wasStablyComputed: Boolean)

Set whether this write-once variable was initialized from an expression which is stable – always produces the same value (modulo loading of modules) and has no side-effects.

Link copied to clipboard
fun setVolatileSlot(field: ObjectSlotsEnum, anAvailObject: A_BasicObject)
fun setVolatileSlot(    field: ObjectSlotsEnum,     subscript: Int,     anAvailObject: A_BasicObject)

Store the AvailObject in the specified slot of the receiver. Use volatile write semantics.

Link copied to clipboard
fun shortSlot(field: IntegerSlotsEnum, shortIndex: Int): Int

Extract a (16-bit unsigned) short at the given short-index of the receiver.

Link copied to clipboard
open override fun showValueInNameForDebugger(): Boolean

Answer whether to show value-specific content in the field name in the debugger.

Link copied to clipboard
fun slot(bitField: BitField): Int

Extract the value of the BitField of the receiver. Note that it's an Int even though the underlying longSlots array contains longs.

fun slot(field: IntegerSlotsEnum): Long

Extract the (signed 64-bit) integer for the given field enum value.

fun slot(field: ObjectSlotsEnum): AvailObject

Extract the AvailObject from the specified object slot of the receiver.

fun slot(field: IntegerSlotsEnum, subscript: Int): Long

Extract the (signed 64-bit) integer at the given field enum value.

fun slot(field: ObjectSlotsEnum, subscript: Int): AvailObject

Extract the AvailObject at the specified slot of the receiver.

Link copied to clipboard
fun slotsIntoArray(    sourceField: IntegerSlotsEnum,     startSourceSubscript: Int,     targetArray: LongArray,     zeroBasedStartTargetSubscript: Int,     count: Int)

Read consecutive long slots from the receiver, writing them into slots of a long array.

Link copied to clipboard
open override fun spliterator(): Spliterator<AvailObject>
Link copied to clipboard
open override fun start(): Int

Answer this token's initial character position in the source file.

Link copied to clipboard
open override fun string(): A_String

Answer this token's exact string representation as it appeared in the source code.

Link copied to clipboard
open override fun synthesizeCurrentLexingState(): LexingState

Create and answer a LexingState corresponding to the start of this token. It should not be used for subsequent parsing/lexing.

Link copied to clipboard
open override fun tokenType(): TokenDescriptor.TokenType

Answer the TokenDescriptor.TokenType of this token.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun traversed(): AvailObject

Follow indirections until a non-indirection is reached. Replace each indirection's target with the ultimate target.

Link copied to clipboard
open override fun traversedWhileMakingImmutable(): AvailObject

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.

Link copied to clipboard
open override fun traversedWhileMakingShared(): AvailObject

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.

open override fun truncateWithFillerForNewIntegerSlotsCount(newIntegerSlotsCount: Int)

Reduce the number of long slots occupied by this object. In a raw memory model we would split the object representation into two objects, one at the original address, and a separate filler object occupying the long slots that were chopped off.

Link copied to clipboard
open override fun truncateWithFillerForNewObjectSlotsCount(newObjectSlotsCount: Int)

Slice the current AvailObject into two objects, the left one (at the same starting address as the input), and the right one (a filler object that nobody should ever create a pointer to). The new Filler can have zero post-header slots (i.e., just the header), but the left object must not, since it may turn into an indirection some day and will require at least one slot for the target pointer.

Link copied to clipboard
fun updateSlot(bitField: BitField, updater: Int.() -> Int)

Extract the current Int value of the BitField, pass it to the supplied inline Kotlin function, and write the result back to the BitField. Note that this is not atomic, so other fields encoded in the same Long field may get clobbered if simultaneously updated by multiple threads.

fun updateSlot(field: IntegerSlotsEnum, updater: Long.() -> Long)

Extract the current value of the Long slot, pass it to the supplied inline Kotlin function, and write the resulting Long back to the slot.

fun updateSlot(field: ObjectSlotsEnum, updater: AvailObject.() -> A_BasicObject)

Extract the current value of the slot, pass it to the supplied inline Kotlin function, and write the result back to the slot.

Link copied to clipboard
fun updateSlotShared(field: ObjectSlotsEnum, updater: AvailObject.() -> A_BasicObject)

Extract the current value of the slot, pass it to the supplied inline Kotlin function, make it shared, and write the result back to the slot.

Link copied to clipboard
open override fun validWriteReactorFunctions(): A_Set

Answer the set of write reactorFunctionDescriptor that have not previously activated.

Link copied to clipboard
open override fun value(): AvailObject

Extract the current value of the VariableDescriptor. Answer nil if the variable has no value.

Link copied to clipboard
open override fun valueWasStablyComputed(): Boolean

Answer whether this variable is both a write-once variable and initialized from an expression which is stable – always produces the same value (modulo loading of modules) and has no side-effects.

Link copied to clipboard
fun variableIntegerSlotsCount(): Int

Answer the number of variable integer slots in this object. This does not include the fixed integer slots.

Link copied to clipboard
open override fun variableMapHasKey(key: A_BasicObject): Boolean

Test whether the map in this variable has the specified key.

Link copied to clipboard
fun variableObjectSlotsCount(): Int

Answer the number of variable object slots in this AvailObject. This does not include the fixed object slots.

Link copied to clipboard
fun volatileSlot(field: ObjectSlotsEnum): AvailObject
fun volatileSlot(field: ObjectSlotsEnum, subscript: Int): AvailObject

Extract the AvailObject at the specified slot of the receiver. Use volatile semantics for the read.

Link copied to clipboard
fun writeBackSlot(    field: ObjectSlotsEnum,     subscript: Int,     anAvailObject: AvailObject)

Write an equivalent replacement object into an object field of this object. Since the replacement is semantically equivalent to the previous content, don't acquire a lock. Any necessary write barriers and other memory synchronizations are the responsibility of the caller.

Link copied to clipboard
open override fun writeSummaryTo(writer: JSONWriter)
Link copied to clipboard
open override fun writeTo(writer: JSONWriter)

Properties

Link copied to clipboard
open val generatingLexer: A_Lexer

Extract from this literal token the A_Lexer responsible for its production, or nil if it was not created that way.

Link copied to clipboard
open val generatingPhrase: A_Phrase

Extract from this literal token the phrase that was responsible for generating it.

Link copied to clipboard
open override val isAbstract: Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override val isAtom: Boolean

Is the receiver an Avail atom?

Link copied to clipboard
open override val isBoolean: Boolean

Is the receiver an Avail boolean?

Link copied to clipboard
open override val isBottom: Boolean

Answer whether this type is ⊥ (BottomTypeDescriptor), the most specific type.

Link copied to clipboard
open override val isByteArrayTuple: Boolean
Link copied to clipboard
open override val isByteBufferTuple: Boolean
Link copied to clipboard
open override val isByteString: Boolean

Is the receiver an Avail byte string?

Link copied to clipboard
open override val isByteTuple: Boolean

Is the receiver an Avail byte tuple?

Link copied to clipboard
open override val isEnumeration: Boolean
Link copied to clipboard
open override val isExtendedInteger: Boolean

Is the receiver an Avail extended integer?

Link copied to clipboard
open override val isFinite: Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override val isFunction: Boolean

Is the receiver an Avail function?

Link copied to clipboard
open override val isInitializedWriteOnceVariable: Boolean
Link copied to clipboard
open override val isInstanceMeta: Boolean
Link copied to clipboard
open override val isIntegerIntervalTuple: Boolean
Link copied to clipboard
open override val isIntegerRangeType: Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override val isIntTuple: Boolean

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.

Link copied to clipboard
open override val isLiteralTokenType: Boolean
Link copied to clipboard
open override val isLongTuple: Boolean

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.

Link copied to clipboard
open override val isMap: Boolean

Is the receiver an Avail map?

Link copied to clipboard
open override val isMapType: Boolean

Dispatch to the descriptor.

Link copied to clipboard
open val isNil: Boolean

Test if the receiver is the nil value.

Link copied to clipboard
open override val isNybble: Boolean

Is the receiver an Avail nybble?

Link copied to clipboard
open override val isPojo: Boolean
Link copied to clipboard
open override val isPojoArrayType: Boolean
Link copied to clipboard
open override val isPojoFusedType: Boolean
Link copied to clipboard
open override val isPojoSelfType: Boolean
Link copied to clipboard
open override val isPojoType: Boolean
Link copied to clipboard
open override val isRawPojo: Boolean
Link copied to clipboard
open override val isRepeatedElementTuple: Boolean
Link copied to clipboard
open override val isSetType: Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override val isSmallIntegerIntervalTuple: Boolean
Link copied to clipboard
open override val isString: Boolean

Is the receiver an Avail string?

Link copied to clipboard
open override val isTokenType: Boolean
Link copied to clipboard
open override val isTop: Boolean

Answer whether this type is ⊤ (PrimitiveTypeDescriptor.Types.TOP), the most general type.

Link copied to clipboard
open override val isTuple: Boolean

Is the receiver an Avail tuple?

Link copied to clipboard
open override val isTupleType: Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override val isTwoByteString: Boolean

Is the receiver an Avail TwoByteStringDescriptor?

Link copied to clipboard
open override val isType: Boolean

Dispatch to the descriptor.

Link copied to clipboard
open override val isUnsignedByte: Boolean

Is the receiver an Avail unsigned byte?

Link copied to clipboard
open override val isVacuousType: Boolean

Answer whether this type is known to have no instances. For example, the BottomTypeDescriptor (denoted ⊥) has no instances.

Link copied to clipboard
open val notNil: Boolean

Test if the receiver is not the nil value.

Link copied to clipboard
val typeTag: TypeTag

Extensions

Link copied to clipboard
fun AvailObject.initHash()

Initialize the phrase's hash value during construction.