|
|
6.93 Memory
- Defined in namespace Smalltalk
- Category: Language-Implementation
- I provide access to actual machine addresses of OOPs and objects. I
have no instances; you send messages to my class to map between an object
and the address of its OOP or object. In addition I provide direct
memory access with different C types (ints, chars, OOPs, floats,...).
6.93.1 Memory class: accessing
- at: anAddress
- Access the Smalltalk object (OOP) at the given address.
- at: anAddress put: aValue
- Store a pointer (OOP) to the Smalltalk object identified by `value' at the given address.
- bigEndian
- Answer whether we're running on a big- or little-endian system.
- charAt: anAddress
- Access the C char at the given address. The value is returned as a Smalltalk Character.
- charAt: anAddress put: aValue
- Store as a C char the Smalltalk Character or Integer object identified by `value', at the given address, using sizeof(char) bytes - i.e. 1 byte.
- deref: anAddress
- Access the C int pointed by the given address
- doubleAt: anAddress
- Access the C double at the given address.
- doubleAt: anAddress put: aValue
- Store the Smalltalk Float object identified by `value', at the given address, writing it like a C double.
- floatAt: anAddress
- Access the C float at the given address.
- floatAt: anAddress put: aValue
- Store the Smalltalk Float object identified by `value', at the given address, writing it like a C float.
- intAt: anAddress
- Access the C int at the given address.
- intAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(int) bytes.
- longAt: anAddress
- Access the C long int at the given address.
- longAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(long) bytes.
- shortAt: anAddress
- Access the C short int at the given address.
- shortAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(short) bytes.
- stringAt: anAddress
- Access the string pointed by the C `char *' at the given given address.
- stringAt: anAddress put: aValue
- Store the Smalltalk String object identified by `value', at the given address in memory, writing it like a *FRESHLY ALLOCATED* C string. It is the caller's responsibility to free it if necessary.
- ucharAt: anAddress put: aValue
- Store as a C char the Smalltalk Character or Integer object identified by `value', at the given address, using sizeof(char) bytes - i.e. 1 byte.
- uintAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(int) bytes.
- ulongAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(long) bytes.
- unsignedCharAt: anAddress
- Access the C unsigned char at the given address. The value is returned as a Smalltalk Character.
- unsignedCharAt: anAddress put: aValue
- Store as a C char the Smalltalk Character or Integer object identified by `value', at the given address, using sizeof(char) bytes - i.e. 1 byte.
- unsignedIntAt: anAddress
- Access the C unsigned int at the given address.
- unsignedIntAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(int) bytes.
- unsignedLongAt: anAddress
- Access the C unsigned long int at the given address.
- unsignedLongAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(long) bytes.
- unsignedShortAt: anAddress
- Access the C unsigned short int at the given address.
- unsignedShortAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(short) bytes.
- ushortAt: anAddress put: aValue
- Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(short) bytes.
6.93.2 Memory class: basic
- addressOf: anObject
- Returns the address of the actual object that anObject references. The result might be invalidated after a garbage collection occurs. Sending this method to Memory is deprecated; send it to ObjectMemory instead.
- addressOfOOP: anObject
- Returns the address of the OOP (object table slot) for anObject. The result is still valid after a garbage collection occurs. Sending this method to Memory is deprecated; send it to ObjectMemory instead.
- type: aType at: anAddress
- Returns a particular type object from memory at anAddress
- type: aType at: anAddress put: aValue
- Sets the memory location anAddress to aValue
|