env_size is not computed correctly (neither max size nor current size), these
assertions are meant to help with mending the issue in order to correctly
determine the size of the locals environment.
c_lcl_idx computes the location of the entry in the locals env. It does traverse
the list again, so it adds a little overhead, but this will allow us to
customize it later to compute a location from the bottom.
We are going to change the representation of the local environment, but first we
make identify accessors and put them behind macros.
While doing so the OP_LABELS has been changed to look similar to OP_FLET. Among
other things we cons separately functions into fun_env, but this inefficiency
will be removed later when we address local entries from the frame.base.
As noted in the comment, GCC 12.0 onwards generates an invalid warning about
array bounds when we cast a stack allocated object to cl_object and use it
warning: array subscript ‘union cl_lispunion[0]’ is partly outside array
bounds of ‘struct ecl_stack_frame[1]’ [-Warray-bounds=]
The code is conforming, but apparently GCC IR has generated a dead branch that
accesses the array out of bounds. For time being we disable this warning.
See also:
https://gitlab.com/libeigen/eigen/-/issues/2506https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106274https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
and generally explroe gcc bugzilla for this kind of false positive.
Currently it returns NIL because runtime_stack is not a vector nor a list (or
other lisp structure). Technically we could return a foreign data pointer.
There are two things to fix:
- `bool` is a keyword in C23, so `typedef int bool` is invalid. We
already require C99, so just include stdbool.h instead. This also
means that `bool` and `int` are no longer synonymous, so we have to
be more careful in defining return types for some functions.
- Function definitions and function pointers with unspecified
arguments are no longer valid. Fix the definitions to include
arguments and add casts for the function pointers.
The deftype expansion functions now take two parameters, the type
argument and an environment. More precisely, for an atomic type 'x the
type argument for the expansion function is given by '(x) while for a
non-atomic type '(x y z) it is given by '(x y z). This also fixes the
value of &whole parameters in deftype lambda lists. The new behaviour
is consistent with SBCL and CCL.
Fixes#750
When we don't use mprotect (nor guard page), we allocate the memory manually.
This simplifies some code and makes the booting process less intervened with GC.
We will use this operators to allocate the first environment and stacks so that
there is no circularity between ecl_boot and starting the garbage collector.
The stack is represented as an actually adjustable vector with a fill
pointer. The main difference from other vector constructors is that it does not
modify the process env -- most notably VALUES vector -- and can be safely used
in the interpreter.
In case that someone wants to store the definition when compiling the file, we
need to make sure that the compiler does not error if it has unreadable objects.
This commit replaces capturing whole LEX with an explicit vector of closed
variables. We introduce a set of additional opcodes that deal with closed
entities. Locals are referred as lcl and closed variables as lex.
This commit causes an intentional regression in the bytecodes compiler - we
don't carry over macros and symbol macros, so we can't recompile bytecompiled
function with the native compiler if they reference them.
That will be fixed in a more organized manner after flat closures are in place.
- split c_tag_ref into three functions c_{tag,blk,fun}_ref, clean c_var_ref
small differences between functions made the former harder to read
also update comments about the compiler environment
functions are refactored to have a similar shape and return the
same (internal) structure that denotes the object scope and purpose
- don't push special variables as locations in the environment
that was (an irrelevant) bug, because special variables are not in the en
- rename asm_c to asm_arg_data
This name better resembles the purpose of the operator
When we were compiling bytecodes with LABELS, the function SET-CLOSURE-ENV
exhibited infinite recursion by adding the record as FLET. C.f test "cmp.0100".
The function ecl_fdefinition checks also for lamdbas and whatnot, while all we
need is a lookup in the global namespace for the function name.
This commit also changes how we store SETF function definition -- instead of
maintaining them in a global environment, it is stored along with the symbol.
That saves us from taking a global lock repeatedly.