-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: unnamed functions missing FuncInfo #54959
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
Comments
Note to self: |
@prattmic Without looking too closely, I think it's because the directly called closure gets inlined and then we know there won't be any other references to it, so we intentionally drop references to it from the AST because we know we don't need to compile its function body on its own. (Contrast that the indirectly called closure gets inlined too, but we don't do any frontend analysis to realize that was the only possible use.) |
The place where the direct call closure is replaced: https://cs.opensource.google/go/go/+/refs/tags/go1.19.1:src/cmd/compile/internal/inline/inl.go;l=596 Maybe we can mark it as need lsym and call ssagen.IniLSym in enqueueFunc if the closure was marked. |
Change https://go.dev/cl/429637 mentions this issue: |
Change https://go.dev/cl/436240 mentions this issue: |
All inlined functions are Go functions, and thus should be capable of having a FuncInfo. Missing FuncInfo is likely indication of a compiler bug that dropped the symbol too early, failing to add it to the symbol list used for writing output. I believe all existing cases have been fixed; this check will prevent regressions. The exception is -linkshared mode. There symbols are loaded from the shared library, and the FuncInfo is not available. This is a bug, as it can result in incorrect the FuncID in inlinedCall, but it is very involved to fix. For #54959. For #55954. Change-Id: Ib0dc4f1ea62525b55f68604d6013ff33223fdcdd Reviewed-on: https://go-review.googlesource.com/c/go/+/429637 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Context: I am adding additional information to
runtime.inlinedCall
(function start line), which I am plumbing via theFuncInfo
. In the linker, thisFuncInfo.Valid()
got me thinking that (IMO) inlined functions ought to always have aFuncInfo
, since they must be Go functions, so I switched the check to panic if it is missing.This program fails that check:
The first closure (
fn
) has aFuncInfo
, but the second does not. This seems like a bug to me, though it probably had low impact before becauseFuncID
would default toFuncID_normal
anyways.I am still digging, but it looks like this is somewhere in the compiler, as func2 never makes it to
ssagen.InitLSym
, which sets up theFuncInfo
.cc @golang/compiler @cherrymui
The text was updated successfully, but these errors were encountered: