Abstract Descriptor
AbstractDescriptor is the base descriptor type. An AvailObject contains a descriptor, to which it delegates nearly all of its behavior. That allows interesting operations like effective type mutation (within a language that does not support it directly, such as Java). It also allows multiple representations of equivalent objects, such as more than one representation for the tuple <1,2,3>. It can be represented as an AvailObject using either an ObjectTupleDescriptor, a ByteTupleDescriptor, a NybbleTupleDescriptor, or a TreeTupleDescriptor. It could even be an IndirectionDescriptor if there is another object that already represents this tuple.
In particular, AbstractDescriptor is abstract and has two children, the class Descriptor and the class IndirectionDescriptor, the latter of which has no classes. When a new operation is added in an ordinary descriptor class (below Descriptor), it should be added with an @Override annotation. A quick fix on that error allows an implementation to be generated in AbstractDescriptor, which should be converted manually to an abstract method. That will make both Descriptor and IndirectionDescriptor (and all subclasses of Descriptor except the one in which the new method first appeared) to indicate an error, in that they need to implement this method. A quick fix can add it to Descriptor, after which it can be tweaked to indicate a runtime error. Another quick fix adds it to IndirectionDescriptor, and copying nearby implementations leads it to invoke the non "o_" method in AvailObject. This will show up as an error, and one more quick fix can generate the corresponding method in AvailObject whose implementation, like methods near it, extracts the AvailObject.descriptor and invokes upon it the original message (that started with "o_"), passing this as the first argument. Code generation will eventually make this relatively onerous task more tractable and less error prone.
Author
Mark van Gulik
Todd L Smith
Parameters
The Mutability of the new descriptor.
The TypeTag to embed in the new descriptor.
The Java Class which is a subclass of ObjectSlotsEnum and defines this object's object slots layout, or null if there are no object slots.
The Java Class which is a subclass of IntegerSlotsEnum and defines this object's object slots layout, or null if there are no integer slots.
Types
An ObjectSlotsEnum that can be passed as a dummy, with explicit ordinal and name when constructing debugger views of objects.
Functions
Ensure that the specified field is writable.
Create a new object whose descriptor is the receiver, and which has the specified number of indexed (variable) slots.
Create a new object whose descriptor is the receiver, and which has the specified number of indexed (variable) slots for objects and ints.
Create a new object whose descriptor is the receiver, and which has the specified number of indexed (variable) slots.
Create a new object whose descriptor is the receiver, and which has the specified number of indexed (variable) slots.
Can an object using this descriptor have more than the minimum number of integer slots?
Can an object using this descriptor have more than the minimum number of object slots?
Answer the immutable version of this descriptor.
Answer how many levels of printing to allow before elision.
Answer the mutable version of this descriptor.
Answer whether the argument types supported by the specified function type are acceptable argument types for invoking a function whose type is self.
Answer whether these are acceptable argument types for invoking a function whose type is self.
Answer whether these are acceptable arguments for invoking a function whose type is self.
Answer whether these are acceptable argument types for invoking a function that is an instance of self. There may be more entries in the tuple than are required by the function type.
Answer whether these are acceptable arguments for invoking a function that is an instance of self. There may be more entries in the tuple than are required by the function type.
Record the fact that the given L2Chunk depends on the object not changing in some way peculiar to the kind of object. Most typically, this is applied to A_Methods, triggering invalidation if A_Definitions are added to or removed from the method, but at some point we may also support slowly-changing variables.
Add the operands and answer the result.
Add the operands and answer the result.
Visit my child phrases with aBlock.
Map my children through the (destructive) transformation specified by aBlock.
Compare a subrange of the receiver with a subrange of the given byte string. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compare a subrange of the receiver with a subrange of the given byte tuple. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compare a subrange of the receiver with a subrange of the given integer interval tuple. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compare a subrange of the receiver with a subrange of the given nybble tuple. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compare a subrange of the receiver with a subrange of the given object tuple. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compare a subrange of the receiver with a subrange of the given repeated element tuple. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compare a subrange of the receiver with a subrange of the given small integer interval tuple. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compare a subrange of the receiver with a subrange of another object. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compare a subrange of the receiver with a subrange of the given two-byte string. The size of the subrange of both objects is determined by the index range supplied for the receiver.
Compute this object's TypeTag, having failed to extract it from the descriptor directly in AvailObjectRepresentation.typeTag.
Answer a fiber's internal debug log.
Describe the object for the IntelliJ debugger.
Divide the operands and answer the result.
Divide the operands and answer the result.
Answer whether the arguments, both objects, are equal in value.
Answer whether the arguments, an object and a byte string, are equal in value.
Answer whether the arguments, an object, and a byte tuple, are equal in value.
Answer whether the receiver, an object, is a character with a code point equal to the integer argument.
Answer whether the arguments, an object and a compiled code, are equal.
Answer whether the arguments, an object and a fiber type, are equal in value.
Answer whether the arguments, an object and a function type, are equal.
Extract a 64-bit signed Java long from the specified Avail integer.
Answer whether the receiver contains the specified element.
Is the specified AvailObject an Avail atom?
Given two objects that are known to be equal, is the first one in a better form (more compact, more efficient, older generation) than the second one?
Is the specified AvailObject an Avail boolean?
Is the specified AvailObject an Avail byte tuple?
Is the specified AvailObject an Avail character?
Is the specified AvailObject an Avail extended integer?
Is the specified AvailObject an Avail function?
Is the specified AvailObject an Avail map?
Is the specified AvailObject an Avail nybble?
Is the specified AvailObject an Avail set?
Is the specified AvailObject an Avail string?
Is the specified AvailObject an Avail tuple?
Is the specified AvailObject an Avail unsigned byte?
Answer a pojo's java object. The type is not statically checkable in Java, but at least making it generic avoids an explicit cast expression at each call site.
Given that the receiver is marked immutable, but its slots have not yet been made immutable, scan them now. For each slot found to be mutable, mark it immutable and add it to the supplied list.
Given that the receiver is marked shared, but its slots have not yet been shared, scan them now. For each slot found to be unshared, mark it and add it to the supplied list.
Add a definition to the receiver. Causes dependent chunks to be invalidated.
Difference the operands and answer the result.
Add a grammatical restriction to the receiver.
Multiply the operands and answer the result.
Multiply the operands and answer the result.
Answer how many arguments my instances expect. This is applicable to both methods and compiled code.
Add the operands and answer the result.
Given two objects that are known to be equal, the second of which is in the form of a tuple type, is the first one in a better form than the second one?
Difference the operands and answer the result.
Difference the operands and answer the result.
Multiply the operands and answer the result.
Print the object to the StringBuilder. By default show it as the descriptor's name and a line-by-line list of fields. If the indent is beyond the maximumIndent, indicate it's too deep without recursing. If the object is in the specified recursion list, indicate a recursive print and return.
Answer the shared version of this descriptor.
Throw an AvailUnsupportedOperationException suitable to be thrown by the sender.
Properties
A Statistic that records the number and size of each allocation.
Used for quickly checking integer fields when AvailObjectRepresentation.shouldCheckSlots is enabled.
Used for quickly checking object fields when AvailObjectRepresentation.shouldCheckSlots is enabled.
The minimum number of integer slots an AvailObject can have if it uses this descriptor. Does not include indexed slots possibly at the end. Populated automatically by the constructor.
The minimum number of object slots an AvailObject can have if it uses this descriptor. Does not include indexed slots possibly at the end. Populated automatically by the constructor.
This read-only property can be used in place of unsupportedOperation. Using the getter produces almost the same diagnostic stack trace when executed, but is a much shorter expression.