Commit graph

1531 commits

Author SHA1 Message Date
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
Daniel Kochmanski
5836dc8bec cmp: builder: warn ASDF that it does the wrong thing.
It shouldn't call compute-init-name.
2017-07-21 18:11:55 +02:00
Daniel Kochmanski
b4a83d2955 cmp: make init function name always unique
Add wrapper separately.
2017-07-21 18:11:13 +02:00
Daniel Kochmanski
d1be9436aa cosmetic: add informative comments 2017-07-21 18:10:03 +02:00
Daniel Kochmanski
9061653116 cosmetic: remove gross aux 2017-07-21 17:24:21 +02:00
Daniel Kochmanski
17e4c5de65 cosmetic: don't leave empty line 2017-07-21 17:23:30 +02:00
Daniel Kochmanski
cffe43f9ae normalize-build-target-name: normalize :fasb 2017-07-21 17:21:39 +02:00
Daniel Kochmanski
cc61a627c2 cosmetic: improve C source comment 2017-07-21 16:32:39 +02:00
Daniel Kochmanski
78fc83e4c9 cmpmain: remove unused variable 2017-07-21 12:04:30 +02:00
Daniel Kochmanski
f42cb506e0 cleanup: fix invalid invocation 2017-07-21 11:38:45 +02:00
Daniel Kochmanski
4d4b01b585 cmp: safe-run-program: refactor to print output on error 2017-07-21 10:48:44 +02:00
Daniel Kochmanski
a15cf408c3 cmp: collect-lines: move function to cmputil
cmputil is moved higher in the dependency tree
2017-07-21 10:45:13 +02:00
Daniel Kochmanski
b2a9100ee7 cosmetic: indent +cmp-module-files+ definition 2017-07-21 10:33:41 +02:00