~ubuntu-branches/ubuntu/wily/acl2/wily

« back to all changes in this revision

Viewing changes to books/misc/without-waterfall-parallelism.lisp

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2015-01-16 10:35:45 UTC
  • mfrom: (3.3.26 sid)
  • Revision ID: package-import@ubuntu.com-20150116103545-prehe9thgo79o8w8
Tags: 7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; Copyright David Rager 2012
 
2
 
 
3
; License: (An MIT/X11-style license)
 
4
;
 
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:
 
11
;
 
12
;   The above copyright notice and this permission notice shall be included in
 
13
;   all copies or substantial portions of the Software.
 
14
;
 
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.
 
22
 
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
9
31
 
10
32
(in-package "ACL2")
11
33
 
 
34
(include-book "xdoc/top" :dir :system)
 
35
 
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)))
20
 
                    :check-expansion t))
 
41
 
 
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.
 
48
 
 
49
    `(progn (make-event
 
50
             (er-progn (set-waterfall-parallelism nil)
 
51
                       (value '(value-triple nil))))
21
52
            ,@events
22
 
            (local (make-event
23
 
                    (er-progn (set-waterfall-parallelism
24
 
                               ',curr-waterfall-parallelism-val)
25
 
                              (value '(value-triple t)))
26
 
                    :check-expansion t)))))
 
53
            (make-event
 
54
             (er-progn (set-waterfall-parallelism
 
55
                        ',curr-waterfall-parallelism-val)
 
56
                       (value '(value-triple t)))))))
27
57
 
28
58
(defmacro without-waterfall-parallelism (&rest events)
29
59
  `(make-event (without-waterfall-parallelism-fn ',events state)))
 
60
 
 
61
(defxdoc without-waterfall-parallelism
 
62
  :parents (parallelism)
 
63
  :short "Disable waterfall parallelism for an enclosed event"
 
64
  :long "<p>Example usage:</p>
 
65
  @({
 
66
  (without-waterfall-parallelism
 
67
    (defun foo (x) (* x 3)))
 
68
  })")