1
; Copyright David Rager 2012
3
; License: (An MIT/X11-style license)
5
; Permission is hereby granted, free of charge, to any person obtaining a
6
; copy of this software and associated documentation files (the "Software"),
7
; to deal in the Software without restriction, including without limitation
8
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
; and/or sell copies of the Software, and to permit persons to whom the
10
; Software is furnished to do so, subject to the following conditions:
12
; The above copyright notice and this permission notice shall be included in
13
; all copies or substantial portions of the Software.
15
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
; DEALINGS IN THE SOFTWARE.
1
23
; Defines a macro that temporarily disables waterfall parallelism and then
2
24
; restores it to its previous value. Perhaps the calls of
3
25
; set-waterfall-parallelism need not be local, but be careful about removing
10
32
(in-package "ACL2")
34
(include-book "xdoc/top" :dir :system)
12
36
(defun without-waterfall-parallelism-fn (events state)
13
37
; (declare (xargs :guard (state-p state) :stobjs state))
14
38
(declare (xargs :mode :program :stobjs state))
15
39
(let ((curr-waterfall-parallelism-val
16
40
(f-get-global 'waterfall-parallelism state)))
17
`(progn (local (make-event
18
(er-progn (set-waterfall-parallelism nil)
19
(value '(value-triple nil)))
42
; Matt K. mode, 10/1/2014: I removed LOCAL from each MAKE-EVENT below so that
43
; this utility works when including uncertified books, for example when
44
; certifying a book after (set-write-acl2x '(t) state). Then I also removed
45
; :CHECK-EXPANSION from each, because now that the make-event forms are
46
; non-local, the second one could cause waterfall-parallelism to be
47
; inadvertently turned on when including a book.
50
(er-progn (set-waterfall-parallelism nil)
51
(value '(value-triple nil))))
23
(er-progn (set-waterfall-parallelism
24
',curr-waterfall-parallelism-val)
25
(value '(value-triple t)))
26
:check-expansion t)))))
54
(er-progn (set-waterfall-parallelism
55
',curr-waterfall-parallelism-val)
56
(value '(value-triple t)))))))
28
58
(defmacro without-waterfall-parallelism (&rest events)
29
59
`(make-event (without-waterfall-parallelism-fn ',events state)))
61
(defxdoc without-waterfall-parallelism
62
:parents (parallelism)
63
:short "Disable waterfall parallelism for an enclosed event"
64
:long "<p>Example usage:</p>
66
(without-waterfall-parallelism
67
(defun foo (x) (* x 3)))