AvailObjectRepresentation

AvailObjectRepresentation is the representation used for all Avail objects.

Author

Todd L Smith

Mark van Gulik

Parameters

initialDescriptor

The initial descriptor for the new object.

objectSlotsSize

The total number of AvailObject slots to allocate.

integerSlotsCount

The total number of Long slots to allocate.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val isAbstract: Boolean

Dispatch to the descriptor.

Link copied to clipboard
abstract val isAtom: Boolean

Is the receiver an Avail atom?

Link copied to clipboard
abstract val isBoolean: Boolean

Is the receiver an Avail boolean?

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract val isByteString: Boolean

Is the receiver an Avail byte string?

Link copied to clipboard
abstract val isByteTuple: Boolean

Is the receiver an Avail byte tuple?

Link copied to clipboard

Is the receiver an Avail extended integer?

Link copied to clipboard
abstract val isFinite: Boolean

Dispatch to the descriptor.

Link copied to clipboard
abstract val isFunction: Boolean

Is the receiver an Avail function?

Link copied to clipboard
abstract val isInstanceMeta: Boolean
Link copied to clipboard
Link copied to clipboard

Dispatch to the descriptor.

Link copied to clipboard
abstract 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
Link copied to clipboard
abstract 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
abstract val isMap: Boolean

Is the receiver an Avail map?

Link copied to clipboard
abstract 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
abstract val isNybble: Boolean

Is the receiver an Avail nybble?

Link copied to clipboard
abstract val isPojo: Boolean
Link copied to clipboard
abstract val isPojoArrayType: Boolean
Link copied to clipboard
abstract val isPojoFusedType: Boolean
Link copied to clipboard
abstract val isPojoSelfType: Boolean
Link copied to clipboard
abstract val isPojoType: Boolean
Link copied to clipboard
abstract val isRawPojo: Boolean
Link copied to clipboard
Link copied to clipboard
abstract val isSetType: Boolean

Dispatch to the descriptor.

Link copied to clipboard
Link copied to clipboard
abstract val isString: Boolean

Is the receiver an Avail string?

Link copied to clipboard
abstract val isTokenType: Boolean
Link copied to clipboard
abstract val isTuple: Boolean

Is the receiver an Avail tuple?

Link copied to clipboard
abstract val isTupleType: Boolean

Dispatch to the descriptor.

Link copied to clipboard
abstract val isTwoByteString: Boolean

Is the receiver an Avail two-byte string?

Link copied to clipboard
abstract val isType: Boolean

Dispatch to the descriptor.

Link copied to clipboard
abstract val isUnsignedByte: Boolean

Is the receiver an Avail unsigned byte?

Link copied to clipboard
Link copied to clipboard
open val notNil: Boolean

Test if the receiver is not the nil value.

Link copied to clipboard
Link copied to clipboard

Functions

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

Sanity check: ensure that the specified field is writable.

Link copied to clipboard

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

Utility method for decomposing this object in the debugger.

Link copied to clipboard

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

Dispatcher helper function for routing messages to the descriptor.

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

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

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

{@inheritDoc}

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

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

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

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

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

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

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

Answer whether the arguments, an object and a compiled code, are equal.

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

Answer whether the receiver equals the argument.

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

Answer whether the receiver equals the argument.

Link copied to clipboard
abstract fun equalsEnumerationType(anEnumerationType: A_BasicObject): Boolean
Link copied to clipboard

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

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

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

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

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

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

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

Link copied to clipboard
abstract fun equalsInstanceTypeFor(anInstanceType: AvailObject): Boolean
Link copied to clipboard
abstract fun equalsIntegerIntervalTuple(anIntegerIntervalTuple: A_Tuple): Boolean
Link copied to clipboard
abstract fun equalsIntegerRangeType(anIntegerRangeType: A_Type): Boolean

Answer whether the receiver equals the argument.

Link copied to clipboard
abstract fun equalsIntTuple(anIntTuple: A_Tuple): Boolean
Link copied to clipboard
abstract fun equalsListNodeType(listNodeType: A_Type): Boolean

Answer whether this value equals the given list phrase type.

Link copied to clipboard
abstract fun equalsLiteralTokenType(aLiteralTokenType: A_Type): Boolean
Link copied to clipboard
abstract fun equalsLongTuple(aLongTuple: A_Tuple): Boolean
Link copied to clipboard
abstract fun equalsMap(aMap: A_Map): Boolean

Answer whether the receiver equals the argument.

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

Answer whether the receiver equals the argument.

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

Dispatch to the descriptor.

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

Dispatch to the descriptor.

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

Dispatch to the descriptor.

Link copied to clipboard
abstract fun equalsObjectType(anObjectType: AvailObject): Boolean
Link copied to clipboard
abstract fun equalsPhraseType(aPhraseType: A_Type): Boolean
Link copied to clipboard
abstract fun equalsPojo(aPojo: AvailObject): Boolean
Link copied to clipboard
Link copied to clipboard
abstract fun equalsPojoField(field: AvailObject, receiver: AvailObject): Boolean
Link copied to clipboard
abstract fun equalsPojoType(aPojoType: AvailObject): Boolean
Link copied to clipboard
abstract fun equalsPrimitiveType(aPrimitiveType: A_Type): Boolean

Dispatch to the descriptor.

Link copied to clipboard
abstract fun equalsRawPojoFor(otherRawPojo: AvailObject, otherJavaObject: Any?): Boolean
Link copied to clipboard
abstract fun equalsRepeatedElementTuple(aRepeatedElementTuple: A_Tuple): Boolean
Link copied to clipboard
abstract fun equalsReverseTuple(aTuple: A_Tuple): Boolean
Link copied to clipboard
abstract fun equalsSetType(aSetType: A_Type): Boolean

Dispatch to the descriptor.

Link copied to clipboard
abstract fun equalsSmallIntegerIntervalTuple(aSmallIntegerIntervalTuple: A_Tuple): Boolean
Link copied to clipboard
abstract fun equalsToken(aToken: A_Token): Boolean
Link copied to clipboard
abstract fun equalsTokenType(aTokenType: A_Type): Boolean
Link copied to clipboard
abstract fun equalsTupleType(aTupleType: A_Type): Boolean

Dispatch to the descriptor.

Link copied to clipboard
abstract fun equalsTwentyOneBitString(aTwentyOneBitString: A_String): Boolean

Dispatch to the descriptor.

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

Dispatch to the descriptor.

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

Answer whether the receiver equals the argument.

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

Extract a field from an object.

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

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.

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

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

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

Add or replace a field of an object.

Link copied to clipboard
abstract fun fieldMap(): A_Map

Dispatch to the descriptor.

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

Extract a field type from an object type.

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

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

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

Extract a field type from an object type, 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
operator fun get(bitField: BitField): Int

Allow subscript notation to access a BitField.

operator fun get(field: IntegerSlotsEnum): Long

Allow subscript notation to access an IntegerSlotsEnum field.

operator fun get(field: ObjectSlotsEnum): AvailObject

Allow subscript notation to access an ObjectSlotsEnum field.

operator fun get(field: IntegerSlotsEnum, subscript: Int): Long

Allow subscript notation to access an indexed IntegerSlotsEnum field. The first subscript is the field, which must be the last declared integer field (and end with "_"), and the second is the one-based index.

operator fun get(field: ObjectSlotsEnum, subscript: Int): AvailObject

Allow subscript notation to access an indexed ObjectSlotsEnum field. The first subscript is the field, which must be the last declared object field (and end with "_"), and the second is the one-based index.

Link copied to clipboard

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
abstract 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
abstract fun hashOrZero(): Int

Dispatch to the descriptor.

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

If the receiver isNil, evaluate the action. Answer either the non-nil receiver, or the result of the action.

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

Compare corresponding consecutive long slots from the receiver and the otherObject, starting at the beginning at the variable-length section indicated by the integerField. Answer false if any differ, otherwise true.

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

Dispatch to the descriptor.

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

Dispatch to the descriptor.

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

Dispatch to the descriptor.

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

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

Link copied to clipboard
abstract fun makeImmutable(): AvailObject

Dispatch to the descriptor.

Link copied to clipboard
abstract 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
abstract fun makeShared(): AvailObject

Dispatch to the descriptor.

Link copied to clipboard
abstract 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

Dispatch to the descriptor.

Link copied to clipboard

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, answering the value produced by the action. If the receiver was nil, answer nil cast to the action's output type.

Link copied to clipboard
abstract 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.

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

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
abstract fun nameForDebugger(): String

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

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

Answer the number of AvailObject slots.

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

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.

Link copied to clipboard
abstract fun rawPojo(): AvailObject
Link copied to clipboard

Dispatch to the descriptor.

Link copied to clipboard
abstract 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
Link copied to clipboard
operator fun set(bitField: BitField, value: Int)

Allow subscript notation to write to a BitField.

operator fun set(field: IntegerSlotsEnum, value: Long)

Allow subscript notation to write to an IntegerSlotsEnum field.

operator fun set(field: ObjectSlotsEnum, value: A_BasicObject)

Allow subscript notation to write to an ObjectSlotsEnum field.

operator fun set(field: IntegerSlotsEnum, subscript: Int, value: Long)

Allow subscript notation to write to an indexed IntegerSlotsEnum field. The first subscript is the field, which must be the last declared integer field (and end with "_"), and the second is the one-based index.

operator fun set(field: ObjectSlotsEnum, subscript: Int, value: A_BasicObject)

Allow subscript notation to write to an indexed ObjectSlotsEnum field. The first subscript is the field, which must be the last declared object field (and end with "_"), and the second is the one-based index.

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

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
fun setDescriptor(newDescriptor: AbstractDescriptor)

Replace this object's current currentDescriptorAbstractDescriptor].

Link copied to clipboard
abstract 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
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
abstract 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

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

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

Answer whether to show value-specific content in the file name for 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.

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

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
inline fun <R> A_BasicObject.synchronizeIf(syncCondition: Boolean, body: A_BasicObject.() -> R): R

If the provided condition is true, synchronize with the receiver's monitor around the execution of the body function. Otherwise, run the body function without synchronization.

Link copied to clipboard
abstract fun traversed(): AvailObject

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

Link copied to clipboard

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

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.

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

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

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

Link copied to clipboard

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, 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
abstract fun writeSummaryTo(writer: JSONWriter)
Link copied to clipboard
abstract fun writeTo(writer: JSONWriter)