Why does arrayref throw?

Figured it out, a package, UnsafeAssume is being registered. Example code for preventing undefined reference checks using the new package:

function unsafe_array_access(a)
  @inline begin
    unsafe_assume_condition(isassigned(a, 1))
    @inbounds a[1]
  end
end

EDIT:

Without thinking about the assembly generated (see my repo on Gitlab) for unsafe_array_access carefully:

  1. It doesn’t include any branches or other conditional operations

  2. the only instructions are push, mov, mov, mov, pop, ret

While I’m only guessing, I’d say the code is optimal (assuming no undefined references).

3 Likes