[PATCH] fix for #1689 (argc check with -O0)
Attached is a patch to address #1689 by moving the argc check for a known procedure call into the analysis phase (on first analysis) so that even with -O0 this check is done, as runtime-checks are disabled for such calls in general. felix ATTACH /home/felix/chicken/chicken-core/../0001-Check-known-call-argument-count-in-analysis-phase.patch
[PATCH] force finalizers only if finalizers exist
This patch disables the final GC for finalizer forcing at normal program termination if no finalizers are live as the GC is unnecessary in such cases. felix From fe21a1e2d61196d07f766fac87d8bf54dcc95336 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 7 Apr 2020 12:40:22 +0200 Subject: [PATCH] Only force finalizers at program cleanup when live finalizer count is non-zero --- library.scm | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library.scm b/library.scm index 199057f7..edee62aa 100644 --- a/library.scm +++ b/library.scm @@ -5002,10 +5002,11 @@ EOF (unless (null? tasks) (for-each (lambda (t) (t)) tasks) (loop - (when (##sys#debug-mode?) -(##sys#print "[debug] forcing finalizers...\n" #f ##sys#standard-error)) - (when (chicken.gc#force-finalizers) -(##sys#force-finalizers))) + (when (fx> (##core#inline "C_i_live_finalizer_count") 0) +(when (##sys#debug-mode?) + (##sys#print "[debug] forcing finalizers...\n" #f ##sys#standard-error)) +(when (chicken.gc#force-finalizers) + (##sys#force-finalizers (set! chicken.base#exit-handler (make-parameter -- 2.21.0
Re: [PATCH] fix for #1689 (argc check with -O0)
On Tue, Apr 07, 2020 at 12:48:12PM +0200, felix.winkelm...@bevuta.com wrote: > Attached is a patch to address #1689 by moving the argc check for a known > procedure call into the analysis phase (on first analysis) so that even with > -O0 > this check is done, as runtime-checks are disabled for such calls in general. > > felix > ATTACH > /home/felix/chicken/chicken-core/../0001-Check-known-call-argument-count-in-analysis-phase.patch Hi Felix, Looks like something went wrong with the attachment (it's not in the mail). Cheers, Peter signature.asc Description: PGP signature
Re: [PATCH] force finalizers only if finalizers exist
felix.winkelm...@bevuta.com writes: > This patch disables the final GC for finalizer forcing at normal program > termination > if no finalizers are live as the GC is unnecessary in such cases. How about possible pending finalizers? > > felix
Re: [PATCH] force finalizers only if finalizers exist
> > felix.winkelm...@bevuta.com writes: > > > This patch disables the final GC for finalizer forcing at normal program > > termination > > if no finalizers are live as the GC is unnecessary in such cases. > > How about possible pending finalizers? You mean pending from a previous GC? I'm not sure - shouldn't they already be executed at this stage? felix
Re: [PATCH] fix for #1689 (argc check with -O0)
> On Tue, Apr 07, 2020 at 12:48:12PM +0200, felix.winkelm...@bevuta.com wrote: > > Attached is a patch to address #1689 by moving the argc check for a known > > procedure call into the analysis phase (on first analysis) so that even > > with -O0 > > this check is done, as runtime-checks are disabled for such calls in > > general. > > > > felix > > ATTACH > > /home/felix/chicken/chicken-core/../0001-Check-known-call-argument-count-in-analysis-phase.patch > > Hi Felix, > > Looks like something went wrong with the attachment (it's not in the > mail). Ugh. Sorry. From c9108e339bf36ad6c900b8a5607f30e132f5be8a Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 7 Apr 2020 12:45:58 +0200 Subject: [PATCH] Check known call argument count in analysis phase This was done in the optimizer previously but will be disabled with -O0. See also #1689 --- core.scm | 12 +++- optimizer.scm | 8 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core.scm b/core.scm index a490915a..272a1f77 100644 --- a/core.scm +++ b/core.scm @@ -2122,7 +2122,17 @@ (grow 1) (let ([fun (car subs)]) (when (eq? '##core#variable (node-class fun)) - (let ((name (first (node-parameters fun + (let* ((name (first (node-parameters fun))) + (val (db-get db name 'value))) + (when (and first-analysis +val +(not (db-get db name 'unknown)) +(eq? '##core#lambda (node-class val)) +(not (llist-match? (third (node-parameters val)) + (cdr subs +(quit-compiling + "known procedure called with wrong number of arguments: `~A'" + (real-name name))) (collect! db name 'call-sites (cons here n (walk (first subs) env localenv fullenv here) (walkeach (cdr subs) env localenv fullenv here))) diff --git a/optimizer.scm b/optimizer.scm index bcf0148f..92634de0 100644 --- a/optimizer.scm +++ b/optimizer.scm @@ -1649,10 +1649,6 @@ (cond [(eq? fnvar (first fnp)) (set! ksites (alist-cons #f n ksites)) (cond [(eq? kvar (first arg0p)) - (unless (= argc (length (cdr subs))) - (quit-compiling - "known procedure called recursively with wrong number of arguments: `~A'" - fnvar) ) (node-class-set! n '##core#recurse) (node-parameters-set! n (list #t id)) (node-subexpressions-set! n (cddr subs)) ] @@ -1660,10 +1656,6 @@ => (lambda (a) (let* ([klam (cdr a)] [kbody (first (node-subexpressions klam))] ) - (unless (= argc (length (cdr subs))) -(quit-compiling - "known procedure called recursively with wrong number of arguments: `~A'" - fnvar) ) (node-class-set! n 'let) (node-parameters-set! n (take (third (node-parameters klam)) 1)) (node-subexpressions-set! -- 2.21.0