Next: , Up: syslib codes   [Index]


12.24.1 Safe code objects operations

Code objects contain compiled binary code ready to be executed by the host’s processor. Code objects for details on the code object’s internals. In the following definitions: the code arguments must be code objects. The following bindings are exported by the library (vicare system code-objects).

Function: make-code code-size freevars-num

Build and return a new “empty” code object. The argument code-size is the number of bytes allocated in the data area of the object, to be filled later with machine code; it is a non–negative fixnum. The argument freevars-num is the number of free variables referenced by the machine code; it is a non–negative fixnum.

Function: code? obj

Return #t if obj is a code object.

Function: code-size code

Return a non–negative fixnum representing the number of bytes allocated in the data area of the object.

Function: code-freevars code

Return a non–negative fixnum representing the number of free variables referenced by the machine code.

Function: set-code-reloc-vector! code reloc-vec
Function: code-reloc-vector code

Setter and getter for the relocation vector.

Function: code-set! code idx octet

Store the octet at index idx in the data area of the code object. idx must be a non–negative fixnum. octet must be part of the machine code.

Function: code-ref code idx

Return the octet at index idx in the data area of the code object.

Function: set-code-annotation! code ann

Set the code annotation. Return unspecified values.

Function: code->thunk code

Return a closure object associated to the code object.

Function: procedure-annotation proc

Return the procedure annotation of the closure object proc.

Function: code-reloc-vector->sexp code

Extract the relocation vector from code and compose a symbolic expression representing its fields; return the symbolic expression. code must be a code object or a closure object or a vector object.


Next: , Up: syslib codes   [Index]