Skip to content

Switch LLVM reflection utilities to be CodeInstance based #56876

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Keno
Copy link
Member

@Keno Keno commented Dec 20, 2024

This is a natural continuation of the stream of work begun in #53219. In particular, with #56555, it is important to be able to pass a CodeInstance, since the ABI may be overwritten and without knowing that, codegen will generated incorrect code for the CodeInstance.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The src argument is not optional (nullable)

@Keno
Copy link
Member Author

Keno commented Dec 20, 2024

The src argument is not optional (nullable)

It is in this PR.

@vtjnash
Copy link
Member

vtjnash commented Dec 20, 2024

Then this PR cannot be merged, since it cannot be optional, as codegen has no other reliable way to get that

@Keno
Copy link
Member Author

Keno commented Dec 20, 2024

It just picks out the .inferred field and errors if its not there. The use case is for reflecting on CodeInstances that have the field. If they don't have the field, it obviously needs to be passed in separately.

@vtjnash vtjnash self-requested a review January 3, 2025 18:38
@vtjnash vtjnash dismissed their stale review January 3, 2025 18:39

Can proceed with other changes here now, if still relevant

This is a natural continuation of the stream of work begun in #53219.
In particular, with #56555, it is important to be able to pass a
CodeInstance, since the ABI may be overwritten and without knowing
that, codegen will generated incorrect code for the CodeInstance.
@Keno Keno force-pushed the kf/cireflection branch from 4d0eed3 to 4288424 Compare May 16, 2025 00:30
@Keno
Copy link
Member Author

Keno commented May 16, 2025

I rebased this because I thought I needed it, but turns out I don't immediately, but i think it might be useful for @topolarity shortly, so leaving this up anyway.


jl_printf(stream, "---- dumping IR for ----\n");
jl_static_show(stream, (jl_value_t*)mi);
jl_printf(stream, "\n----\n");

jl_printf(stream, "\n---- unoptimized IR ----\n");
jl_get_llvmf_defn(&llvmf_dump, mi, src, 0, false, jl_default_cgparams);
jl_get_llvmf_defn(&llvmf_dump, ci, NULL, 0, false, jl_default_cgparams);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not legal now to pass NULL here as the second argument, as codegen (intentionally) lacks the ability now to do inference itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants