Skip to content

Commit

Permalink
add a flag to indicate which slots are accessed
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored and Keno committed Feb 10, 2019
1 parent 0680f19 commit 635b8c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ast.scm
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
(define (vinfo:capt v) (< 0 (logand (caddr v) 1)))
(define (vinfo:asgn v) (< 0 (logand (caddr v) 2)))
(define (vinfo:never-undef v) (< 0 (logand (caddr v) 4)))
(define (vinfo:const v) (< 0 (logand (caddr v) 8)))
(define (vinfo:read v) (< 0 (logand (caddr v) 8)))
(define (vinfo:sa v) (< 0 (logand (caddr v) 16)))
(define (set-bit x b val) (if val (logior x b) (logand x (lognot b))))
;; record whether var is captured
Expand All @@ -443,8 +443,8 @@
(define (vinfo:set-asgn! v a) (set-car! (cddr v) (set-bit (caddr v) 2 a)))
;; whether the assignments to var are known to dominate its usages
(define (vinfo:set-never-undef! v a) (set-car! (cddr v) (set-bit (caddr v) 4 a)))
;; whether var is const
(define (vinfo:set-const! v a) (set-car! (cddr v) (set-bit (caddr v) 8 a)))
;; whether var is ever read
(define (vinfo:set-read! v a) (set-car! (cddr v) (set-bit (caddr v) 8 a)))
;; whether var is assigned once
(define (vinfo:set-sa! v a) (set-car! (cddr v) (set-bit (caddr v) 16 a)))
;; occurs undef: mask 32
Expand Down
7 changes: 6 additions & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2641,7 +2641,12 @@
;; where var-info-lst is a list of var-info records
(define (analyze-vars e env captvars sp)
(if (or (atom? e) (quoted? e))
e
(begin
(if (symbol? e)
(let ((vi (var-info-for e env)))
(if vi
(vinfo:set-read! vi #t))))
e)
(case (car e)
((local-def) ;; a local that we know has an assignment that dominates all usages
(let ((vi (var-info-for (cadr e) env)))
Expand Down
2 changes: 1 addition & 1 deletion src/method.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static void jl_code_info_set_ast(jl_code_info_t *li, jl_expr_t *ast)
li->ssaflags = jl_alloc_array_1d(jl_array_uint8_type, 0);

// Flags that need to be copied to slotflags
const uint8_t vinfo_mask = 16 | 32 | 64;
const uint8_t vinfo_mask = 8 | 16 | 32 | 64;
int i;
for (i = 0; i < nslots; i++) {
jl_value_t *vi = jl_array_ptr_ref(vis, i);
Expand Down

0 comments on commit 635b8c5

Please sign in to comment.