Skip to content

Commit

Permalink
Revert "Annotate exception handling with call site effects (#359)" (#388
Browse files Browse the repository at this point in the history
)

This reverts commit 01d44c3.
  • Loading branch information
vchuravy authored Feb 6, 2023
1 parent 8c3d51d commit a838c28
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
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

0 comments on commit a838c28

Please sign in to comment.