Skip to content

Commit

Permalink
remove an unused var-info flag and some unused definitions in inference
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Feb 1, 2016
1 parent 3344622 commit 7e7d743
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
14 changes: 2 additions & 12 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,10 @@ function _iisconst(s::Symbol, sv)
m = sv.mod
isdefined(m,s) && (ccall(:jl_is_const, Int32, (Any, Any), m, s) != 0)
end
_iisconst(s::SymbolNode, sv) = _iisconst(s.name, sv)
_iisconst(s::TopNode, sv) = isconst(_topmod(sv.mod), s.name)
_iisconst(s::GlobalRef, sv) = isconst(s.mod, s.name)
_iisconst(x::Expr, sv) = false
_iisconst(x::ANY, sv) = true

_ieval(x::ANY, sv) =
ccall(:jl_interpret_toplevel_expr_in, Any, (Any, Any, Any, Any),
sv.mod, x, svec(), svec())
_iisdefined(x::ANY, sv) = isdefined(sv.mod, x)

_topmod(sv::VarInfo) = _topmod(sv.mod)
_topmod(m::Module) = ccall(:jl_base_relative_to, Any, (Any,), m)::Module
Expand Down Expand Up @@ -1986,17 +1980,13 @@ function type_annotate(ast::Expr, states::Array{Any,1}, sv::ANY, rettype::ANY, a

# add declarations for variables that are always the same type
for vi in ast.args[2][1]::Array{Any,1}
if (vi[3]&4)==0
vi[2] = get(decls, vi[1], vi[2])
end
vi[2] = get(decls, vi[1], vi[2])
if haskey(undefs, vi[1])
vi[3] |= 32
end
end
for vi in ast.args[2][2]::Array{Any,1}
if (vi[3]&4)==0
vi[2] = get(decls, vi[1], vi[2])
end
vi[2] = get(decls, vi[1], vi[2])
if haskey(undefs, vi[1])
vi[3] |= 32
end
Expand Down
2 changes: 0 additions & 2 deletions src/ast.scm
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@
(define (vinfo:set-capt! v c) (set-car! (cddr v) (set-bit (caddr v) 1 c)))
;; whether var is assigned
(define (vinfo:set-asgn! v a) (set-car! (cddr v) (set-bit (caddr v) 2 a)))
;; whether var is assigned by an inner function
(define (vinfo:set-iasg! 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 assigned once
Expand Down
8 changes: 2 additions & 6 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2739,9 +2739,7 @@ So far only the second case can actually occur.
(if (vinfo:asgn vi)
(vinfo:set-sa! vi #f)
(vinfo:set-sa! vi #t))
(vinfo:set-asgn! vi #t)
(if (assq (car vi) captvars)
(vinfo:set-iasg! vi #t)))))
(vinfo:set-asgn! vi #t))))
`(= ,(cadr e) ,(analyze-vars (caddr e) env captvars sp)))
((call)
(let ((vi (var-info-for (cadr e) env)))
Expand Down Expand Up @@ -2777,9 +2775,7 @@ So far only the second case can actually occur.
(begin
(vinfo:set-asgn! vi #t)
;; note: method defs require a memory loc. (issue #7658)
(vinfo:set-sa! vi #f)
(if (assq (car vi) captvars)
(vinfo:set-iasg! vi #t)))))
(vinfo:set-sa! vi #f))))
(if (length= e 2)
`(method ,(cadr e))
`(method ,(cadr e)
Expand Down

0 comments on commit 7e7d743

Please sign in to comment.