* bug#31594: Code causes guild compile to hang
@ 2018-05-25 15:32 Tommi Höynälänmaa
2018-05-27 13:04 ` bug#31594: Information on my system Tommi Höynälänmaa
2018-06-05 22:01 ` bug#31594: Code causes guild compile to hang Mark H Weaver
0 siblings, 2 replies; 4+ messages in thread
From: Tommi Höynälänmaa @ 2018-05-25 15:32 UTC (permalink / raw)
To: 31594
[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]
The following code causes command "guild compile" to hang:
---cut here---
(define (select-nearest-methods binder
index v-fixed-args v-rest-arg vb-included)
(dwl4 "select-nearest-methods")
(assert (is-binder? binder))
(let ((n (vector-length vb-included)))
(do ((i 0 (+ i 1))) ((>= i n))
(if (vector-ref vb-included i)
(let ((t1 (get-item-at-index
(vector-ref v-fixed-args i)
(vector-ref v-rest-arg i)
index)))
(do ((j 0 (+ j 1))) ((>= j n))
(if (and (not (= i j))
(vector-ref vb-included j))
(let ((t2 (get-item-at-index
(vector-ref v-fixed-args j)
(vector-ref v-rest-arg j)
index)))
(if (is-t-subtype? binder t1 t2)
;; t2 is excluded
(vector-set! vb-included j #f))))))))))
---cut here---
However, the following code works fine:
---cut here---
(define (method-loop binder
index v-fixed-args v-rest-arg vb-included t1 i n)
(do ((j 0 (+ j 1))) ((>= j n))
(if (and (not (= i j))
(vector-ref vb-included j))
(let ((t2 (get-item-at-index
(vector-ref v-fixed-args j)
(vector-ref v-rest-arg j)
index)))
(if (is-t-subtype? binder t1 t2)
;; t2 is excluded
(vector-set! vb-included j #f))))))
(define (select-nearest-methods binder
index v-fixed-args v-rest-arg vb-included)
(dwl4 "select-nearest-methods")
(assert (is-binder? binder))
(let ((n (vector-length vb-included)))
(do ((i 0 (+ i 1))) ((>= i n))
(if (vector-ref vb-included i)
(let ((t1 (get-item-at-index
(vector-ref v-fixed-args i)
(vector-ref v-rest-arg i)
index)))
(method-loop binder index v-fixed-args v-rest-arg vb-included
t1 i n))))))
---cut here---
This problem occurs with guile 2.2.3.
- Tommi Höynälänmaa
[-- Attachment #2: Type: text/html, Size: 2646 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#31594: Information on my system
2018-05-25 15:32 bug#31594: Code causes guild compile to hang Tommi Höynälänmaa
@ 2018-05-27 13:04 ` Tommi Höynälänmaa
2018-06-05 22:01 ` bug#31594: Code causes guild compile to hang Mark H Weaver
1 sibling, 0 replies; 4+ messages in thread
From: Tommi Höynälänmaa @ 2018-05-27 13:04 UTC (permalink / raw)
To: 31594
I use Ubuntu 18.04 and I have the following Guile packages installed in
my system:
guile-2.2: 2.2.3+1-3build1
guile-2.2-dev: 2.2.3+1-3build1
guile-2.2-doc: 2.2.3+1-3build1
guile-2.2-libs: 2.2.3+1-3build1
guile-2.0: 2.0.13+1-5build2
guile-2.0-doc: 2.0.13+1-5build2
guile-2.0-libs: 2.0.13+1-5build2
Package guile-2.0-dev is not installed. I have selected guile-2.2 to be
used with
update-alternatives.
- Tommi Höynälänmaa
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#31594: Code causes guild compile to hang
2018-05-25 15:32 bug#31594: Code causes guild compile to hang Tommi Höynälänmaa
2018-05-27 13:04 ` bug#31594: Information on my system Tommi Höynälänmaa
@ 2018-06-05 22:01 ` Mark H Weaver
2018-06-06 2:23 ` Mark H Weaver
1 sibling, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2018-06-05 22:01 UTC (permalink / raw)
To: Tommi Höynälänmaa; +Cc: 31594
Hi,
Tommi Höynälänmaa <tommi.hoynalanmaa@gmail.com> writes:
> The following code causes command "guild compile" to hang:
> ---cut here---
> (define (select-nearest-methods binder
> index v-fixed-args v-rest-arg vb-included)
> (dwl4 "select-nearest-methods")
> (assert (is-binder? binder))
> (let ((n (vector-length vb-included)))
> (do ((i 0 (+ i 1))) ((>= i n))
> (if (vector-ref vb-included i)
> (let ((t1 (get-item-at-index
> (vector-ref v-fixed-args i)
> (vector-ref v-rest-arg i)
> index)))
> (do ((j 0 (+ j 1))) ((>= j n))
> (if (and (not (= i j))
> (vector-ref vb-included j))
> (let ((t2 (get-item-at-index
> (vector-ref v-fixed-args j)
> (vector-ref v-rest-arg j)
> index)))
> (if (is-t-subtype? binder t1 t2)
> ;; t2 is excluded
> (vector-set! vb-included j #f))))))))))
> ---cut here---
I can reproduce this with Guile-2.2.3 on my system running GuixSD.
Simply pasting the above code into a pristine Guile REPL causes it to
hang. I'm able to compile it to cps, but compiling it to bytecode gets
stuck in what appears to be an infinite loop in 'specialize-operations'
in (language cps specialize-numbers).
The backtrace printer also gets stuck in a loop while trying to print
one of the stack frames in (language cps specialize-numbers).
See below for a transcript.
Thanks for the report. To be continued...
Mark
--8<---------------cut here---------------start------------->8---
GNU Guile 2.2.3
Copyright (C) 1995-2017 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (define (select-nearest-methods binder
index v-fixed-args v-rest-arg vb-included)
(dwl4 "select-nearest-methods")
(assert (is-binder? binder))
(let ((n (vector-length vb-included)))
(do ((i 0 (+ i 1))) ((>= i n))
(if (vector-ref vb-included i)
(let ((t1 (get-item-at-index
(vector-ref v-fixed-args i)
(vector-ref v-rest-arg i)
index)))
(do ((j 0 (+ j 1))) ((>= j n))
(if (and (not (= i j))
(vector-ref vb-included j))
(let ((t2 (get-item-at-index
(vector-ref v-fixed-args j)
(vector-ref v-rest-arg j)
index)))
(if (is-t-subtype? binder t1 t2)
;; t2 is excluded
(vector-set! vb-included j #f))))))))))
;;; <stdin>:6:2: warning: possibly unbound variable `dwl4'
;;; <stdin>:7:2: warning: possibly unbound variable `assert'
;;; <stdin>:7:10: warning: possibly unbound variable `is-binder?'
;;; <stdin>:11:16: warning: possibly unbound variable `get-item-at-index'
;;; <stdin>:18:20: warning: possibly unbound variable `get-item-at-index'
;;; <stdin>:22:16: warning: possibly unbound variable `is-t-subtype?'
While compiling expression:
User interrupt
scheme@(guile-user)> ,use (system base compile)
scheme@(guile-user)> (define code '(define (select-nearest-methods binder
index v-fixed-args v-rest-arg vb-included)
(dwl4 "select-nearest-methods")
(assert (is-binder? binder))
(let ((n (vector-length vb-included)))
(do ((i 0 (+ i 1))) ((>= i n))
(if (vector-ref vb-included i)
(let ((t1 (get-item-at-index
(vector-ref v-fixed-args i)
(vector-ref v-rest-arg i)
index)))
(do ((j 0 (+ j 1))) ((>= j n))
(if (and (not (= i j))
(vector-ref vb-included j))
(let ((t2 (get-item-at-index
(vector-ref v-fixed-args j)
(vector-ref v-rest-arg j)
index)))
(if (is-t-subtype? binder t1 t2)
;; t2 is excluded
(vector-set! vb-included j #f)))))))))))
scheme@(guile-user)> ,pp code
$2 = (define (select-nearest-methods
binder
index
v-fixed-args
v-rest-arg
vb-included)
(dwl4 "select-nearest-methods")
(assert (is-binder? binder))
(let ((n (vector-length vb-included)))
(do ((i 0 (+ i 1)))
((>= i n))
(if (vector-ref vb-included i)
(let ((t1 (get-item-at-index
(vector-ref v-fixed-args i)
(vector-ref v-rest-arg i)
index)))
(do ((j 0 (+ j 1)))
((>= j n))
(if (and (not (= i j)) (vector-ref vb-included j))
(let ((t2 (get-item-at-index
(vector-ref v-fixed-args j)
(vector-ref v-rest-arg j)
index)))
(if (is-t-subtype? binder t1 t2)
(vector-set! vb-included j #f))))))))))
scheme@(guile-user)> (define v (compile code #:from 'scheme #:to 'cps))
scheme@(guile-user)> v
$3 = #<intmap 0-122>
scheme@(guile-user)> (define intmap->alist (@@ (language cps intmap) intmap->alist))
scheme@(guile-user)> ,pp (intmap->alist v)
$4 = ((0 . #<cps (kfun () 0 1 122)>)
(1 . #<cps (ktail)>)
(2 . #<cps (kargs (unspecified) (14) (continue 1 (values 14)))>)
(3 . #<cps (kargs () () (continue 2 (unspecified)))>)
(4 . #<cps (kargs (box) (15) (continue 3 (primcall box-set! 15 13)))>)
(5 . #<cps (kargs (name) (16) (continue 4 (primcall define! 16)))>)
(6 . #<cps (kargs (arg) (13) (continue 5 (const select-nearest-methods)))>)
(7 . #<cps (ktail)>)
(8 . #<cps (kargs (arg) (18) (continue 7 (call 7 18)))>)
(9 . #<cps (kargs (loop) (7) (continue 8 (const 0)))>)
(10 . #<cps (ktail)>)
(11 . #<cps (kargs (val) (20) (continue 10 (values 20)))>)
(12 . #<cps (kargs (arg) (21) (continue 10 (call 7 21)))>)
(13 . #<cps (kargs (arg) (22) (continue 12 (primcall add 8 22)))>)
(14 . #<cps (kargs (vals) (23) (continue 13 (const 1)))>)
(15 . #<cps (kreceive () vals 14)>)
(16 . #<cps (kargs (arg) (24) (continue 15 (call 10 24)))>)
(17 . #<cps (kargs (loop) (10) (continue 16 (const 0)))>)
(18 . #<cps (ktail)>)
(19 . #<cps (kargs (val) (26) (continue 18 (values 26)))>)
(20 . #<cps (kargs (arg) (27) (continue 18 (call 10 27)))>)
(21 . #<cps (kargs (arg) (28) (continue 20 (primcall add 11 28)))>)
(22 . #<cps (kargs (vals) (29) (continue 21 (const 1)))>)
(23 . #<cps (kreceive () vals 22)>)
(24 . #<cps (kargs () () (continue 22 (const ())))>)
(25 . #<cps (kargs (unboxed) (31) (continue 24 (primcall vector-set! 1 31 30)))>)
(26 . #<cps (kargs (arg) (30) (continue 25 (primcall scm->u64 11)))>)
(27 . #<cps (kargs (nil) (33) (continue 22 (primcall cons 32 33)))>)
(28 . #<cps (kargs (val) (32) (continue 27 (const ())))>)
(29 . #<cps (kargs () () (continue 26 (const #f)))>)
(30 . #<cps (kargs () () (continue 28 (unspecified)))>)
(31 . #<cps (kargs (arg rest) (34 35) (continue 30 (branch 29 (values 34))))>)
(32 . #<cps (kreceive (arg) rest 31)>)
(33 . #<cps (kargs (arg) (36) (continue 32 (call 36 5 9 12)))>)
(34 . #<cps (kargs (box) (37) (continue 33 (primcall box-ref 37)))>)
(35 . #<cps (kargs (scope) (40) (continue 34 (primcall cached-toplevel-box 40 38 39)))>)
(36 . #<cps (kargs (bound?) (39) (continue 35 (const 0)))>)
(37 . #<cps (kargs (name) (38) (continue 36 (const #t)))>)
(38 . #<cps (kargs (t2 rest) (12 41) (continue 37 (const is-t-subtype?)))>)
(39 . #<cps (kreceive (t2) rest 38)>)
(40 . #<cps (kargs (arg) (44) (continue 39 (call 42 43 44 4)))>)
(41 . #<cps (kargs (unboxed) (45) (continue 40 (primcall vector-ref 2 45)))>)
(42 . #<cps (kargs (arg) (43) (continue 41 (primcall scm->u64 11)))>)
(43 . #<cps (kargs (unboxed) (46) (continue 42 (primcall vector-ref 3 46)))>)
(44 . #<cps (kargs (arg) (42) (continue 43 (primcall scm->u64 11)))>)
(45 . #<cps (kargs (box) (47) (continue 44 (primcall box-ref 47)))>)
(46 . #<cps (kargs (scope) (50) (continue 45 (primcall cached-toplevel-box 50 48 49)))>)
(47 . #<cps (kargs (bound?) (49) (continue 46 (const 0)))>)
(48 . #<cps (kargs (name) (48) (continue 47 (const #t)))>)
(49 . #<cps (kargs () () (continue 48 (const get-item-at-index)))>)
(50 . #<cps (kargs (nil) (52) (continue 22 (primcall cons 51 52)))>)
(51 . #<cps (kargs (val) (51) (continue 50 (const ())))>)
(52 . #<cps (kargs () () (continue 49 (rec)))>)
(53 . #<cps (kargs () () (continue 51 (unspecified)))>)
(54 . #<cps (kargs (arg) (53) (continue 53 (branch 52 (values 53))))>)
(55 . #<cps (kargs (arg) (54) (continue 53 (branch 52 (values 54))))>)
(56 . #<cps (kargs (unboxed) (55) (continue 55 (primcall vector-ref 1 55)))>)
(57 . #<cps (kargs () () (continue 54 (const #f)))>)
(58 . #<cps (kargs () () (continue 56 (primcall scm->u64 11)))>)
(59 . #<cps (kargs () () (continue 19 (unspecified)))>)
(60 . #<cps (kargs () () (continue 58 (branch 57 (primcall = 8 11))))>)
(61 . #<cps (kargs (j) (11) (continue 60 (branch 59 (primcall >= 11 6))))>)
(62 . #<cps (kclause ((j) () #f () #f) 61)>)
(63 . #<cps (kfun ((name . loop)) 25 18 62)>)
(64 . #<cps (kargs (nil) (57) (continue 14 (primcall cons 56 57)))>)
(65 . #<cps (kargs (val) (56) (continue 64 (const ())))>)
(66 . #<cps (kargs (t1 rest) (9 58) (continue 17 (rec (loop 10 (fun 63)))))>)
(67 . #<cps (kreceive (t1) rest 66)>)
(68 . #<cps (kargs (arg) (61) (continue 67 (call 59 60 61 4)))>)
(69 . #<cps (kargs (unboxed) (62) (continue 68 (primcall vector-ref 2 62)))>)
(70 . #<cps (kargs (arg) (60) (continue 69 (primcall scm->u64 8)))>)
(71 . #<cps (kargs (unboxed) (63) (continue 70 (primcall vector-ref 3 63)))>)
(72 . #<cps (kargs (arg) (59) (continue 71 (primcall scm->u64 8)))>)
(73 . #<cps (kargs (box) (64) (continue 72 (primcall box-ref 64)))>)
(74 . #<cps (kargs (scope) (67) (continue 73 (primcall cached-toplevel-box 67 65 66)))>)
(75 . #<cps (kargs (bound?) (66) (continue 74 (const 0)))>)
(76 . #<cps (kargs (name) (65) (continue 75 (const #t)))>)
(77 . #<cps (kargs () () (continue 76 (const get-item-at-index)))>)
(78 . #<cps (kargs (nil) (69) (continue 14 (primcall cons 68 69)))>)
(79 . #<cps (kargs (val) (68) (continue 78 (const ())))>)
(80 . #<cps (kargs () () (continue 77 (rec)))>)
(81 . #<cps (kargs () () (continue 79 (unspecified)))>)
(82 . #<cps (kargs (arg) (70) (continue 81 (branch 80 (values 70))))>)
(83 . #<cps (kargs (unboxed) (71) (continue 82 (primcall vector-ref 1 71)))>)
(84 . #<cps (kargs () () (continue 11 (unspecified)))>)
(85 . #<cps (kargs () () (continue 83 (primcall scm->u64 8)))>)
(86 . #<cps (kargs (i) (8) (continue 85 (branch 84 (primcall >= 8 6))))>)
(87 . #<cps (kclause ((i) () #f () #f) 86)>)
(88 . #<cps (kfun ((name . loop)) 19 10 87)>)
(89 . #<cps (kargs (val) (72) (continue 7 (values 72)))>)
(90 . #<cps (kargs (n) (6) (continue 9 (rec (loop 7 (fun 88)))))>)
(91 . #<cps (kargs (u64) (73) (continue 90 (primcall u64->scm 73)))>)
(92 . #<cps (kargs () () (continue 91 (primcall vector-length 1)))>)
(93 . #<cps (kargs (vals) (74) (continue 92 (rec)))>)
(94 . #<cps (kreceive () vals 93)>)
(95 . #<cps (kargs (arg rest) (76 77) (continue 94 (call 75 76)))>)
(96 . #<cps (kreceive (arg) rest 95)>)
(97 . #<cps (kargs (arg) (78) (continue 96 (call 78 5)))>)
(98 . #<cps (kargs (box) (79) (continue 97 (primcall box-ref 79)))>)
(99 . #<cps (kargs (scope) (82) (continue 98 (primcall cached-toplevel-box 82 80 81)))>)
(100 . #<cps (kargs (bound?) (81) (continue 99 (const 0)))>)
(101 . #<cps (kargs (name) (80) (continue 100 (const #t)))>)
(102 . #<cps (kargs (arg) (75) (continue 101 (const is-binder?)))>)
(103 . #<cps (kargs (box) (83) (continue 102 (primcall box-ref 83)))>)
(104 . #<cps (kargs (scope) (86) (continue 103 (primcall cached-toplevel-box 86 84 85)))>)
(105 . #<cps (kargs (bound?) (85) (continue 104 (const 0)))>)
(106 . #<cps (kargs (name) (84) (continue 105 (const #t)))>)
(107 . #<cps (kargs (vals) (87) (continue 106 (const assert)))>)
(108 . #<cps (kreceive () vals 107)>)
(109 . #<cps (kargs (arg) (89) (continue 108 (call 88 89)))>)
(110 . #<cps (kargs (arg) (88) (continue 109 (const "select-nearest-methods")))>)
(111 . #<cps (kargs (box) (90) (continue 110 (primcall box-ref 90)))>)
(112 . #<cps (kargs (scope) (93) (continue 111 (primcall cached-toplevel-box 93 91 92)))>)
(113 . #<cps (kargs (bound?) (92) (continue 112 (const 0)))>)
(114 . #<cps (kargs (name) (91) (continue 113 (const #t)))>)
(115 . #<cps (kargs (binder index v-fixed-args v-rest-arg vb-included) (5 4 3 2 1) (continue 114 (const dwl4)))>)
(116 . #<cps (kclause ((binder index v-fixed-args v-rest-arg vb-included) () #f () #f) 115)>)
(117 . #<cps (kfun ((name . select-nearest-methods)) 17 7 116)>)
(118 . #<cps (kargs () () (continue 6 (fun 117)))>)
(119 . #<cps (kargs (scope) (95) (continue 118 (primcall cache-current-module! 94 95)))>)
(120 . #<cps (kargs (module) (94) (continue 119 (const 0)))>)
(121 .
#<cps (kargs () () (continue 120 (primcall current-module)))>)
(122 . #<cps (kclause (() () #f () #f) 121)>))
scheme@(guile-user)> (define vb (compile code #:from 'scheme #:to 'bytecode))
ERROR: In procedure scm-error:
User interrupt
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,bt
In current input:
82:11 13 (_)
In system/base/compile.scm:
255:6 12 (compile _ #:from _ #:to _ #:env _ #:opts _)
183:32 11 (compile-fold _ _ _ ())
In language/cps/compile-bytecode.scm:
609:12 10 (compile-bytecode _ #<module (#{ g767}#) 11b5460> ())
603:12 9 (lower-cps _ _)
In language/cps/optimize.scm:
106:0 8 (optimize-first-order-cps _ _)
In language/cps/specialize-numbers.scm:
724:23 7 (specialize-numbers _)
438:10 6 (specialize-operations _)
In language/cps/intmap.scm:
521:5 5 (visit-branch #(#(#<cps (kfun () 0 12 1)> #<cps (kclause (() () #f () #f) 2)> #<cps (kargs () () (continue 3 (primcall current-module…> …) …) …)
521:5 4 (visit-branch #(#<cps (kfun () 0 12 1)> #<cps (kclause (() () #f () #f) 2)> #<cps (kargs () () (continue 3 (primcall current-module)))> # …) …)
In language/cps/specialize-numbers.scm:
--8<---------------cut here---------------end--------------->8---
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#31594: Code causes guild compile to hang
2018-06-05 22:01 ` bug#31594: Code causes guild compile to hang Mark H Weaver
@ 2018-06-06 2:23 ` Mark H Weaver
0 siblings, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2018-06-06 2:23 UTC (permalink / raw)
To: Tommi Höynälänmaa; +Cc: 31594
Mark H Weaver <mhw@netris.org> writes:
> Tommi Höynälänmaa <tommi.hoynalanmaa@gmail.com> writes:
>
>> The following code causes command "guild compile" to hang:
>> ---cut here---
>> (define (select-nearest-methods binder
>> index v-fixed-args v-rest-arg vb-included)
>> (dwl4 "select-nearest-methods")
>> (assert (is-binder? binder))
>> (let ((n (vector-length vb-included)))
>> (do ((i 0 (+ i 1))) ((>= i n))
>> (if (vector-ref vb-included i)
>> (let ((t1 (get-item-at-index
>> (vector-ref v-fixed-args i)
>> (vector-ref v-rest-arg i)
>> index)))
>> (do ((j 0 (+ j 1))) ((>= j n))
>> (if (and (not (= i j))
>> (vector-ref vb-included j))
>> (let ((t2 (get-item-at-index
>> (vector-ref v-fixed-args j)
>> (vector-ref v-rest-arg j)
>> index)))
>> (if (is-t-subtype? binder t1 t2)
>> ;; t2 is excluded
>> (vector-set! vb-included j #f))))))))))
>> ---cut here---
Further investigation reveals that the loop in compute-significant-bits
in (language cps specialize-numbers) fails to terminate. I instrumented
it as follows:
--8<---------------cut here---------------start------------->8---
diff --git a/module/language/cps/specialize-numbers.scm b/module/language/cps/specialize-numbers.scm
index d5587037b..7be0b5e33 100644
--- a/module/language/cps/specialize-numbers.scm
+++ b/module/language/cps/specialize-numbers.scm
@@ -211,9 +211,21 @@
"Given the locally inferred types @var{types}, compute a map of VAR ->
BITS indicating the significant bits needed for a variable. BITS may be
#f to indicate all bits, or a non-negative integer indicating a bitmask."
- (let ((preds (invert-graph (compute-successors cps kfun))))
+ (pk 'compute-significant-bits cps types kfun)
+ (when (getenv "GUILE_DEBUG_CPS")
+ (format (current-warning-port) "CPS:\n")
+ (for-each (match-lambda
+ ((k . v) (format (current-warning-port) " ~s --> ~s\n" k v)))
+ (reverse (intmap-fold acons cps '())))
+ (format (current-warning-port) "TYPES:\n")
+ (for-each (match-lambda
+ ((k . v) (format (current-warning-port) " ~s --> ~s\n" k v)))
+ (reverse (intmap-fold acons types '()))))
+ (pk 'compute-significant-bits-result
+ (let ((preds (pk 'preds (invert-graph (compute-successors cps kfun)))))
(let lp ((worklist (intmap-keys preds)) (visited empty-intset)
(out empty-intmap))
+ (pk 'lp 'worklist worklist 'visited visited 'out out)
(match (intset-prev worklist)
(#f out)
(label
@@ -276,7 +288,7 @@
(add-unknown-uses out args))))
(($ $prompt escape? tag handler)
(add-unknown-use out tag)))))
- (_ out)))))))))
+ (_ out))))))))))
(define (specialize-operations cps)
(define (visit-cont label cont cps types sigbits)
--8<---------------cut here---------------end--------------->8---
and here's a reformatted version of the resulting output when compiling
Tommi's code above:
--8<---------------cut here---------------start------------->8---
;;; (compute-significant-bits #<intmap 0-103> #<intmap 13+0-90> 13)
CPS:
0 --> #<cps (kfun () 0 12 1)>
1 --> #<cps (kclause (() () #f () #f) 2)>
2 --> #<cps (kargs () () (continue 3 (primcall current-module)))>
3 --> #<cps (kargs (module) (1) (continue 4 (const 0)))>
4 --> #<cps (kargs (scope) (2) (continue 5 (primcall cache-current-module! 1 2)))>
5 --> #<cps (kargs () () (continue 6 (closure 13 0)))>
6 --> #<cps (kargs (arg) (3) (continue 7 (const select-nearest-methods)))>
7 --> #<cps (kargs (name) (4) (continue 8 (primcall define! 4)))>
8 --> #<cps (kargs (box) (5) (continue 9 (closure 13 0)))>
9 --> #<cps (kargs (#f) (6) (continue 10 (primcall box-set! 5 6)))>
10 --> #<cps (kargs () () (continue 11 (unspecified)))>
11 --> #<cps (kargs (unspecified) (7) (continue 12 (values 7)))>
12 --> #<cps (ktail)>
13 --> #<cps (kfun ((name . select-nearest-methods)) 8 103 14)>
14 --> #<cps (kclause ((binder index v-fixed-args v-rest-arg vb-included) () #f () #f) 15)>
15 --> #<cps (kargs (binder index v-fixed-args v-rest-arg vb-included) (9 10 11 12 13) (continue 16 (const dwl4)))>
16 --> #<cps (kargs (name) (14) (continue 17 (const #t)))>
17 --> #<cps (kargs (bound?) (15) (continue 18 (const 0)))>
18 --> #<cps (kargs (scope) (16) (continue 19 (primcall cached-toplevel-box 16 14 15)))>
19 --> #<cps (kargs (box) (17) (continue 20 (primcall box-ref 17)))>
20 --> #<cps (kargs (arg) (18) (continue 21 (const "select-nearest-methods")))>
21 --> #<cps (kargs (arg) (19) (continue 22 (call 18 19)))>
22 --> #<cps (kreceive () vals 23)>
23 --> #<cps (kargs (tmp) (20) (continue 24 (const assert)))>
24 --> #<cps (kargs (name) (21) (continue 25 (primcall cached-toplevel-box 16 21 15)))>
25 --> #<cps (kargs (box) (22) (continue 26 (primcall box-ref 22)))>
26 --> #<cps (kargs (arg) (23) (continue 27 (const is-binder?)))>
27 --> #<cps (kargs (name) (24) (continue 28 (primcall cached-toplevel-box 16 24 15)))>
28 --> #<cps (kargs (box) (25) (continue 29 (primcall box-ref 25)))>
29 --> #<cps (kargs (arg) (26) (continue 30 (call 26 9)))>
30 --> #<cps (kreceive (arg) rest 31)>
31 --> #<cps (kargs (tmp tmp) (27 28) (continue 32 (call 23 27)))>
32 --> #<cps (kreceive () vals 33)>
33 --> #<cps (kargs (tmp) (29) (continue 34 (primcall vector-length 13)))>
34 --> #<cps (kargs (u64) (30) (continue 35 (primcall u64->scm 30)))>
35 --> #<cps (kargs (n) (31) (continue 36 (branch 101 (primcall >= 16 31))))>
36 --> #<cps (kargs () () (continue 37 (primcall scm->u64 16)))>
37 --> #<cps (kargs (unboxed) (32) (continue 38 (primcall vector-ref 13 32)))>
38 --> #<cps (kargs (arg) (33) (continue 67 (branch 39 (values 33))))>
39 --> #<cps (kargs () () (continue 40 (const get-item-at-index)))>
40 --> #<cps (kargs (name) (34) (continue 41 (primcall cached-toplevel-box 16 34 15)))>
41 --> #<cps (kargs (box) (35) (continue 42 (primcall box-ref 35)))>
42 --> #<cps (kargs (arg) (36) (continue 43 (primcall vector-ref 11 32)))>
43 --> #<cps (kargs (arg) (37) (continue 44 (primcall vector-ref 12 32)))>
44 --> #<cps (kargs (arg) (38) (continue 45 (call 36 37 38 10)))>
45 --> #<cps (kreceive (t1) rest 46)>
46 --> #<cps (kargs (tmp tmp) (39 40) (continue 47 (values 16)))>
47 --> #<cps (kargs (j) (41) (continue 48 (branch 67 (primcall >= 41 31))))>
48 --> #<cps (kargs () () (continue 49 (branch 65 (primcall = 16 41))))>
49 --> #<cps (kargs () () (continue 50 (primcall scm->u64 41)))>
50 --> #<cps (kargs (unboxed) (42) (continue 51 (primcall vector-ref 13 42)))>
51 --> #<cps (kargs (arg) (43) (continue 65 (branch 52 (values 43))))>
52 --> #<cps (kargs () () (continue 53 (primcall box-ref 35)))>
53 --> #<cps (kargs (arg) (44) (continue 54 (primcall vector-ref 11 42)))>
54 --> #<cps (kargs (arg) (45) (continue 55 (primcall vector-ref 12 42)))>
55 --> #<cps (kargs (arg) (46) (continue 56 (call 44 45 46 10)))>
56 --> #<cps (kreceive (t2) rest 57)>
57 --> #<cps (kargs (tmp tmp) (47 48) (continue 58 (const is-t-subtype?)))>
58 --> #<cps (kargs (name) (49) (continue 59 (primcall cached-toplevel-box 16 49 15)))>
59 --> #<cps (kargs (box) (50) (continue 60 (primcall box-ref 50)))>
60 --> #<cps (kargs (arg) (51) (continue 61 (call 51 9 39 47)))>
61 --> #<cps (kreceive (arg) rest 62)>
62 --> #<cps (kargs (tmp tmp) (52 53) (continue 65 (branch 63 (values 52))))>
63 --> #<cps (kargs () () (continue 64 (const #f)))>
64 --> #<cps (kargs (arg) (54) (continue 65 (primcall vector-set! 13 42 54)))>
65 --> #<cps (kargs () () (continue 66 (const 1)))>
66 --> #<cps (kargs (arg) (55) (continue 47 (primcall add 41 55)))>
67 --> #<cps (kargs () () (continue 68 (const 1)))>
68 --> #<cps (kargs (arg) (56) (continue 69 (const 1)))>
69 --> #<cps (kargs (i) (57) (continue 70 (branch 101 (primcall >= 57 31))))>
70 --> #<cps (kargs () () (continue 71 (primcall scm->u64 57)))>
71 --> #<cps (kargs (unboxed) (58) (continue 72 (primcall vector-ref 13 58)))>
72 --> #<cps (kargs (arg) (59) (continue 100 (branch 73 (values 59))))>
73 --> #<cps (kargs () () (continue 74 (const get-item-at-index)))>
74 --> #<cps (kargs (name) (60) (continue 75 (primcall cached-toplevel-box 16 60 15)))>
75 --> #<cps (kargs (box) (61) (continue 76 (primcall box-ref 61)))>
76 --> #<cps (kargs (arg) (62) (continue 77 (primcall vector-ref 11 58)))>
77 --> #<cps (kargs (arg) (63) (continue 78 (primcall vector-ref 12 58)))>
78 --> #<cps (kargs (arg) (64) (continue 79 (call 62 63 64 10)))>
79 --> #<cps (kreceive (t1) rest 80)>
80 --> #<cps (kargs (tmp tmp) (65 66) (continue 81 (values 16)))>
81 --> #<cps (kargs (j) (67) (continue 82 (branch 100 (primcall >= 67 31))))>
82 --> #<cps (kargs () () (continue 83 (branch 99 (primcall = 57 67))))>
83 --> #<cps (kargs () () (continue 84 (primcall scm->u64 67)))>
84 --> #<cps (kargs (unboxed) (68) (continue 85 (primcall vector-ref 13 68)))>
85 --> #<cps (kargs (arg) (69) (continue 99 (branch 86 (values 69))))>
86 --> #<cps (kargs () () (continue 87 (primcall box-ref 61)))>
87 --> #<cps (kargs (arg) (70) (continue 88 (primcall vector-ref 11 68)))>
88 --> #<cps (kargs (arg) (71) (continue 89 (primcall vector-ref 12 68)))>
89 --> #<cps (kargs (arg) (72) (continue 90 (call 70 71 72 10)))>
90 --> #<cps (kreceive (t2) rest 91)>
91 --> #<cps (kargs (tmp tmp) (73 74) (continue 92 (const is-t-subtype?)))>
92 --> #<cps (kargs (name) (75) (continue 93 (primcall cached-toplevel-box 16 75 15)))>
93 --> #<cps (kargs (box) (76) (continue 94 (primcall box-ref 76)))>
94 --> #<cps (kargs (arg) (77) (continue 95 (call 77 9 65 73)))>
95 --> #<cps (kreceive (arg) rest 96)>
96 --> #<cps (kargs (tmp tmp) (78 79) (continue 99 (branch 97 (values 78))))>
97 --> #<cps (kargs () () (continue 98 (const #f)))>
98 --> #<cps (kargs (arg) (80) (continue 99 (primcall vector-set! 13 68 80)))>
99 --> #<cps (kargs () () (continue 81 (primcall add 67 56)))>
100 --> #<cps (kargs () () (continue 69 (primcall add 57 56)))>
101 --> #<cps (kargs () () (continue 102 (unspecified)))>
102 --> #<cps (kargs (val) (81) (continue 103 (values 81)))>
103 --> #<cps (ktail)>
TYPES:
13 --> #(#<intmap> #<intmap 8+0>)
14 --> #(#<intmap 8+0> #<intmap 8+0-5>)
15 --> #(#<intmap 8+0-5> #<intmap 8+0-6>)
16 --> #(#<intmap 8+0-6> #<intmap 8+0-7>)
17 --> #(#<intmap 8+0-7> #<intmap 8+0-8>)
18 --> #(#<intmap 8+0-8> #<intmap 8+0-9>)
19 --> #(#<intmap 8+0-9> #<intmap 8+0-10>)
20 --> #(#<intmap 8+0-10> #<intmap 8+0-11>)
21 --> #(#<intmap 8+0-11> #<intmap 8+0-11>)
22 --> #(#<intmap 8+0-11> #<intmap 8+0-12>)
23 --> #(#<intmap 8+0-12> #<intmap 8+0-13>)
24 --> #(#<intmap 8+0-13> #<intmap 8+0-14>)
25 --> #(#<intmap 8+0-14> #<intmap 8+0-15>)
26 --> #(#<intmap 8+0-15> #<intmap 8+0-16>)
27 --> #(#<intmap 8+0-16> #<intmap 8+0-17>)
28 --> #(#<intmap 8+0-17> #<intmap 8+0-18>)
29 --> #(#<intmap 8+0-18> #<intmap 8+0-18>)
30 --> #(#<intmap 8+0-18> #<intmap 8+0-20>)
31 --> #(#<intmap 8+0-20> #<intmap 8+0-20>)
32 --> #(#<intmap 8+0-20> #<intmap 8+0-21>)
33 --> #(#<intmap 8+0-21> #<intmap 8+0-22>)
34 --> #(#<intmap 8+0-22> #<intmap 8+0-23>)
35 --> #(#<intmap 8+0-23> #<intmap 8+0-23> #<intmap 8+0-23>)
36 --> #(#<intmap 8+0-23> #<intmap 8+0-24>)
37 --> #(#<intmap 8+0-24> #<intmap 8+0-25>)
38 --> #(#<intmap 8+0-25> #<intmap 8+0-25> #<intmap 8+0-25>)
39 --> #(#<intmap 8+0-25> #<intmap 8+0-26>)
40 --> #(#<intmap 8+0-26> #<intmap 8+0-27>)
41 --> #(#<intmap 8+0-27> #<intmap 8+0-28>)
42 --> #(#<intmap 8+0-28> #<intmap 8+0-29>)
43 --> #(#<intmap 8+0-29> #<intmap 8+0-30>)
44 --> #(#<intmap 8+0-30> #<intmap 8+0-30>)
45 --> #(#<intmap 8+0-30> #<intmap 8+0-32>)
46 --> #(#<intmap 8+0-32> #<intmap 8+0-33>)
47 --> #(#<intmap 8+0-33> #<intmap 8+0-33> #<intmap 8+0-33>)
48 --> #(#<intmap 8+0-33> #<intmap 8+0-33> #<intmap 8+0-33>)
49 --> #(#<intmap 8+0-33> #<intmap 8+0-34>)
50 --> #(#<intmap 8+0-34> #<intmap 8+0-35>)
51 --> #(#<intmap 8+0-35> #<intmap 8+0-35> #<intmap 8+0-35>)
52 --> #(#<intmap 8+0-35> #<intmap 8+0-36>)
53 --> #(#<intmap 8+0-36> #<intmap 8+0-37>)
54 --> #(#<intmap 8+0-37> #<intmap 8+0-38>)
55 --> #(#<intmap 8+0-38> #<intmap 8+0-38>)
56 --> #(#<intmap 8+0-38> #<intmap 8+0-40>)
57 --> #(#<intmap 8+0-40> #<intmap 8+0-41>)
58 --> #(#<intmap 8+0-41> #<intmap 8+0-42>)
59 --> #(#<intmap 8+0-42> #<intmap 8+0-43>)
60 --> #(#<intmap 8+0-43> #<intmap 8+0-43>)
61 --> #(#<intmap 8+0-43> #<intmap 8+0-45>)
62 --> #(#<intmap 8+0-45> #<intmap 8+0-45> #<intmap 8+0-45>)
63 --> #(#<intmap 8+0-45> #<intmap 8+0-46>)
64 --> #(#<intmap 8+0-46> #<intmap 8+0-46>)
65 --> #(#<intmap 8+0-33> #<intmap 8+0-33,47>)
66 --> #(#<intmap 8+0-33,47> #<intmap 8+0-33,47>)
67 --> #(#<intmap 8+0-25> #<intmap 8+0-25,48>)
68 --> #(#<intmap 8+0-25,48> #<intmap 8+0-25,48-49>)
69 --> #(#<intmap 8+0-25,48-49> #<intmap 8+0-25,48-49> #<intmap 8+0-25,48-49>)
70 --> #(#<intmap 8+0-25,48-49> #<intmap 8+0-25,48-50>)
71 --> #(#<intmap 8+0-25,48-50> #<intmap 8+0-25,48-51>)
72 --> #(#<intmap 8+0-25,48-51> #<intmap 8+0-25,48-51> #<intmap 8+0-25,48-51>)
73 --> #(#<intmap 8+0-25,48-51> #<intmap 8+0-25,48-52>)
74 --> #(#<intmap 8+0-25,48-52> #<intmap 8+0-25,48-53>)
75 --> #(#<intmap 8+0-25,48-53> #<intmap 8+0-25,48-54>)
76 --> #(#<intmap 8+0-25,48-54> #<intmap 8+0-25,48-55>)
77 --> #(#<intmap 8+0-25,48-55> #<intmap 8+0-25,48-56>)
78 --> #(#<intmap 8+0-25,48-56> #<intmap 8+0-25,48-56>)
79 --> #(#<intmap 8+0-25,48-56> #<intmap 8+0-25,48-58>)
80 --> #(#<intmap 8+0-25,48-58> #<intmap 8+0-25,48-59>)
81 --> #(#<intmap 8+0-25,48-59> #<intmap 8+0-25,48-59> #<intmap 8+0-25,48-59>)
82 --> #(#<intmap 8+0-25,48-59> #<intmap 8+0-25,48-59> #<intmap 8+0-25,48-59>)
83 --> #(#<intmap 8+0-25,48-59> #<intmap 8+0-25,48-60>)
84 --> #(#<intmap 8+0-25,48-60> #<intmap 8+0-25,48-61>)
85 --> #(#<intmap 8+0-25,48-61> #<intmap 8+0-25,48-61> #<intmap 8+0-25,48-61>)
86 --> #(#<intmap 8+0-25,48-61> #<intmap 8+0-25,48-62>)
87 --> #(#<intmap 8+0-25,48-62> #<intmap 8+0-25,48-63>)
88 --> #(#<intmap 8+0-25,48-63> #<intmap 8+0-25,48-64>)
89 --> #(#<intmap 8+0-25,48-64> #<intmap 8+0-25,48-64>)
90 --> #(#<intmap 8+0-25,48-64> #<intmap 8+0-25,48-66>)
91 --> #(#<intmap 8+0-25,48-66> #<intmap 8+0-25,48-67>)
92 --> #(#<intmap 8+0-25,48-67> #<intmap 8+0-25,48-68>)
93 --> #(#<intmap 8+0-25,48-68> #<intmap 8+0-25,48-69>)
94 --> #(#<intmap 8+0-25,48-69> #<intmap 8+0-25,48-69>)
95 --> #(#<intmap 8+0-25,48-69> #<intmap 8+0-25,48-71>)
96 --> #(#<intmap 8+0-25,48-71> #<intmap 8+0-25,48-71> #<intmap 8+0-25,48-71>)
97 --> #(#<intmap 8+0-25,48-71> #<intmap 8+0-25,48-72>)
98 --> #(#<intmap 8+0-25,48-72> #<intmap 8+0-25,48-72>)
99 --> #(#<intmap 8+0-25,48-59> #<intmap 8+0-25,48-59>)
100 --> #(#<intmap 8+0-25,48-51> #<intmap 8+0-25,48-51>)
101 --> #(#<intmap 8+0-23> #<intmap 8+0-23,73>)
102 --> #(#<intmap 8+0-23,73> #<intmap 8+0-23,73>)
103 --> #(#<intmap 8+0-23,73>)
;;; (preds #<intmap 13+0-90>)
;;; (lp worklist #<intset 13-103> visited #<intset> out #<intmap>)
;;; (lp worklist #<intset 13-102> visited #<intset 103> out #<intmap>)
;;; (lp worklist #<intset 13-101> visited #<intset 102-103> out #<intmap 81+0>)
;;; (lp worklist #<intset 13-100> visited #<intset 101-103> out #<intmap 81+0>)
;;; (lp worklist #<intset 13-99> visited #<intset 100-103> out #<intmap 56+0-1,25>)
;;; (lp worklist #<intset 13-98> visited #<intset 99-103> out #<intmap 56+0-1,11,25>)
;;; (lp worklist #<intset 13-97> visited #<intset 98-103> out #<intmap 13+0,43-44,54-55,67-68>)
;;; (lp worklist #<intset 13-96> visited #<intset 97-103> out #<intmap 13+0,43-44,54-55,67-68>)
;;; (lp worklist #<intset 13-95> visited #<intset 96-103> out #<intmap 13+0,43-44,54-55,65-68>)
;;; (lp worklist #<intset 13-94> visited #<intset 95-103> out #<intmap 13+0,43-44,54-55,65-68>)
;;; (lp worklist #<intset 13-93> visited #<intset 94-103> out #<intmap 9+0,4,47-48,56,58-59,64,68-72>)
;;; (lp worklist #<intset 13-92> visited #<intset 93-103> out #<intmap 9+0,4,47-48,56,58-59,64,67-72>)
;;; (lp worklist #<intset 13-91> visited #<intset 92-103> out #<intmap 9+0,4,6-7,47-48,56,58-59,64,66-72>)
;;; (lp worklist #<intset 13-90> visited #<intset 91-103> out #<intmap 9+0,4,6-7,47-48,56,58-59,64-72>)
;;; (lp worklist #<intset 13-89> visited #<intset 90-103> out #<intmap 9+0,4,6-7,47-48,56,58-59,64-72>)
;;; (lp worklist #<intset 13-88> visited #<intset 89-103> out #<intmap 9+0-1,4,6-7,47-48,56,58-59,61-72>)
;;; (lp worklist #<intset 13-87> visited #<intset 88-103> out #<intmap 9+0-1,3-4,6-7,47-48,56,58-59,61-72>)
;;; (lp worklist #<intset 13-86> visited #<intset 87-103> out #<intmap 9+0-4,6-7,47-48,56,58-59,61-72>)
;;; (lp worklist #<intset 13-85> visited #<intset 86-103> out #<intmap 9+0-4,6-7,47-48,52,56,58-59,61-72>)
;;; (lp worklist #<intset 13-84> visited #<intset 85-103> out #<intmap 9+0-4,6-7,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-83> visited #<intset 84-103> out #<intmap 9+0-4,6-7,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-82> visited #<intset 83-103> out #<intmap 9+0-4,6-7,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-81> visited #<intset 82-103> out #<intmap 9+0-4,6-7,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,99> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85,96,98> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85,96> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-81> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,99> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85,96,98> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85,96> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-81> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,99> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85,96,98> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85,96> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82,85> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-80,82> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; (lp worklist #<intset 13-81> visited #<intset 81-103> out #<intmap 9+0-4,6-7,22,47-48,52,56,58-72>)
;;; [the 6 loop states above repeat forever]
--8<---------------cut here---------------end--------------->8---
To be continued ...
Mark
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-06-06 2:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-25 15:32 bug#31594: Code causes guild compile to hang Tommi Höynälänmaa
2018-05-27 13:04 ` bug#31594: Information on my system Tommi Höynälänmaa
2018-06-05 22:01 ` bug#31594: Code causes guild compile to hang Mark H Weaver
2018-06-06 2:23 ` Mark H Weaver
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).