Commit graph

6646 commits

Author SHA1 Message Date
Marius Gerbershagen
30fa0cd7a5 reader: fix do_patch_sharp for bclosures
do_patch_sharp was erroneously returning only the bytecode,
    stripping away the lexical environment.
2018-09-01 17:32:45 +02:00
Marius Gerbershagen
741a01da09 reader: fix reading of bclosures
The syntax had been changed in commit
    991bc3ab78, but the reader macro
    became broken in the process and commit
    835e85bc99 removed the broken
    parts. Since the reason for the change in the syntax is unclear,
    go back to the old syntax.
2018-09-01 17:31:19 +02:00
Marius Gerbershagen
ba6e6ddde7 reader: don't treat -. and +. as a number
CLHS section 2.3.1 mandates that all numbers must contain at least
    one digit. Fixes #427.
2018-08-23 22:55:23 +02:00
Marius Gerbershagen
3201b545e1 reader: don't allow a package prefix in an uninterned symbol
Fixes #439.
2018-08-21 20:08:00 +02:00
Marcin Kolenda
f9b371ddbf rm rsym from util Makefile -- rsym.c doesn't exist
Checked with ack-grep if it isn't mentioned in other places - it isn't.

Looked in repo history what is rsym.c - haven't found anything
2018-08-10 07:53:25 +02:00
Marius Gerbershagen
a7353369ea threading: faster interrupt safe frame/binding stack manipulations
Only use one memory barrier for pushing in the frame/binding stack
    and ensure interrupt safety by saving/restoring the stack frame in
    which writes could happen during an interrupt.
2018-08-04 17:21:16 +02:00
Marius Gerbershagen
319b7ef79b doc: document :object and :long-double ffi types 2018-07-29 15:41:20 +02:00
Marius Gerbershagen
abd4e66f48 stop ecl_frs_push from setting frs_val to often
The following code `(LOOP (BLOCK NIL (RETURN)))` would produce an
    error. ecl_frs_push would correctly set __frame->frs_val the first
    time, however later on control would jump to the statement after
    ecl_setjmp and __frame->frs_val would be set again, this time to a
    wrong value. Fixes #446.
    Also, we don't need to pass val to _ecl_frs_push anymore, so this
    argument has been removed.
2018-07-22 11:10:22 +02:00
Yuguo Zhang
5db3a78208 ecl_open_stream, close invalid fd cause crash on windows platform.
actually, the build process will terminated when loading
cmp/cmpos-features.lsp

related function is:

(with-open-file (s fc :direction :output :if-exists :overwrite
                      :if-does-not-exists :create)

it's a MS feature called security-enhanced CRT.
2018-07-22 14:12:59 +08:00
Yuguo Zhang
2283656b24 ecl_open_stream: treat new file as exists after been created. 2018-07-10 09:26:30 +08:00
Marius Gerbershagen
a3e1cf7c78 cmp: correctly restore compile-file(-pathname) in ext:install-c-compiler
After a call to ext:install-c-compiler while the bytecodes compiler
    is installed, compile-file and compile-file-pathname still point
    to bc-compile-file and bc-compile-file-pathname. Reported and
    fixed by gitlab user pouar. Fixes #444.
2018-07-08 17:33:09 +02:00
Marius Gerbershagen
aad6d252d6 tests: fix embedding tests on mingw
We need to set the path environment variable for the test programs to
    find ecl.dll
2018-07-07 22:16:50 +02:00
Marius Gerbershagen
2ad7cef5dd fix exit code of processes in si_waitpid on windows
GetExitCodeProcess returns the exit code in a DWORD, which is an
    unsigned integer, however main functions usually return a signed int, so
    we need put in an explicit type cast.
2018-07-07 22:16:50 +02:00
Marius Gerbershagen
fb643f6b0f buildsystem: fix building for mingw64
mingw64 also defines __MINGW32__ and sets the host system type to
    be x86_64-w64-mingw32, so we only need to change the way we detect this
    in aclocal.m4.
2018-07-07 22:16:49 +02:00
Marius Gerbershagen
442b41241f add :wsock to *features*
This is needed internally in mislib.lsp.
2018-07-07 22:16:15 +02:00
Daniel Kochmański
d595f98a5b Merge branch 'fix-429-compile-closure' into 'develop'
Fix #429

Closes #429

See merge request embeddable-common-lisp/ecl!110
2018-07-04 14:58:57 +00:00
Marius Gerbershagen
b56c9c12be doc: fix section about the interpreter lexical environment 2018-06-24 15:48:09 +02:00
Marius Gerbershagen
3bd980ce43 bytecmp: improve closure generation for macros
Only close around functions and variables when actually needed.
    Reverse changes to compiler environment, since we need the
    bytecode and native compiler environemnts to be
    similar (si::eval-with-env is called in the native compiler with
    its own compiler environment, so having symbol macros both
    c_env->variables and c_env->macros could be problematic).
2018-06-24 15:47:55 +02:00
Marius Gerbershagen
25a72ff80a cosmetic: indentation fixes and some comments 2018-06-23 21:37:26 +02:00
Marius Gerbershagen
d27f1494e1 cmp: fix compile call for closures
Signal an error for compilation of cclosures. Allow for
    compilation of bclosures over macros, functions and variables.
    Macros are simply added to the compiler environment. For functions
    and variables we enclose the definition of the closure in
    appropiate let/flet forms, e.g. for `(lambda () (fun var))'
    closing over the function `fun' and variable `var':
    (let ((var ...))
      (flet ((fun (x) ...))
        (lambda () (fun var))))
    Closures over tags and blocks are not implemented and will signal
    an error during compilation.
2018-06-23 21:37:26 +02:00
Marius Gerbershagen
b0a7684f2f bytecmp: Allow compilation of closures over macros
Change lexenv to include local macro definitions at the end of the
    lexenv list. If a function is defined in a non-nil macro
    environment, a bclosure is created during compilation which has as
    its lexenv only the macros it closes over. During interpretation,
    ecl_close_around adds to this the variables, functions, blocks
    and tags the function also closes over.
    Also close over symbol macros.
2018-06-23 21:37:25 +02:00
Marius Gerbershagen
c7a0b753c9 bytecmp: fix compilation of closures
Extract function name for bclosures in guess_environment and
    signal an error when attempting to compile a cclosure
2018-06-23 21:37:15 +02:00
Marius Gerbershagen
4a20aa14f4 reader: signal error on invalid macro dispatch characters
Before the recent changes to be more ANSI compliant
    with *read-suppress* (commit
    07391b9ced),
    dispatch_macro_character would complain that no dispatch function
    was defined. Now we explicitely signal an error.
2018-06-16 15:26:38 +02:00
Marius Gerbershagen
4d3df3766b printer: fix printing of string input streams
Currently ECL crashes because we did not set the array element
    type for the stack allocated tag. Use the string pool instead.
    This should be plenty fast enough, since the performance of
    printing of string input streams is not important anyway.
2018-06-16 13:04:49 +02:00
Marius Gerbershagen
4e02997d79 printer/reader: call user defined write/read-sequence methods for CLOS streams
Before this change, we called user defined write-string methods
    directly in write-string/write-line but all other operations were
    done inefficiently through generic_write/read_vector.
2018-06-06 22:32:22 +02:00
Marius Gerbershagen
706847293d printer: use si_do_write_sequence in recently optimized printing routines
We don't need cl_write_string, since the CLOS stuff inside there
    is just for optimization. Improves performance for ANSI streams.
2018-06-05 21:30:29 +02:00
Marius Gerbershagen
25e1417dac doc: add dictionary for extensions to ANSI streams 2018-06-01 21:56:40 +02:00
Marius Gerbershagen
dff75dc004 cmp: push the generic function name in the IHS for CLOS methods
Makes debugging easier, since now the backtrace prints the correct
    generic function name instead of some symbol generated by gensym.
2018-05-31 19:48:48 +02:00
Marius Gerbershagen
fd62dc11f8 threading: be more interrupt safe with thread local variables in environment
Also add some comments and use the right interrupt disabling
    mechanism in get_aux_stream.
2018-05-27 20:57:50 +02:00
Marius Gerbershagen
9f8adbbe4e remove unused (sig)altstack option
This functionality has been removed long ago with commit
    1472cc91ef.
2018-05-27 20:30:22 +02:00
Marius Gerbershagen
fd1affa7d0 Print a C backtrace in ecl_thread_internal_error
After the recent changes to the C backtrace interface,
    _ecl_dump_c_backtrace() no longer needs a working lisp
    environment, so we can safely call it here.
2018-05-27 18:21:30 +02:00
Marius Gerbershagen
861e798cd3 Correctly report if variables are bound or not in si_bds_val
For thread local bindings, ECL_NO_TL_BINDING is used to signal an
    unbound variable. Fixes error from #325.
2018-05-27 17:33:48 +02:00
Marius Gerbershagen
2c135e798b printer: fix the recently optimized printing routines
Overflows of the string buffer were not correctly handled.
2018-05-23 22:13:15 +02:00
Marius Gerbershagen
5f621c6e96 printer: use the string pool to optimize more printing routines 2018-05-14 22:20:44 +02:00
Marius Gerbershagen
5947970f6d printer: optimize printing of strings. Fixes #403 2018-05-13 22:32:09 +02:00
Marius Gerbershagen
f104b1f4f0 reader: process lists iteratively in do_patch_sharp
Prevents stack overflows and probably improves performance a
    little bit.
2018-05-12 16:28:45 +02:00
Marius Gerbershagen
f75a43139b ffi: coerce to base strings automatically in ecl_null_terminated_base_string
Don't coerce symbols to strings, since this would be inconsistent
    with the rest of the ffi interface. Fixes #338. Also fix bad type
    checks.
2018-05-11 22:29:25 +02:00
Daniel Kochmanski
4cddf5b466 Open IO fifo in blocking mode and don't use peek-char in listen
Otherwise we can't connect to X server (unix domain socket):
- it is a binary stream (and we get error when we use listen)
- non-blocking io connection doesn't seem to work
2018-05-11 11:35:01 +02:00
Daniel Kochmanski
e3b9919ffa fixes for windows (S_ISFIFO) 2018-05-08 20:05:34 +02:00
Daniel Kochmanski
d4370d1b31 re-add deprecation of rt and profile (rebase thing) 2018-05-08 19:36:11 +02:00
Marius Gerbershagen
b87fc19afb remove no longer needed checks in configure.ac 2018-05-08 19:36:11 +02:00
Marius Gerbershagen
a3a44a0eeb debugger: add C backtrace for windows
Because that needs the DbgHelp library, an additional make
    option has been defined for users, who don't want to link to this
    library. Some msvc Makefile cleanup has also been done.
2018-05-08 19:36:11 +02:00
Marius Gerbershagen
2279361383 debugger: add option to print C backtrace
Split si_dump_c_backtrace up into two functions:
    - _ecl_dump_c_backtrace() (already declared in internal.h, but not
      implemented) using only C functions printing to stderr to be used
      in case of internal errors
    - si_dump_c_backtrace() using lisp functions to be used in the
      debugger
    Remove broken emulation of backtrace and backtrace_symbols
    functions using __builtin_return_address.
2018-05-08 19:36:11 +02:00
Daniel Kochmanski
23d38639b2 define O_NONBLOCK to 0 for non-posix platforms
We use this flag in ecl_open_file to assure that fifos do not block.
2018-05-08 19:33:38 +02:00
Daniel Kochmanski
1972765ab0 fifo files: update documentation, tests and changelog 2018-05-08 19:12:19 +02:00
Daniel Kochmanski
0e84113f84 work better with FIFO files
- file-length always returns nil
- listen returns correct answer on subsequent reads
- open is non-blocking
- doesn't segfault

note that read still may block (not interruptibly!) if we open stream in IO
mode. process will block until other peer writes something to the stream.

Fixes #242.
2018-05-07 22:03:50 +02:00
Daniel Kochmanski
c35f98ef58 ecl_open_stream refactor
We rearrange the code and avoid unnecessary file operations with probe. Some
nesting is removed.
2018-05-07 22:03:50 +02:00
Daniel Kochmanski
d9c4b2a88c Add explicit :TRUNCATE option for :IF-EXISTS in OPEN
In the future we may want to make :SUPERSEDE transaction-like.
2018-05-07 22:03:50 +02:00
Daniel Kochmański
7223534c61 Merge branch 'interface-cleanup' into 'develop'
Interface cleanup

See merge request embeddable-common-lisp/ecl!105
2018-05-04 08:41:13 +00:00
Daniel Kochmański
ca0962cdb3 Printer addresses 2018-05-04 08:38:33 +00:00