julia icon indicating copy to clipboard operation
julia copied to clipboard

Source build of 1.12.0 on macOS ARM: `1cd47c3094` breaks JuliaInterpreter and Revise

Open George9000 opened this issue 8 months ago • 2 comments

On master, from commit 1cd47c3094 onward, the Revise workflow is broken. After launching julia, activating a package, using packagename, calling an existing function, and then adding a simple function foo to the src/packagename.jl results in an error with failure to revise/update the running package code.

The function foo is just

function foo() return 3 end

This addition to the package code results in an error. The error arises in JuliaInterpreter and its utils.jl

A git bisect identifies 1cd47c3094 as the culprit.

error details
Julia Version 1.12.0-DEV.716
Commit 1cd47c3094 (2024-06-12 21:45 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin23.5.0)
  CPU: 16 × Apple M3 Max
  WORD_SIZE: 64
  LLVM: libLLVM-17.0.6 (ORCJIT, apple-m3)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
Environment:
  JULIA_EDITOR = Emacs
  JULIA_PKG_DEVDIR = /Users/bozo/Documents/julia/dev

julia> foo()
┌ Error: Failed to revise /Volumes/work/julia/learnjulia/euler/src/euler.jl
│   exception =
│    BoundsError: attempt to access 0-element Vector{Base.IRShow.LineInfoNode} at index [1]
│    Stacktrace:
│     [1] throw_boundserror(A::Vector{Base.IRShow.LineInfoNode}, I::Tuple{Int64})
│       @ Base ./essentials.jl:14
│     [2] getindex
│       @ ./essentials.jl:894 [inlined]
│     [3] #linetable#7
│       @ ~/.julia/packages/JuliaInterpreter/tD6at/src/utils.jl:285 [inlined]
│     [4] linetable
│       @ ~/.julia/packages/JuliaInterpreter/tD6at/src/utils.jl:280 [inlined]
│     [5] whereis(framecode::JuliaInterpreter.FrameCode, pc::Int64; kwargs::@Kwargs{})
│       @ JuliaInterpreter ~/.julia/packages/JuliaInterpreter/tD6at/src/utils.jl:389
└ @ Revise ~/.julia/packages/Revise/QSDHW/src/packagedef.jl:724
┌ Warning: The running code does not match the saved version for the following files:
│ 
│   /Volumes/work/julia/learnjulia/euler/src/euler.jl
git bisect
% git bisect bad                                                                                                                                                                        0:23
1cd47c3094fe6ef98c4212b557255e93bcaff8ce is the first bad commit
commit 1cd47c3094fe6ef98c4212b557255e93bcaff8ce (HEAD)
Author: Keno Fischer <[email protected]>
Date:   Wed Jun 12 17:45:20 2024 -0400

    lowering: Remove `outerref` intermediate form (#54772)
    
    The `outerref` form was added in
    c3eedce56e6f7759873d7c33ef67420c7bc4fe77, but the renaming pass for them
    was removed two years later in c44644442949238da70670b547312ca1ae9a9c7d,
    without removing the form itself. As far as I can tell, today,
    `outerref` is essentially equivalent to `(globalref (thismodule) name)`
    (which was the original form, before outteref was introduced) because it
    just expands to a toplevel symbol. I don't think there remains any
    reason to keep this form after the renaming pass was removed and
    moreover it is confusing as one could reasonaly infer (as I did an
    incorrectly wrote in a comment) that `outerref` provides outer access,
    which it does not. This PR removes the form entirely and replaces them
    with an appropriate globalref.

 src/ast.c            |  3 +--
 src/ast.scm          |  8 ++------
 src/codegen.cpp      |  2 +-
 src/julia-syntax.scm | 78 ++++++++++++++++++++++++++++++++++++------------------------------------------
 4 files changed, 40 insertions(+), 51 deletions(-)


George9000 avatar Jun 22 '24 04:06 George9000