Object types
The five types of VA Smalltalk objects include:
• Immediate objects
• Pointer objects
• Byte objects
• Word objects
• Long objects
In addition, all of these object types except "immediate" can be marked as one of the following:
• Read-only
• Fixed
Immediate objects
An immediate object's value is represented directly in the object pointer, with no data associated. In VA Smalltalk, true, false, nil, Character, and SmallInteger are immediate. In C, true, false, and nil can be referenced as EsTrue, EsFalse, and EsNil, respectively.
VA Smalltalk SmallIntegers range from -1073741824 to +1073741823.
Character values range from 0 to 65535.
Pointer objects
A pointer object's instance variables or indexed slots contain references to other objects. An example of this type of object is Array.
Byte, word, and long objects
Byte, word, and long objects have no named instance variables. The indexed slots contain bytes, word, or longs, respectively.
Read-only objects
Pointer, byte, word, and long objects can be marked read-only. A read-only object cannot be stored into by Smalltalk.
The following methods relate to read-only objects:
markReadOnly: aBoolean
If aBoolean is true, marks the receiver as read-only. If aBoolean is false, marks the receiver as read-write. Answers true if the receiver is now read-only, false if the receiver is now read-write.
isReadOnly
Answers true if the receiver is read-only, false if not.
Note:
For immediate objects in ROM, this method will always answer true because these objects are always read-only.
attemptedROMStore: storedObject intoSlot: anInteger
Sends this message to a read-only object when an attempt is made to store into it. anInteger is the instance variable index of the slot in the receiver where the store was attempted (this is the same index used by instVarAt:put:). storedObject is the object being stored.
If this method answers true, the store operation is retried. If the receiver has been marked read-write, the store will take place. If not, this message will be sent again. If this method answers false, the store operation is ignored.
Note:
storedObject and anInteger are suitable for instVarAt:Put: not at:put:. If the receiver is a String or DBString, storedObject will be an Integer, not a Character.
Fixed objects
Pointer, byte, word, and long objects can be made fixed. A fixed object will not be moved by the Smalltalk garbage collector. Fixed objects can be used to provide C code with memory that can be used to store results (for example, a buffer for a communications interrupt handler). Once an object has been made fixed, its address does not change.
The following methods relate to fixed objects:
makeFixed
Moves the receiver into fixed space. Answers the receiver. If there is not enough fixed space memory for the receiver, a walkback occurs.
isInFixedSpace
Answers true if the receiver is fixed, false if not.
Note:
Fixed objects that become garbage are not garbage collected until the next time the image is started. At that time, VA Smalltalk can be sure that there are no C code references to the object and the object can safely be collected.
Last modified date: 01/29/2015