Merge branch 'gus-massa-18-2-Map-Null'

original commit: 772766cc7ff8735908062ade7da44ce084ae012b
This commit is contained in:
dyb 2018-02-18 20:44:26 -05:00
commit de7a304653
5 changed files with 92 additions and 15 deletions

4
LOG
View File

@ -879,3 +879,7 @@
$verify-ftype-address if the address expression is a call to
ftype-pointer-address.
ftype.ss
- Remove special case for (#2%map p '()) in cp0
so the reduced version checks that p is a procedure.
Also make the same change for #2%for-each.
cp0.ss, 4.ms

View File

@ -1079,6 +1079,10 @@
((1 f k p u a) (2 g l q v b) (3 h m r w c) (4 i n s x d) (5 j o t y e))))
; make sure compiler doesn't bomb w/two few args
(procedure? (lambda (x) (map x)))
(error? ; nonprocedure
(map 3 '()))
(error? ; nonprocedure
(map 3 '() '()))
(error? ; nonprocedure
(map 3 '(a b c)))
(error? ; nonprocedure
@ -1420,6 +1424,10 @@
21)
(procedure? (lambda (x) (fold-left x)))
(procedure? (lambda (x) (fold-left x y)))
(error? ; nonprocedure
(fold-left 3 0 '()))
(error? ; nonprocedure
(fold-left 3 0 '() '()))
(error? ; nonprocedure
(fold-left 3 0 '(a b c)))
(error? ; improper list
@ -1544,6 +1552,10 @@
; make sure compiler doesn't bomb w/two few args
(procedure? (lambda (x) (fold-right x)))
(procedure? (lambda (x) (fold-right x y)))
(error? ; nonprocedure
(fold-right 3 0 '()))
(error? ; nonprocedure
(fold-right 3 0 '() '()))
(error? ; nonprocedure
(fold-right 3 0 '(a b c)))
(error? ; improper list
@ -1722,11 +1734,24 @@
; make sure compiler doesn't bomb w/two few args
(procedure? (lambda (x) (for-each x)))
(error? ; nonprocedure
(for-each 3 '()))
(error? ; nonprocedure
(for-each 3 '() '()))
(error? ; nonprocedure
(for-each 3 '(a b c)))
(error? ; nonprocedure
(parameterize ([optimize-level 3])
(eval '(#2%for-each 3 '(a b c)))))
(error? ; nonprocedure
(parameterize ([optimize-level 3])
(eval
'(let ()
(define (f p b)
(unbox b)
(#2%for-each p (if (box? b) '() '(1 2 3)))
(list p (procedure? p)))
(f 7 (box 0))))))
(error? ; improper list
(for-each pretty-print 'a))
(error? ; improper list
@ -2232,6 +2257,10 @@
(not (ormap (lambda (x y z) #t) '() '() '()))
; make sure compiler doesn't bomb w/two few args
(procedure? (lambda (x) (ormap x)))
(error? ; nonprocedure
(ormap 3 '()))
(error? ; nonprocedure
(ormap 3 '() '()))
(error? ; nonprocedure
(ormap 3 '(a b c)))
(error? ; improper list
@ -2333,6 +2362,10 @@
(eq? (andmap (lambda (x y z) #t) '() '() '()) #t)
; make sure compiler doesn't bomb w/two few args
(procedure? (lambda (x) (andmap x)))
(error? ; nonprocedure
(andmap 3 '()))
(error? ; nonprocedure
(andmap 3 '() '()))
(error? ; nonprocedure
(andmap 3 '(a b c)))
(error? ; improper list
@ -2434,6 +2467,10 @@
(not (exists (lambda (x y z) #t) '() '() '()))
; make sure compiler doesn't bomb w/two few args
(procedure? (lambda (x) (exists x)))
(error? ; nonprocedure
(exists 3 '()))
(error? ; nonprocedure
(exists 3 '() '()))
(error? ; nonprocedure
(exists 3 '(a b c)))
(error? ; improper list
@ -2535,6 +2572,10 @@
(eq? (for-all (lambda (x y z) #t) '() '() '()) #t)
; make sure compiler doesn't bomb w/two few args
(procedure? (lambda (x) (for-all x)))
(error? ; nonprocedure
(for-all 3 '()))
(error? ; nonprocedure
(for-all 3 '() '()))
(error? ; nonprocedure
(for-all 3 '(a b c)))
(error? ; improper list

View File

@ -269,6 +269,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat named-let: "incorrect argument count in call ((letrec ((...)) x) 3 4)".
4.mo:Expected error in mat map: "map: 3 is not a procedure".
4.mo:Expected error in mat map: "map: 3 is not a procedure".
4.mo:Expected error in mat map: "map: 3 is not a procedure".
4.mo:Expected error in mat map: "map: 3 is not a procedure".
4.mo:Expected error in mat map: "map: 7 is not a procedure".
4.mo:Expected error in mat map: "map: a is not a proper list".
4.mo:Expected error in mat map: "map: (a . b) is not a proper list".
@ -291,6 +293,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat map: "map: (a a a a a a ...) is circular".
4.mo:Expected error in mat map: "map: (a a a a a a ...) is circular".
4.mo:Expected error in mat fold-left: "fold-left: 3 is not a procedure".
4.mo:Expected error in mat fold-left: "fold-left: 3 is not a procedure".
4.mo:Expected error in mat fold-left: "fold-left: 3 is not a procedure".
4.mo:Expected error in mat fold-left: "fold-left: a is not a proper list".
4.mo:Expected error in mat fold-left: "fold-left: (a . b) is not a proper list".
4.mo:Expected error in mat fold-left: "fold-left: (a a a a a a ...) is circular".
@ -319,6 +323,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat fold-left: "fold-left: input list was altered during operation".
4.mo:Expected error in mat fold-left: "fold-left: input list was altered during operation".
4.mo:Expected error in mat fold-right: "fold-right: 3 is not a procedure".
4.mo:Expected error in mat fold-right: "fold-right: 3 is not a procedure".
4.mo:Expected error in mat fold-right: "fold-right: 3 is not a procedure".
4.mo:Expected error in mat fold-right: "fold-right: a is not a proper list".
4.mo:Expected error in mat fold-right: "fold-right: (a . b) is not a proper list".
4.mo:Expected error in mat fold-right: "fold-right: (a a a a a a ...) is circular".
@ -341,6 +347,9 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat fold-right: "fold-right: (a a a a a a ...) is circular".
4.mo:Expected error in mat for-each: "for-each: 3 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: 3 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: 3 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: 3 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: 7 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: a is not a proper list".
4.mo:Expected error in mat for-each: "for-each: (a . b) is not a proper list".
4.mo:Expected error in mat for-each: "for-each: (a a a a a a ...) is circular".
@ -374,6 +383,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat for-each: "for-each: input list was altered during operation".
4.mo:Expected error in mat for-each: "for-each: input list was altered during operation".
4.mo:Expected error in mat ormap: "ormap: 3 is not a procedure".
4.mo:Expected error in mat ormap: "ormap: 3 is not a procedure".
4.mo:Expected error in mat ormap: "ormap: 3 is not a procedure".
4.mo:Expected error in mat ormap: "ormap: a is not a proper list".
4.mo:Expected error in mat ormap: "ormap: (a . b) is not a proper list".
4.mo:Expected error in mat ormap: "ormap: (a a a a a a ...) is circular".
@ -407,6 +418,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat ormap: "ormap: input list was altered during operation".
4.mo:Expected error in mat ormap: "ormap: input list was altered during operation".
4.mo:Expected error in mat andmap: "andmap: 3 is not a procedure".
4.mo:Expected error in mat andmap: "andmap: 3 is not a procedure".
4.mo:Expected error in mat andmap: "andmap: 3 is not a procedure".
4.mo:Expected error in mat andmap: "andmap: a is not a proper list".
4.mo:Expected error in mat andmap: "andmap: (a . b) is not a proper list".
4.mo:Expected error in mat andmap: "andmap: (a a a a a a ...) is circular".
@ -440,6 +453,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat andmap: "andmap: input list was altered during operation".
4.mo:Expected error in mat andmap: "andmap: input list was altered during operation".
4.mo:Expected error in mat exists: "exists: 3 is not a procedure".
4.mo:Expected error in mat exists: "exists: 3 is not a procedure".
4.mo:Expected error in mat exists: "exists: 3 is not a procedure".
4.mo:Expected error in mat exists: "exists: a is not a proper list".
4.mo:Expected error in mat exists: "exists: (a . b) is not a proper list".
4.mo:Expected error in mat exists: "exists: (a a a a a a ...) is circular".
@ -473,6 +488,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat exists: "exists: input list was altered during operation".
4.mo:Expected error in mat exists: "exists: input list was altered during operation".
4.mo:Expected error in mat for-all: "for-all: 3 is not a procedure".
4.mo:Expected error in mat for-all: "for-all: 3 is not a procedure".
4.mo:Expected error in mat for-all: "for-all: 3 is not a procedure".
4.mo:Expected error in mat for-all: "for-all: a is not a proper list".
4.mo:Expected error in mat for-all: "for-all: (a . b) is not a proper list".
4.mo:Expected error in mat for-all: "for-all: (a a a a a a ...) is circular".

View File

@ -268,6 +268,10 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat r6rs:case: "invalid syntax (case)".
4.mo:Expected error in mat named-let: "incorrect argument count in call ((letrec ((...)) x) 3 4)".
4.mo:Expected error in mat map: "map: 3 is not a procedure".
4.mo:Expected error in mat map: "map: 3 is not a procedure".
4.mo:Expected error in mat map: "map: 3 is not a procedure".
4.mo:Expected error in mat map: "map: 3 is not a procedure".
4.mo:Expected error in mat map: "map: 7 is not a procedure".
4.mo:Expected error in mat map: "map: a is not a proper list".
4.mo:Expected error in mat map: "map: (a . b) is not a proper list".
4.mo:Expected error in mat map: "map: (a a a a a a ...) is circular".
@ -289,6 +293,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat map: "map: (a a a a a a ...) is circular".
4.mo:Expected error in mat map: "map: (a a a a a a ...) is circular".
4.mo:Expected error in mat fold-left: "fold-left: 3 is not a procedure".
4.mo:Expected error in mat fold-left: "fold-left: 3 is not a procedure".
4.mo:Expected error in mat fold-left: "fold-left: 3 is not a procedure".
4.mo:Expected error in mat fold-left: "fold-left: a is not a proper list".
4.mo:Expected error in mat fold-left: "fold-left: (a . b) is not a proper list".
4.mo:Expected error in mat fold-left: "fold-left: (a a a a a a ...) is circular".
@ -317,6 +323,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat fold-left: "fold-left: input list was altered during operation".
4.mo:Expected error in mat fold-left: "fold-left: input list was altered during operation".
4.mo:Expected error in mat fold-right: "fold-right: 3 is not a procedure".
4.mo:Expected error in mat fold-right: "fold-right: 3 is not a procedure".
4.mo:Expected error in mat fold-right: "fold-right: 3 is not a procedure".
4.mo:Expected error in mat fold-right: "fold-right: a is not a proper list".
4.mo:Expected error in mat fold-right: "fold-right: (a . b) is not a proper list".
4.mo:Expected error in mat fold-right: "fold-right: (a a a a a a ...) is circular".
@ -338,6 +346,10 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat fold-right: "fold-right: (a a a a a a ...) is circular".
4.mo:Expected error in mat fold-right: "fold-right: (a a a a a a ...) is circular".
4.mo:Expected error in mat for-each: "for-each: 3 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: 3 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: 3 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: 3 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: 7 is not a procedure".
4.mo:Expected error in mat for-each: "for-each: a is not a proper list".
4.mo:Expected error in mat for-each: "for-each: (a . b) is not a proper list".
4.mo:Expected error in mat for-each: "for-each: (a a a a a a ...) is circular".
@ -371,6 +383,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat for-each: "for-each: input list was altered during operation".
4.mo:Expected error in mat for-each: "for-each: input list was altered during operation".
4.mo:Expected error in mat ormap: "ormap: 3 is not a procedure".
4.mo:Expected error in mat ormap: "ormap: 3 is not a procedure".
4.mo:Expected error in mat ormap: "ormap: 3 is not a procedure".
4.mo:Expected error in mat ormap: "ormap: a is not a proper list".
4.mo:Expected error in mat ormap: "ormap: (a . b) is not a proper list".
4.mo:Expected error in mat ormap: "ormap: (a a a a a a ...) is circular".
@ -404,6 +418,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat ormap: "ormap: input list was altered during operation".
4.mo:Expected error in mat ormap: "ormap: input list was altered during operation".
4.mo:Expected error in mat andmap: "andmap: 3 is not a procedure".
4.mo:Expected error in mat andmap: "andmap: 3 is not a procedure".
4.mo:Expected error in mat andmap: "andmap: 3 is not a procedure".
4.mo:Expected error in mat andmap: "andmap: a is not a proper list".
4.mo:Expected error in mat andmap: "andmap: (a . b) is not a proper list".
4.mo:Expected error in mat andmap: "andmap: (a a a a a a ...) is circular".
@ -437,6 +453,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat andmap: "andmap: input list was altered during operation".
4.mo:Expected error in mat andmap: "andmap: input list was altered during operation".
4.mo:Expected error in mat exists: "exists: 3 is not a procedure".
4.mo:Expected error in mat exists: "exists: 3 is not a procedure".
4.mo:Expected error in mat exists: "exists: 3 is not a procedure".
4.mo:Expected error in mat exists: "exists: a is not a proper list".
4.mo:Expected error in mat exists: "exists: (a . b) is not a proper list".
4.mo:Expected error in mat exists: "exists: (a a a a a a ...) is circular".
@ -470,6 +488,8 @@ primvars.mo:Expected error in mat trace-output-port: "trace-output-port: #<input
4.mo:Expected error in mat exists: "exists: input list was altered during operation".
4.mo:Expected error in mat exists: "exists: input list was altered during operation".
4.mo:Expected error in mat for-all: "for-all: 3 is not a procedure".
4.mo:Expected error in mat for-all: "for-all: 3 is not a procedure".
4.mo:Expected error in mat for-all: "for-all: 3 is not a procedure".
4.mo:Expected error in mat for-all: "for-all: a is not a proper list".
4.mo:Expected error in mat for-all: "for-all: (a . b) is not a proper list".
4.mo:Expected error in mat for-all: "for-all: (a a a a a a ...) is circular".

View File

@ -3619,14 +3619,18 @@
(cons `(call ,preinfo (ref #f ,p)
,(map (lambda (t*) (build-ref (car t*))) t**) ...)
(g (map cdr t**))))))])
(if (and map? (not (eq? ctxt 'effect)))
(build-primcall lvl 'list results)
(make-seq* ctxt results)))
(if (and map? (not (eq? (app-ctxt ctxt) 'effect)))
(if (null? results)
null-rec
(build-primcall lvl 'list results))
(if (null? results)
void-rec
(make-seq* (app-ctxt ctxt) results))))
(non-result-exp (value-visit-operand! (car ls*))
(build-let (car t**) (car e**)
(f (cdr t**) (cdr e**) (cdr ls*))))))])
(if (fx= lvl 2)
(make-seq ctxt
(make-seq (app-ctxt ctxt)
`(if ,(build-primcall 2 'procedure? (list `(ref #f ,p)))
,void-rec
,(build-primcall 3 '$oops (list `(quote ,(if map? 'map 'for-each))
@ -3642,11 +3646,7 @@
[else #f])))))
(define-inline 2 map
[(?p ?ls . ?ls*)
(if (andmap null-rec? (cons ?ls ?ls*))
(begin
(residualize-seq '() (list* ?p ?ls ?ls*) ctxt)
null-rec)
(inline-lists ?p ?ls ?ls* 2 #t ctxt sc wd name moi))])
(inline-lists ?p ?ls ?ls* 2 #t ctxt sc wd name moi)])
(define-inline 3 map
[(?p ?ls . ?ls*)
(cond
@ -3725,12 +3725,7 @@
(define-inline 2 for-each
[(?p ?ls . ?ls*)
(cond
[(andmap null-rec? (cons ?ls ?ls*))
(residualize-seq '() (list* ?p ?ls ?ls*) ctxt)
void-rec]
[else
(inline-lists ?p ?ls ?ls* 2 #f ctxt sc wd name moi)])])
(inline-lists ?p ?ls ?ls* 2 #f ctxt sc wd name moi)])
(define-inline 3 for-each
[(?p ?ls . ?ls*)
(cond