| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, ftw.c,
ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S,
lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h,
parser.c, parser.h, parser.l, parser.y, rand.c, rand.h,
regex.c, regex.h, signal.c, signal.h, stream.c, stream.h,
struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h,
termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/conv.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl:
Add 2017 to all copyright headers and strings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c,
filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h,
jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c,
parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h,
share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl,
share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl,
share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl,
share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h,
stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c,
syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c,
unwind.h, utf8.c, utf8.h: Revert to verbatim 2-Clause BSD.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* jmp.S (DEFUN): Separate definition for 64 bit Cygwin,
which doesn't use leading underscores and has an
unusual prologue.
(jmp_save, jmp_restore): Separately defined for 64 bit
Cygwin, due to use of Microsoft 64 bit calling conventions.
* signal.h (struct jmp): In x86-64 version, only on Cygwin,
new members: rsi and rdi. These registers are considered
nonvolatile and so are saved and restored by jmp_save and
jmp_restore.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, METALICENSE, Makefile, args.c, args.h, arith.c,
arith.h, cadr.c, cadr.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, gc.c,
gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, rand.c, rand.h, regex.c, regex.h,
share/txr/stdlib/cadr.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, stream.c, stream.h, struct.c, struct.h,
sysif.c, sysif.h, syslog.c, syslog.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h: Add 2016 copyright.
* linenoise/LICENSE, linenoise/linenoise.c,
linenoise/linenoise.h: Bump one principal author's copyright
from 2014 to 2015. The code is based on a snapshot of 2015
upstream work.
|
|
|
|
|
|
|
|
|
| |
On 64 bit Darwin, sigset_t is 32 bits, sso our small_sigset_t is
actually larger. Let's use unsigned int.
* signal.h (small_sigset_t): Use unsignd int for set member.
* signal.c (small_sigfillset): Change cast to unsigned int.
|
|
|
|
|
|
| |
* jmp.S (jmp_save, jmp_restore): Add PPC64 versions.
* signal.h (struct jmp): Add PPC64 version.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On glibc, sigset_t has a ridiculous size: one kilobyte!
The kernel doesn't access most of it in the sigprocmask call.
Yet it blows up the size of our dynamic frames quite a lot.
In this commit, we define a small_sigset_t type and
use that instead. We convert to the bloated one when
calling the library.
* signal.c (sig_blocked_cache): Type changes to small_sigset_t.
(sig_reload_cache): Retrieve signal mask with sigprocmask into a local
variable, then copy a small portion from that to sig_blocked_cache.
(small_sigfillset): New static function.
(set_sig_handler): Local variables of sigset_t changed to small_sigset_t.
(sig_mask): Arguments are pointers to small_sigset_t. Conversion to
sigset_t done around the call to sigprocmask.
* signal.h (copy_sigset): Inline funtion removed.
(small_sigset_t): New struct type.
(extended_jmp_buf): Member blocked changed to small_sigset_t.
(extended_setjmp): Cast expression updated with small_sigset_t *.
(extended_longjmp): Use assignment instead of copy_sigset.
(sig_blocked_cache, sig_mask): Declarations updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR is moving to custom assembly-language routines.
This is mainly motivated by a very dubious thing done in the
GNU C Library setjmp and longjmp in the name of security.
Evidently, glibc's setjmp "mangles" certain pointer values
which are stored into the jmp_buf buffer. It's been that way
since 2005, evidently. This means that, firstly, all along,
the use of setjmp in gc.c to get registers into a buffer so
they can be scanned has not actually worked properly. More
importantly, this pointer mangling in setjmp and longjmp is
very hostile to a stack copying implementation of delimited
continuations. The reason is that continuations contain
jmp_buf buffers, which get relocated in the process of
capturing and reviving a continuation. Any pointers in a
jmp_buf which point into the captured stack segment have to be
fixed up to point into the relocated location. Mangled
pointers make this difficult, requiring hacks which are
specific to glibc and the machine architecture. We might as
well implement a clean, well-behaved setjmp and longjmp.
* Makefile (jmp.o): New object file.
(dbg/%.o, opt/%.o): New rules for .S prerequisites.
* args.c, arith.c, cadr.c, combi.c, cadr.c, combi.c, debug.c,
eval.c, filter.c, glob.c, hash.c, lib.c, match.c, parser.c,
rand.c, regex.c, signal.c, stream.c, struct.c, sysif.c,
syslog.c, txr.c, unwind.c, utf8.c: Removed <setjmp.h>
include.
* gc.c: Switch to struct jmp and jmp_save, instead
of jmp_buf and setjmp.
* jmp.S: New source file.
* signal.h (struct jmp): New struct type.
(jmp_save, jmp_restore): New function declarations
denoting assembly language routines in jmp.S.
(extended_jmp_buf): Uses struct jmp instead of
setjmp.
(extended_setjmp): Use jmp_save instead of setjmp.
(extended_longjmp): Use jmp_restore instead of
longjmp.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a hack for an ugly problem. A plain old
struct is actually a class in C++, and assignment
to a struct goes thorugh a generated assignment
operator. Unfortunately, C++ doesn't generate
an assignment operator for volatile destinations,
so assignment to a volatile-qualified struct object
is erroneous.
* signal.h (copy_sigset): New inline function
to copy a sigset_t, even if the left hand side
is volatile. This works by stripping the
qualifier.
(sig_save_enable): Use the function.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instances of extended_jmp_buf structure are defined in
automatic storage. The members are manipulated after setjmp
and accessed after returning via longjmp. Therefore, they
should be volatile-qualified.
* signal.h (EJ_DBG_MEMB): Add volatile to dbg_depth.
(extended_jmp_buf): Add volatile on all members in
both versions of the structure.
(extended_setjmp): Cast away volatile when
passing sigset_t to sig_mask.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (do_eval): Check for pending signals.
* parser.c (repl_intr): New static function.
(repl): Set up signal handler for SIGINT around REPL.
* signal.h (sig_deferred): declared.
(sig_check_fast): New inline function/macro.
A bit of a rearrangement here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This speeds up the TXR Lisp interpreter, because do_eval
sets up a debug frame and uses debug_return.
* debug.c (debug_block_s): Symbol removed.
(debug_init): Remove initialization of debug_block_s.
* debug.h (debug_block_s): Declaration removed.
(debug_enter): Do not establish a named block or a catch block;
no time-wasting unwind stack manipulation at all.
The debug_depth variable is managed by the extended setjmp
context now. Provide a return value variable, and a well-defined name to
branch to to exit from the debug block.
(debug_return): Do not use heavy-weight uw_block_return;
simply set the return variable and branch to debug_return_out
label.
* signal.h (EJ_DBG_MEMB, EJ_DBG_SAVE, EJ_DBG_REST,
EJ_OPT_MEMB, EJ_OPT_SAVE, EJ_OPT_REST): New macros.
(extended_jmp_buf): Define optional global state
variables using EJ_OPT_MEMB.
(extended_setjmp): Save and restore optional
globals using EJ_OPT_SAVE and EJ_OPT_RESTORE.
Now debug_depth is saved and restored if
debugging support is compiled in.
* match.c (open_data_source): Remove bogus debug_return
invocations which were uncovered here by changes to the macro.
* eval.c (do_eval, expand_macro): debug_return must now be after
debug_end, because it won't dynamically clean up frames that it doesn't
know about. The set_dyn_env is no longer unreachable in expand_macro;
it is now necessary because debug_return isn't doing the longjmp
that previously restored dyn_env.
|
|
|
|
| |
rather than disabling async signals.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c, arith.h, combi.c, combi.h, debug.c, debug.h, eval.c, eval.h,
filter.c, filter.h, gc.c, gc.h, hash.c, hash.h, lib.c, lib.h,
match.c, match.h, parser.h, rand.c, rand.h, regex.c, regex.h,
signal.c, signal.h, stream.c, stream.h, sysif.c, sysif.h, syslog.c,
syslog.h, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h:
Update.
* LICENSE, METALICENSE: Likewise.
|
|
|
|
|
|
|
|
| |
Use do;while(0) trick instead of local typedef
to cause terminating semicolon to be required.
(sig_restore_enable, sig_restore_disable):
Remove superfluous do { } while (0).
Closing a brace is good enough.
|
|
|
|
|
|
|
|
|
|
| |
(GREP_CHECK): New macro.
(enforce): Rewritten using GREP_CHECK, with new checks.
* arith.c, combi.c, debug.c, eval.c, filter.c, gc.c, hash.c, lib.c,
* lib.h, match.c, parser.l, parser.y, rand.c, regex.c, signal.c,
* signal.h, stream.c, syslog.c, txr.c, unwind.c, utf8.c: Remove
trailing spaces.
|
|
|
|
|
|
|
|
|
| |
(prot1, rel1, mark): Follow rename.
* gc.h (gc_prot_top): Declared.
* signal.h (extended_jmp_buf): New member, gc_pt.
(extended_setjmp): Save and restore gc_prot_top.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added check for setitimer/getitimer which also
checks for <sys/time.h>.
* signal.c (sig_init): Register itimer-real, itimer-virtual,
itimer-prof variables and getitimer and setitimer functions.
(tv_to_usec): New static function.
(getitimer_wrap, setitimer_wrap): New functions.
* signal.h (getitimer_wrap, setitimer_wrap): Declared.
* txr.1: Documented itimers.
|
|
|
|
|
|
|
|
| |
except for signals for which we use alt stack.
* signal.h (sig_save_enable): Do sig_check before
enabling async signals. This caused the !async_sig_enabled assertion
to trip inside make_obj.
|
|
|
|
|
|
|
|
|
|
| |
sig_bus, sig_fpe, sig_kill, sig_usr1, sig_segv, sig_usr2, sig_pipe,
sig_alrm, sig_term, sig_chld, sig_cont, sig_stop, sig_tstp, sig_ttin,
sig_ttou, sig_urg, sig_xcpu, sig_xfsz, sigtalrm, sig_prof, sig_poll,
sig_sys, sig_winch, sig_iot, sig_stkflt, sig_io, sig_lost, sig_pwr):
Remove unused global variables variables.
* signal.h: Remove declarations thereof.
|
|
|
|
|
|
|
|
| |
debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, hash.c,
hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y,
rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c,
stream.h, syslog.c, syslog.h, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Synchronize license header with LICENSE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
segmentation fault that occurs when running out of stack space,
and escape by throwing an exception.
Also, bugfix: save and restore the gc enable/disable state. Without
this, if we are ever running cod in a gc disabled state and it jumps
out, gc stays disabled.
* configure: added check for sigaltstack.
* gc.h (gc_enabled): Declaration added for existing variable.
* signal.c (is_cpu_exception): New static function.
(sig_handler): For cpu_exception type signals that pertain
to the execution of some instruction, turn on async_sig_enabled,
so that the signal is not deferred. Otherwise we will just
return without calling the user-defined handler, restart
the instruction and get into a loop. Also, disable gc around
the handler just in case. One issue is that we might be on
an alternate stack, which gc won't like.
(setup_alt_stack, teardown_alt_stack): New static functions.
(set_sig_handler): If we have sigaltstack, and are asked
to set up a SEGV handler, then set it up on the alternate
stack.
* signal.h (extended_jmp_buf): Adding new member, gc.
(extended_setjmp, extended_longjmp): use gc member
to save and restore the gc_enable state across
setjmp and longjmp.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Saving and restoring of individual variables is very silly
and it's making it difficult to implement function parameters
that are rebindings of special variables.
Let's have a global pointer to a dynamic environment called dyn_env.
Let's make it part of the extended_jmp_buf structure, so that it's
implicitly saved and restored across exception handling.
Special variable lookups go through the dyn_env chain, and fall back on
the global bindings.
To override some specials, we just push a new dynamic environment and
stick them there. (As a bonus, the bindings can even be repeated in the
lexical environment (i.e. the same objects), so they can be found
faster. We have to make sure we remove that environment when we
leave the scope in the normal way. If we unwind out, it is done
automatically by extended_longjmp mechanism.
* eval.c (dyn_env): New global variable.
(lookup_var, lookup_var_l): If env is nil, look in the dyn_env
first, and only if that fails, look in the global bindings top_vb.
* signal.h (extended_jmp_buf): New member, de, for saving/restoring
dyn_env. This structure is now used whether or not we have signals.
(extended_setjmp, extended_longjmp): Updated to save and restore
dyn_env, and to do it regardless of whether there is POSIX signal
support.
(dyn_env): Declared here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile: Use new EXE variable from config.mk.
* configure (exe, have_windows_h): New variables.
Handle situations with .exe suffix; on MiGW, the rm command
doesn't work on executables if the .exe suffix is not given.
New tests for localtime_r and gmtime_r.
* lib.c: Supply declarations which are missing on MinGW because
we use gcc -ansi, because MinGW doesn't follow established conventions
like -D_POSIX_SOURCE. Supply definitions for gmtime_r, localtime_r,
setenv and unsetenv.
* parser.l: Supply declarations which are missing on MinGW.
* signal.h (async_sig_enabled): Declare differently based on
HAVE_POSIX_SIGS.
Misspelled typedef fixed in the code for !HAVE_POSIX_SIGS
that has hitherto not been compiled.
(sig_mask): Wrap declaration in #ifdef HAVE_POSIX_SIGS because
it relies on sigset_t.
* stream.c: Supply declarations which are missing on MinGW.
Include <windows.h> if we have it.
(sleep): Define for Windows.
(statf): Handle missing st_blksize and st_blocks members in struct
stat.
(stream_init): Handle numerous missing S_* macros.
* utf8.c: Supply declarations which are missing on MinGW.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: we are using sigsetjmp but with a jmp_buf structure;
it requires sigjmp_buf!
Performance issue: sigsetjmp is a dog which makes system calls.
Solution: let's roll our own cached version of sigprocmask which
only calls the real sigprocmask when the mask changes. Then
our extended_setjmp will just use regular setjmp, plus our own
custom signal saving and restoring based on the cached version.
* signal.c (sig_blocked_cache): New variable.
(set_sig_handler): Use our sig_mask instead of sigprocmask.
(mem_set_bits, mem_clr_bits): New static functions.
(sig_mask): New function.
* signal.h (extended_jmp_buf): New member, blocked.
(extended_setjmp): save blocked signals by peeking into
sig_blocked_cache, and restore using sig_mask.
(sig_blocked_cache, sig_mask): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* signal.c (sig_hup, sig_int, sig_quit, sig_ill, sig_trap, sig_abrt,
sig_bus, val sig_fpe, sig_kill, sig_usr1, sig_segv, sig_usr2, sig_pipe,
sig_alrm, val sig_term, sig_chld, sig_cont, sig_stop, sig_tstp,
sig_ttin, val sig_ttou, sig_urg, sig_xcpu, sig_xfsz, sigtalrm,
sig_prof, val sig_poll, sig_sys, sig_winch, sig_iot, sig_stkflt,
sig_io, sig_lost, sig_pwr): New variables.
(sig_init): New variables initialized.
* signal.h: New variables declared.
|
|
* Makefile (OBJS-y): Include signal.o if have_posix_sigs is "y".
* configure (have_posix_sigs): New variable, set by detecting POSIX
signal stuff.
* dep.mk: Regenerated.
* arith.c, debug.c, eval.c, filter.c, hash.c, match.c, parser.y,
parser.l, rand.c, regex.c, syslog.c, txr.c, utf8.c: Include new
signal.h header, now required by unwind, and the <signal.h> system
header.
* eval.c (exit_wrap): New function.
(eval_init): New functions registered as intrinsics: exit_wrap,
set_sig_handler, get_sig_handler, sig_check.
* gc.c (release): Unused functions removed.
* gc.h (release): Declaration removed.
* lib.c (init): Call sig_init.
* stream.c (set_putc, se_getc, se_fflush): New static functions.
(stdio_put_char_callback, stdio_get_char_callback, stdio_put_byte,
stdio_flush, stdio_get_byte): Use new functions to enable
signals when blocked on I/O.
(tail_strategy): Allow signals across sleep.
(pipev_close): Allow signals across waitpid.
(se_pclose): New static function.
(pipe_close): Use new function to enable signals across pclose.
* unwind.c (uw_unwind_to_exit_point): use extended_longjmp instead of
longjmp.
* unwind.h (struct uw_block, struct uw_catch): jb member changes from
jmp_buf to extended_jmp_buf.
(uw_block_begin, uw_simple_catch_begin, uw_catch_begin): Use
extended_setjmp instead of setjmp.
* signal.c: New file.
* signal.h: New file.
|