[ 
https://issues.apache.org/jira/browse/IMPALA-1948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17254326#comment-17254326
 ] 

Tim Armstrong commented on IMPALA-1948:
---------------------------------------

The invoke instructions are generated when a destructor needs to be run (i.e. 
the status destructor) when exiting a scope *and* that scope has some code that 
may throw an exception. In practice any function call that is not marked 
noexcept could throw an exception, so any function call can trigger the 
insertion of an invoke. In some cases if the function is in the same module 
LLVM might be able to infer noexcept.

Note that, even aside from the issue with replacing functions, the 
invoke/cleanup stuff does result in more complex IR because a bunch of cleanup 
blocks get inserted to run the destructors.

> Fix automatic storage Status and codegen
> ----------------------------------------
>
>                 Key: IMPALA-1948
>                 URL: https://issues.apache.org/jira/browse/IMPALA-1948
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Backend
>    Affects Versions: Impala 2.2
>            Reporter: Daniel Hecht
>            Priority: Minor
>              Labels: codegen
>
> Codegen IR and Status with automatic storage duration don't work well 
> together.  That's because Status has a destructor that needs to be executed 
> if an exception is thrown, and so the IR will emit INVOKE instructions rather 
> than CALL instructions (to unwind the stack).  And our IR fixup to replace 
> indirect calls with direct calls doesn't know how to deal with INVOKE.
> We should fix this so that writing IR is simpler and more robust. Currently 
> we work around this, for example, by passing Status down IR callstacks as a 
> pointer to Status that lives as member in a heap allocated object (e.g. in 
> partition join/agg code).  Once this (and IMPALA-1916) are fixed, we should 
> remove these workarounds.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to