Commit graph

1543 commits

Author SHA1 Message Date
Marius Gerbershagen
24dcb778cf clean up functions creating base strings from C strings
Make functions behave as documented, remove use of legacy names.
    Fixes #462.
2019-01-07 18:43:55 +01:00
Marius Gerbershagen
76941e25dc fix the broken serialization functions for externalizable objects 2018-12-10 18:14:01 +01:00
Marius Gerbershagen
9f4a5d4dd4 disassemble: display generated C source code instead of bytecodes
This behaviour makes more sense, since the ANSI standard mandates
    that disassemble should compile an interpreted function before
    displaying the output (our own documentation even says so).

    Also fixes disassemble for closures.
2018-11-24 19:20:06 +01:00
Marius Gerbershagen
71babf1f99 cmp: prevent spurious error when the compile function fails 2018-11-24 17:58:30 +01:00
Marius Gerbershagen
8a1e7f5c92 cmp: don't mark all lexical variables as crossing function boundaries
The compiler refactor of commit
    7ec2f4a939 introduced an error where
    all lexical variables where marked to cross function boundaries,
    leading them to be stored in volatile variables on the stack.
2018-10-29 19:15:49 +01:00
Marius Gerbershagen
892e21012a cmp: make behaviour of declaim inline more sensible
ECL needs the definition of a function to inline it. Previously,
    this definition would only be saved in the file local environment
    (*cmp-env-root*) but not in the global environment used by
    proclaim. Hence, ECL could only inline functions in the same file.
    Now, we also put the definition of inline functions in the global
    environment during load time. This leads to a behaviour of declaim
    for inline functions, which is consistent with other declarations
    (meaning that the declarations stay only in force during
    compilation, but are proclaimed again at load time of the compiled
    file).
    Fixes #451.
2018-10-28 16:32:55 +01:00
Marius Gerbershagen
7ff23cbb92 cmp: fix inline definition for mp:lock-count 2018-10-17 22:07:53 +02:00
Marius Gerbershagen
8676abe519 cmp: add proclamations for multithreading functions 2018-10-17 22:07:19 +02:00
Daniel Kochmański
4021fbdcf8 Merge branch 'atomic-ops' into 'develop'
Add support for atomic operations

Closes #278

See merge request embeddable-common-lisp/ecl!122
2018-10-15 19:23:52 +00:00
Marius Gerbershagen
239a2aa4f1 threading: add support for atomic operations
We support both compare-and-swap and fetch-and-add (via
    atomic-incf/decf) on the most common places and define an
    extension interface for compare-and-swap similiar to the one in
    SBCL.

    These changes introduce new dependencies on the libatomic_ops
    macros AO_fetch_compare_and_swap and AO_fetch_and_add.
2018-10-15 19:55:39 +02:00
ZhangYuguo
5eeae0d823 build system: suppress some logo(copyright) information for msvc toolchains. 2018-09-23 13:41:22 +00:00
Daniel Kochmanski
703771fc3d Revert "cmp: execute cleanup forms of unwind-protect with interrupts disabled"
This reverts commit b8df7a777c.
2018-09-04 17:53:30 +02: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
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
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
b00e62f9d3 cmp: Allow for compile time evaluation of inlined forms
The following statement:
    (eval-when (:compile-toplevel :load-toplevel :execute)
      (print "test"))
    resulted in an error, since the compiler would expand the print
    statement in a FFI:C-INLINE form, which can't be evaluated at
    compile time.
2018-04-21 15:34:20 +02:00
Marius Gerbershagen
b8df7a777c cmp: execute cleanup forms of unwind-protect with interrupts disabled
Unifies behaviour with ECL_UNWIND_PROTECT.
2018-03-27 19:03:03 +02:00
Marius Gerbershagen
55d6367b6c cmp: add blocks around ecl_frs_push in generated C code
Avoids redefinition of __ecl_frs_push_result if e.g. two tagbodies
    follow each other in the same C block. This redefinition is an
    error in C and compilers will not accept the generated code.
2018-03-27 18:49:23 +02:00
Daniel Kochmański
c09256866f Merge branch 'threading-fixes' into 'develop'
Threading fixes

Closes #419

See merge request embeddable-common-lisp/ecl!100
2018-03-16 15:08:27 +00:00
Daniel Kochmanski
e92cfdf437 Unify compilation environment markers
In both bytecmp and c compiler we use si:function-boundary and
si:unwind-protect-boundary where appropriate. Previously bytecmp used an ad-hoc
special variable for function-boundary and didn't mark unwind-protect at all.

Remove recently-introduced ECI package (maybe we will reintroduce it later when
we'll have a common frontend for compilers).
2018-02-15 12:44:49 +01:00
Daniel Kochmanski
50fb814fd1 Accept all valid function names in c::compile
Previously we accepted only symbols, now we use si:valid-funciton-name-p
predicate to allow (setf foo) as well.
2018-02-13 13:22:12 +01:00
Daniel Kochmanski
d9da8648cd Look up a lexical macro before a compiler macro.
Fixes #83. Fixes #237.
2018-02-12 16:02:00 +01:00
Marius Gerbershagen
59a6d0ae44 threading: ensure that we don't get interrupted during setjmp
Interrupting a thread during setjmp with a call to ecl_unwind
    leads to segmentation faults, since we try to call longjmp
    before the corresponding setjmp has finished. Thus, we also need
    to wait until setjmp has finished before we can set frs_val of
    the frame.
2018-02-10 21:47:39 +01:00
Daniel Kochmanski
7ec2f4a939 Major cleanup for environment mark interpretation
Code was previously written with an assumption, that we know whenever function
crosses lexical for closure boundaries before it is compiled (and env-mark for
such boundries was LB and CB appropriately). Later it has changed, but code was
ready to work with LB and CB marks.

Fix these parts of code and replace it with a single mark ECI:FUNCTION. Also
replace CL:UNWIND-PROTECT boundry mark with ECI:UNWIND-PROTECT so we are less
dependent on use-ing CL package. Adjust comments to have this change.
2018-02-10 20:21:11 +01:00
Daniel Kochmanski
82efbab4c0 cmp: update comments in cmptypes
It contained some information which is no longer valid (and makes it hard to
grok a code if the programmer doesn't know what it does already).
2018-02-10 18:14:51 +01:00
Daniel Kochmanski
cae6f0004d cmp: simplify return-from c1form
Now it accepts 3 arguments (not 4) because variable is taken from blk-var.
2018-02-10 18:14:17 +01:00
Daniel Kochmanski
07843b3e86 Don't depend in tag-ref-{ccb,clb} which are broken anyway
We have dummy variable for that, so we refere to

(var-ref-ccb (tag-var blk))
(var-ref-clb (tag-var blk))

Brokeness comes from the fact that closures are computed after function
compilation pass-1 (and tagbody is inside). Analogous change to the previous
commit in cmpblock.

Also improve comments in cmptypes to make it clear that these parts are not
used. Further refactor could make tag inherit from variable - then we wouldn't
have a dummy variable and unnecessary fields whatsoever.
2018-02-10 18:01:55 +01:00
Daniel Kochmanski
78d4e5f923 Don't depend in blk-ref-{ccb,clb} which are broken anyway
We have dummy variable for that, so we refere to

(var-ref-ccb (blk-var blk))
(var-ref-clb (blk-var blk))

Brokeness comes from the fact that closures are computed after function
compilation pass-1 (and block is inside). Fixes #374.

Also improve comments in cmptypes to make it clear that these parts are not
used. Further refactor could make blk inherit from variable - then we wouldn't
have a dummy variable and unnecessary fields whatsoever.
2018-02-10 17:52:30 +01:00
Daniel Kochmanski
3f9c69d5b3 Add unwind-protect transformation when cleanup-forms are empty
This optimization doesn't buy us much but it doesn't cost us anything
either. Note that it emits c1form in case of expression what means that
expression won't be promoted to top-level form after the reduction.
2018-02-10 17:52:30 +01:00
Daniel Kochmanski
c138be5818 cmp: some cleanup changes
Add missing declarations here and there, remove setf to unused variable etc.
2018-02-10 17:51:53 +01:00
Daniel Kochmanski
48d5420b16 cmp: all baboon have now error message
This is useful for identification, where the problem occured. Also add some
indent and line wrap fixes which are estetic. Comment out unused variable.
2018-02-05 18:11:35 +01:00
Marius Gerbershagen
9227f4e342 fix #409: order of evaluation of values forms
the fix for #330 is unaffected
2017-12-29 16:58:27 +01:00
Marius Gerbershagen
a0a1a54747 don't check type declarations for default values of optional and keyword function arguments
almost all other implementations do the same, so we should also
allow this edge case
2017-12-02 21:49:46 +01:00
Daniel Kochmanski
c771b46c5f feature: export make-stream-from-fd interface 2017-10-11 10:25:59 +02:00
Daniel Kochmanski
2a98ce10fe core: si:copy-stream has three arguments
argument `wait' denots, whenever we wait for EOF or yield when there
is no input available in the first stream.
2017-10-09 09:35:54 +02:00
Daniel Kochmanski
d02ec85d24 ffi: void functions return no values 2017-09-30 20:34:08 +02:00
Daniel Kochmanski
fe392867c3 consistency: defcallback always returns just pointer, not a list
Fixes #223.
2017-09-30 12:23:57 +02:00
Daniel Kochmanski
7db4543051 environ: accept empty list as nil environment
To inherit current process environemnt, user has to pass `:default' as
environ (what is a default value).
2017-09-05 20:17:39 +02:00
Daniel Kochmanski
ee059366db expand-vector-push: simplify error condition
assert, that function takes 2 up to 3 (if extended) arguments.
2017-08-10 20:58:37 +02:00
Daniel Kochmanski
bf310ef23a expand-vector-push: further reduce complexity
use return-from for catching forms of illegal number of arguments.
2017-08-10 20:55:11 +02:00
Daniel Kochmanski
8293fb6eb4 expand-vector-push: reduce complexity (one nesting level less)
catch the infinite recursion and do return-form instead of setting
`whole'.
2017-08-10 20:44:35 +02:00
Daniel Kochmanski
7320c9049c mapcar-expand: fix-typo 2017-08-10 20:32:02 +02:00
Daniel Kochmanski
c2af9fe775 cmp: refactor: expand-vector-push: get rid of one nesting level 2017-08-10 20:23:30 +02:00
Daniel Kochmanski
6d8b0e7f62 compiler: expand-mapcar: issue error at runtime
and compiler warning during compilation.
2017-08-10 20:21:04 +02:00
Daniel Kochmanski
d8552498af builder: wrapper: be more explicit with warnings
Add warning that init-name will be ignored for other entities than libraries.
2017-07-21 21:20:48 +02:00
Daniel Kochmanski
bdd17142fb cosmetic: line wrap 2017-07-21 19:34:01 +02:00
Daniel Kochmanski
b15afe097c builder: wrapper: don't output unnecessary code when non needed 2017-07-21 19:33:45 +02:00
Daniel Kochmanski
5a50195666 builder: don't create wrapper when same as init-name 2017-07-21 19:33:27 +02:00
Daniel Kochmanski
7f13cc7e48 cleanup: cmp: compute-init-name: get rid of wrapping code
code simplification.
2017-07-21 18:15:28 +02:00