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

Revert "Annotate exception handling with call site effects (#359)" #388

Merged
merged 1 commit into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/irgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,11 @@ function emit_exception!(builder, name, inst)
# report the exception
if Base.JLOptions().debug_level >= 1
name = globalstring_ptr!(builder, name, "exception")
c = if Base.JLOptions().debug_level == 1
if Base.JLOptions().debug_level == 1
call!(builder, Runtime.get(:report_exception), [name])
else
call!(builder, Runtime.get(:report_exception_name), [name])
end
callsite_attribute!(c, (
LLVM.EnumAttribute("inaccessiblememonly", 0; ctx),
LLVM.EnumAttribute("writeonly", 0; ctx)))
end

# report each frame
Expand All @@ -290,10 +287,7 @@ function emit_exception!(builder, name, inst)
end

# signal the exception
c = call!(builder, Runtime.get(:signal_exception))
callsite_attribute!(c, (
LLVM.EnumAttribute("inaccessiblememonly", 0; ctx),
LLVM.EnumAttribute("writeonly", 0; ctx)))
call!(builder, Runtime.get(:signal_exception))

emit_trap!(job, builder, mod, inst)
end
Expand Down
6 changes: 1 addition & 5 deletions src/ptx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,7 @@ function hide_trap!(mod::LLVM.Module)
if isa(val, LLVM.CallInst)
@dispose builder=Builder(ctx) begin
position!(builder, val)
c = call!(builder, exit)
callsite_attribute!(c, (
LLVM.EnumAttribute("inaccessiblememonly", 0; ctx),
LLVM.EnumAttribute("writeonly", 0; ctx), # can we do readnone?
LLVM.EnumAttribute("noreturn", 0; ctx)))
call!(builder, exit)
end
unsafe_delete!(LLVM.parent(val), val)
changed = true
Expand Down
7 changes: 0 additions & 7 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,3 @@ macro unlocked(ex)
end
esc(combinedef(def))
end

function callsite_attribute!(call, attributes)
# TODO: Make a nice API for this in LLVM.jl
for attribute in attributes
LLVM.API.LLVMAddCallSiteAttribute(call, LLVM.API.LLVMAttributeFunctionIndex, attribute)
end
end