Skip to content

Commit

Permalink
Update iterate unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Dec 30, 2024
1 parent fb36b65 commit 960bc0f
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/rules/jitrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -817,31 +817,31 @@ function push_if_not_ref(
return darg
end

@inline function push_inner(@nospecialize(vals), @nospecialize(arg), @nospecialize(darg))
ty = Core.Typeof(arg)
actreg = active_reg_nothrow(ty, Val(nothing))
if actreg == AnyState
Const(arg)
elseif actreg == ActiveState
Active(arg)
elseif actreg == MixedState
darg = Base.inferencebarrier(darg)
MixedDuplicated(
arg,
push_if_not_ref(Val(reverse), vals, darg, ty)::Base.RefValue{ty},
)
else
Duplicated(arg, darg)
end
end

@inline function iterate_unwrap_augfwd_dup(
::Val{reverse},
vals,
args,
dargs,
) where {reverse}
ntuple(Val(length(args))) do i
Base.@_inline_meta
arg = args[i]
ty = Core.Typeof(arg)
actreg = active_reg_nothrow(ty, Val(nothing))
if actreg == AnyState
Const(arg)
elseif actreg == ActiveState
Active(arg)
elseif actreg == MixedState
darg = Base.inferencebarrier(dargs[i])
MixedDuplicated(
arg,
push_if_not_ref(Val(reverse), vals, darg, ty)::Base.RefValue{ty},
)
else
Duplicated(arg, dargs[i])
end
end
map(Base.Fix1(push_inner, vals), args, dargs)
end

@inline function iterate_unwrap_augfwd_batchdup(
Expand Down

0 comments on commit 960bc0f

Please sign in to comment.