jw3126 / Setfield.jl

Update deeply nested immutable structs.
Other
167 stars 17 forks source link

Debug #48

Closed jw3126 closed 6 years ago

codecov-io commented 6 years ago

Codecov Report

Merging #48 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #48   +/-   ##
=======================================
  Coverage   97.87%   97.87%           
=======================================
  Files           4        4           
  Lines         141      141           
=======================================
  Hits          138      138           
  Misses          3        3
Impacted Files Coverage Δ
src/lens.jl 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a4d30ae...89ba263. Read the comment docs.

jw3126 commented 6 years ago

https://travis-ci.org/jw3126/Setfield.jl/jobs/420581842

IR

hand
Body::StaticArrays.SArray{Tuple{2},Int64,1,2}
44 1 ── %1  = (Base.getfield)(#temp#, 1, true)::StaticArrays.SArray{Tuple{2},Int64,1,2}
   │    %2  = (Base.getfield)(#temp#, 2, true)::Int64
   │    %3  = (Base.getfield)(#temp#, 3, true)::Int64
   └───       goto #7 if not true
   2 ── %5  = (Base.slt_int)(%3, 1)::Bool
   └───       goto #4 if not %5
   3 ──       goto #5
   4 ── %8  = (Base.slt_int)(2, %3)::Bool
   5 ┄─ %9  = φ (#3 => %5, #4 => %8)::Bool
   └───       goto #7 if not %9
   6 ── %11 = invoke StaticArrays.BoundsError(%1::Any, %3::Int64)::BoundsError
   │          (StaticArrays.throw)(%11)
   └───       $(Expr(:unreachable))
   7 ── %14 = (1 === %3)::Bool
   │    %15 = (Base.getfield)(%1, :data)::Tuple{Int64,Int64}
   │    %16 = (Base.getfield)(%15, 1, true)::Int64
   │    %17 = (StaticArrays.ifelse)(%14, %2, %16)::Int64
   │    %18 = (2 === %3)::Bool
   │    %19 = (Base.getfield)(%1, :data)::Tuple{Int64,Int64}
   │    %20 = (Base.getfield)(%19, 2, true)::Int64
   │    %21 = (StaticArrays.ifelse)(%18, %2, %20)::Int64
   │    %22 = (StaticArrays.tuple)(%17, %21)::Tuple{Int64,Int64}
   │    %23 = %new(StaticArrays.SArray{Tuple{2},Int64,1,2}, %22)::StaticArrays.SArray{Tuple{2},Int64,1,2}
   └───       goto #9
   8 ──       $(Expr(:unreachable))
   9 ┄─       goto #10
   10 ─       return %23
lens
Body::StaticArrays.SArray{Tuple{2},Int64,1,2}
40 1 ── %1  = (Base.getfield)(#temp#, 1, true)::StaticArrays.SArray{Tuple{2},Int64,1,2}
   │    %2  = (Base.getfield)(#temp#, 2, true)::Int64
   │    %3  = (Base.getfield)(#temp#, 3, true)::Int64
   └───       goto #7 if not true
   2 ── %5  = (Base.slt_int)(%3, 1)::Bool
   └───       goto #4 if not %5
   3 ──       goto #5
   4 ── %8  = (Base.slt_int)(2, %3)::Bool
   5 ┄─ %9  = φ (#3 => %5, #4 => %8)::Bool
   └───       goto #7 if not %9
   6 ── %11 = invoke StaticArrays.BoundsError(%1::Any, %3::Int64)::BoundsError
   │          (StaticArrays.throw)(%11)
   └───       $(Expr(:unreachable))
   7 ── %14 = (1 === %3)::Bool
   │    %15 = (Base.getfield)(%1, :data)::Tuple{Int64,Int64}
   │    %16 = (Base.getfield)(%15, 1, true)::Int64
   │    %17 = (StaticArrays.ifelse)(%14, %2, %16)::Int64
   │    %18 = (2 === %3)::Bool
   │    %19 = (Base.getfield)(%1, :data)::Tuple{Int64,Int64}
   │    %20 = (Base.getfield)(%19, 2, true)::Int64
   │    %21 = (StaticArrays.ifelse)(%18, %2, %20)::Int64
   │    %22 = (StaticArrays.tuple)(%17, %21)::Tuple{Int64,Int64}
   │    %23 = %new(StaticArrays.SArray{Tuple{2},Int64,1,2}, %22)::StaticArrays.SArray{Tuple{2},Int64,1,2}
   └───       goto #9
   8 ──       $(Expr(:unreachable))
   9 ┄─       goto #10
   10 ─       goto #11
   11 ─       return %23

LLVM

I don't understand LLVM good enough, but to me it looks like: