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

Fix for print and throw #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

MasonProtter
Copy link
Collaborator

Ref conversation in #145. The idea is that adding a ::Union{} here lets the compiler know that it can remove throw calls. E.g. compare

julia> using StaticTools

julia> g() = throw(f());

julia> @noinline f() = StaticTools.libcexit(Int32(1));

julia> code_typed(g, ())
1-element Vector{Any}:
 CodeInfo(
1%1 = invoke Main.f()::Any
│        Main.throw(%1)::Union{}  # <----- Bad!
└──      unreachable
) => Union{}

against

julia> @noinline f() = StaticTools.libcexit(Int32(1))::Union{};

julia> code_typed(g, ())
1-element Vector{Any}:
 CodeInfo(
1 ─     invoke Main.f()::Union{}
└──     unreachable
) => Union{}

@MasonProtter
Copy link
Collaborator Author

Ah, damn. This breaks the idea that statically compiled executables return exit codes. :(

@tshort
Copy link
Owner

tshort commented Nov 14, 2023

Also, it looks like mixtape.jl came back by accident.

@brenhinkeller
Copy link
Collaborator

brenhinkeller commented Nov 14, 2023 via email

@gbaraldi
Copy link
Contributor

So the thing we need here is to make the ccall return Union{}. Latest master has a way of doing what we do with symbolcall but correctly via ccall. Though it hasn't been plumbed through GPUCompiler just yet. It being JuliaLang/julia#51123

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.

4 participants