newLike

fun newLike(descriptor: AbstractDescriptor, objectToCopy: AvailObjectRepresentation, deltaObjectSlots: Int, deltaIntegerSlots: Int): AvailObject

Create a new AvailObject with the specified descriptor]AbstractDescriptor, the specified number of object slots, and the specified number of long slots. Also copy the fields from the specified object, which must have a descriptor of the same class. If the sizes of the long arrays differ, only transfer the minimum of the two sizes; do the same for the object slots.

It is the client's responsibility to mark the accessed fields as immutable if necessary. Also, any new long fields beyond the end of the original array will be initialized to 0, and any new AvailObject slots will contain a Java null, requiring further initialization by the client.

Return

A new object.

Parameters

descriptor

A descriptor.

objectToCopy

The object from which to copy corresponding fields.

deltaObjectSlots

How many AvailObject fields to add (or if negative, to subtract).

deltaIntegerSlots

How many long fields to add (or if negative, to subtract).