cosmetic: add some barebones comments and docs for bytecmp

This commit is contained in:
Daniel Kochmanski 2018-04-06 11:03:14 +02:00
parent 297c4e4250
commit 17ce8c98d8
3 changed files with 47 additions and 3 deletions

View file

@ -1421,7 +1421,7 @@ c_function(cl_env_ptr env, cl_object args, int flags) {
return asm_function(env, function, flags);
}
static int
static int /* XXX: here we look for function in cmpenv */
asm_function(cl_env_ptr env, cl_object function, int flags) {
if (!Null(si_valid_function_name_p(function))) {
cl_object ndx = c_tag_ref(env, function, @':function');

View file

@ -712,7 +712,7 @@ ecl_interpret(cl_object frame, cl_object env, cl_object bytecodes)
Calls the local or global function with N arguments
which have been deposited in the stack.
*/
CASE(OP_LFUNCTION); {
CASE(OP_LFUNCTION); { /* XXX: local function (fix comment) */
int lex_env_index;
GET_OPARG(lex_env_index, vector);
reg0 = ecl_lex_env_get_fun(lex_env, lex_env_index);
@ -724,7 +724,7 @@ ecl_interpret(cl_object frame, cl_object env, cl_object bytecodes)
may be defined in the global environment or in the local
environment. This last value takes precedence.
*/
CASE(OP_FUNCTION); {
CASE(OP_FUNCTION); { /* XXX: global function (fix comment) */
GET_DATA(reg0, vector, data);
reg0 = ecl_fdefinition(reg0);
THREAD_NEXT;

View file

@ -0,0 +1,44 @@
@node Bytecodes
@section Bytecodes
Bytecodes compiler and interpreter are integral part of ECL
system. Call to @code{eval} invokes the bytecode compiler and then the
bytecode interpreter.
@itemize
@item @code{src/c/compiler.d} - bytecode compiler
@item @code{src/c/interpreter.d} - bytecode interpreter
@item @code{src/c/interpreter.d} - bytecode disassembler
@end itemize
Structure @code{ecl_bytecodes} has the following fields:
@itemize
@item @code{name} - function name
@item @code{definition} - function definition in list form
@item @code{entry} - entry address (function @code{_ecl_bytecodes_dispatch_vararg})
@item @code{code_size} - number of bytecodes
@item @code{code} - stores actual bytecode
@item @code{data} - non-immediate constants used in the code
@item @code{file} - file where it was defined
@item @code{file_position} - position in file where function was created
@end itemize
Moreover if bytecompiled function is a closure then its structure is
@code{ecl_bclosure}:
@itemize
@item @code{code} - closure function (@code{ecl_bytecodes})
@item @code{lex} - closure lexical environment
@item @code{entry} - closure entry address (function _ecl_bclosure_dispatch_vararg)
@end itemize
@subsection Bytecode compiler
@subsection Bytecode interpreter
@subsection Bytecode disassembler
@defun{si:bc-split} {@var{funciton}}
Returns five values: lex, bytecodes, data and name.
@end defun