Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.HEAP.MEMORY

This packages exports a memory abstract class and a concrete subclass implemented as a lisp array of unsigned bytes. License: AGPL3 Copyright Pascal J. Bourguignon 2004 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>

README:

MACRO

Public

WITH-MEMORY (MEMORY &BODY BODY)

Protects access to the memory, giving the memory object a chance to set signal handler, or to acquire locks, and then release them.

GENERIC-FUNCTION

Public

DUMP (MEMORY ADDRESS LENGTH &KEY BYTE-SIZE STREAM MARGIN (BYTE-SIZE 1) (STREAM *STANDARD-OUTPUT*) (MARGIN ))

Print on the STREAM the contents of the MEMORY from the ADDRESS for LENGTH bytes of bit size BYTE-SIZE.

MEMORY-EPILOG (MEMORY)

This function is called after accessing the memory, so that any unlocking for shared memories may be implemented. An alternative is to override MEMORY-OPERATE.

MEMORY-OPERATE (MEMORY THUNK)

This function is called to access the memory, so that any locking/unlocking for shared memories may be implemented. The default method just calls the THUNK. Any specialization of this function must funcall THUNK or CALL-NEXT-METHOD. An alternative is to override MEMORY-PROLOG and MEMORY-EPILOG.

MEMORY-PROLOG (MEMORY)

This function is called before accessing the memory, so that any locking for shared memories may be implemented. An alternative is to override MEMORY-OPERATE.

PEEK-UINT16 (MEMORY ADDRESS)

RETURN: The 16-bit byte at the given ADDRESS of the MEMORY.

PEEK-UINT32 (MEMORY ADDRESS)

RETURN: The 32-bit byte at the given ADDRESS of the MEMORY.

PEEK-UINT64 (MEMORY ADDRESS)

RETURN: The 64-bit byte at the given ADDRESS of the MEMORY.

PEEK-UINT8 (MEMORY ADDRESS)

RETURN: The 8-bit byte at the given ADDRESS of the MEMORY.

POKE-UINT16 (MEMORY ADDRESS VALUE)

DO: Store the 16-bit VALUE into the given ADDRESS of the MEMORY.

POKE-UINT32 (MEMORY ADDRESS VALUE)

DO: Store the 32-bit VALUE into the given ADDRESS of the MEMORY.

POKE-UINT64 (MEMORY ADDRESS VALUE)

DO: Store the 64-bit VALUE into the given ADDRESS of the MEMORY.

POKE-UINT8 (MEMORY ADDRESS VALUE)

DO: Store the 8-bit VALUE into the given ADDRESS of the MEMORY.

VALID-ADDRESS-P (MEMORY ADDRESS)

RETURN: Whether ADDRESS is a valid address of the MEMORY.

SLOT-ACCESSOR

Public

BASE (MEMORY)

The Minimum value for an address in the given memory.

SIZE (MEMORY)

The Number of bytes this memory holds.

Private

Undocumented

BYTES (OBJECT)

SETFBYTES (NEW-VALUE OBJECT)

CLASS

Public

MEMORY

An abstract memory.

MEMORY-VECTOR-64

A 64-bit memory.