We need to compile the function body in the same environment in which
the function was defined. However the function arguments need to be
compiled in the current argument.
Fixes#577.
Unify handling of LAMBDA and LAMBDA-BLOCK in c1funcall and c1apply,
split off computation of let bindings and body in
optimize-funcall/apply-lambda into a separate function.
Preliminary work to fix inlining of local closures.
We can't use ecl_process_env_unsafe() == NULL to check if ECL has
booted because the return value of ecl_process_env_unsafe is
unpredictable before ECL has booted. The reason is that
ecl_process_env_unsafe calls pthread_getspecific with an uninitialized
key stored in cl_env_key. But another call to pthread_setspecific
might have already registered a key which happens to be the same as
the not yet initialized cl_env_key, yielding a non-NULL value.
Only call handlers established in the current thread and use atomic
operations to update *descriptor-handlers*.
Closes#588.
Additionally:
- improve the test code
- add a test for the leak
- provide internet machine link for the tutorial
That makes lambda with a declaration si:function-block-name behave
consistently with ext:lambda-block (and in eval-macros
ext:lambda-block expands to have this declaration too to behave in
turn consistently with how the compiler treats ext:lambda-block).
Recursive locks may be determined from the object header while reading
the counter is wrong, because at a time of testing with the CV counter
may be exactly 1 despite the fact that the lock is recursive.
If getrlimit fails, new_size may be zero. Furthermore, getrlimit may also return
RLIM_INFINITY in which case new_size is way to large. In both cases the real stack size is
unknown and we can only use some sensible default.
The ifdef in config-internal.h was buggy since RLIMIT_STACK is only defined after
sys/resource.h has been included which it wasn't. This lead to the stack size always being
increased to at least the default of 1 MB. To fix this, we move the check for RLIMIT_STACK
to the configure script.
this is needed e.g. for constructions like
for (int i,...); by default some compilers in older Linux
systems, eg Ubuntu Trusty, still default to C89, giving a build error.
This fix will try to make sure that C99 is used, with an extra option.
We can't use the ECL_WITH_SPINLOCK_BEGIN/END macros since they check
for pending interrupts at the end of their unwind-protect frame. This
leads to various bugs:
- in queue_signal the to be queued interrupt is executed immediately
after being queued even if interrupts are disabled
- in pop_signal if multiple interrupts are queued they are executed in
reverse order
To fix these issues, use a) ecl_get/giveup_spinlock directly and b)
ecl_disable/enable_interrupts_env to prevent the spinlock not being
released due to an interrupt happening during the execution of the
main body of pop_signal/queue_signal.
We need to save env->nvalues before calling cl_set on any variable
because cl_set overwrites env->nvalues. Otherwise, we only get nil for
any variable after the first special one.
Fixes#591.
The spec says:
The generic function make-instances-obsolete is invoked
automatically by the system when defclass has been used to
redefine an existing standard class and the set of local slots
accessible in an instance is changed or the order of slots in
storage is changed. It can also be explicitly invoked by the user.
If the local slot's class is changed then indeed the set has
changed. We also check whether the slot class is S-D-S-D or S-E-S-D
and in both cases we also decide that layouts are not compatible.
Fixes#586.
Improves compilation speed for single functions by about 40-50
percent. Precompiled headers are specific to the compiler version and
options in use. Due to this, we regenerate the header whenever the
compiler configuration changes.
According to the spec, we should compare values using equalp if two
matching keys are found, but we were only checking if matching keys
exist.
Fixes#587.
Getting this lock in thread_entry_point was problematic: when the
thread was killed from another thread the catch point in
thread_entry_point was reached and the call to ecl_get_spinlock was
skipped. This lead to threads exiting without protection and to
segfaults.
Doing it the other way around leads to race conditions, since an
unlucky interrupt arriving just after the mprotect call (but before
the the_env->disable_interrupts = 0 write) will write protect the
environment again, leading to a segfault. This is no problem if
SIGSEGV is unblocked (in which case we will just enter sigsegv_handler
again and arrive at the same point). However if SIGSEGV is blocked (and
another segfault arises) the whole process will die.