| 1 |
@node Bytecodes |
| 2 |
@section Bytecodes |
| 3 |
|
| 4 |
Bytecodes compiler and interpreter are integral part of ECL |
| 5 |
system. Call to @code{eval} invokes the bytecode compiler and then the |
| 6 |
bytecode interpreter. |
| 7 |
|
| 8 |
@itemize |
| 9 |
@item @file{src/c/compiler.d} - bytecode compiler |
| 10 |
@item @file{src/c/interpreter.d} - bytecode interpreter |
| 11 |
@item @file{src/c/disassembler.d} - bytecode disassembler |
| 12 |
@end itemize |
| 13 |
|
| 14 |
Structure @code{ecl_bytecodes} has the following fields: |
| 15 |
|
| 16 |
@itemize |
| 17 |
@item @code{name} - function name |
| 18 |
@item @code{definition} - function definition in list form |
| 19 |
@item @code{entry} - entry address (function @code{_ecl_bytecodes_dispatch_vararg}) |
| 20 |
@item @code{code_size} - number of bytecodes |
| 21 |
@item @code{code} - stores actual bytecode |
| 22 |
@item @code{data} - non-immediate constants used in the code |
| 23 |
@item @code{file} - file where it was defined |
| 24 |
@item @code{file_position} - position in file where function was created |
| 25 |
@end itemize |
| 26 |
|
| 27 |
Moreover if bytecompiled function is a closure then its structure is |
| 28 |
@code{ecl_bclosure}: |
| 29 |
|
| 30 |
@itemize |
| 31 |
@item @code{code} - closure function (@code{ecl_bytecodes}) |
| 32 |
@item @code{lex} - closure lexical environment |
| 33 |
@item @code{entry} - closure entry address (function @code{_ecl_bclosure_dispatch_vararg}) |
| 34 |
@end itemize |
| 35 |
|
| 36 |
@subsection Bytecode compiler |
| 37 |
|
| 38 |
@subsection Bytecode interpreter |
| 39 |
|
| 40 |
@subsection Bytecode disassembler |
| 41 |
|
| 42 |
@defun si:bc-split function |
| 43 |
Returns five values: lex, bytecodes, data and name. |
| 44 |
@end defun |