Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forgetting to make gc frames for simple functions for code reflection #57400

Open
vtjnash opened this issue Feb 13, 2025 · 0 comments · May be fixed by #57410
Open

forgetting to make gc frames for simple functions for code reflection #57400

vtjnash opened this issue Feb 13, 2025 · 0 comments · May be fixed by #57410
Labels
compiler:codegen Generation of LLVM IR and native code display and printing Aesthetics and correctness of printed representations of objects.

Comments

@vtjnash
Copy link
Member

vtjnash commented Feb 13, 2025

In v1.12 I noticed we are not showing the gc frame anymore for simple functions like this which don't end up needing to use ptls anywhere and don't have the swiftself argument. I suspect it is an interaction with removing ptls in codgen (when we already have swiftself) and skipping gc rooting in functions without either that or swiftself:

julia> code_llvm((UInt32,), raw=false) do x; y = Pair{Any, Int}(x, 1); GC.gc(); objectid(y); end
; Function Signature: var"#8"(UInt32)
;  @ REPL[2]:1 within `#8`
define i64 @"julia_#8_1087"(i32 zeroext %"x::UInt32") #0 {
top:
  %0 = alloca { ptr, i64 }, align 8
; ┌ @ Base.jl:12 within `Pair`
   %box_UInt32 = call nonnull align 8 dereferenceable(4) ptr @ijl_box_uint32(i32 zeroext %"x::UInt32") #7
; └
; ┌ @ gcutils.jl:133 within `gc` @ gcutils.jl:133
   call void @jlplt_ijl_gc_collect_1090_got.jit(i32 1)
; └
; ┌ @ runtime_internals.jl:830 within `objectid`
   store ptr %box_UInt32, ptr %0, align 8
   %1 = getelementptr inbounds i8, ptr %0, i64 8
   store i64 1, ptr %1, align 8
   %object_id = call i64 @ijl_object_id_(i64 ptrtoint (ptr @"+Core.Pair#1091.jit" to i64), ptr nonnull %0)
   ret i64 %object_id
; └
}
@vtjnash vtjnash added display and printing Aesthetics and correctness of printed representations of objects. compiler:codegen Generation of LLVM IR and native code labels Feb 13, 2025
vtjnash added a commit that referenced this issue Feb 14, 2025
Slightly reduces the amount of work these optimization passes need to do
later, in most typical cases, and avoids putting an unknown call at the
top of all of our functions, which can inhibit some optimizations of
otherwise trivial functions.

Fixes #57400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code display and printing Aesthetics and correctness of printed representations of objects.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant