You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Tim Armstrong (Jira)" <ji...@apache.org> on 2020/12/28 06:53:00 UTC
[jira] [Resolved] (IMPALA-3181) build most of impala with
-fno-exceptions
[ https://issues.apache.org/jira/browse/IMPALA-3181?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Armstrong resolved IMPALA-3181.
-----------------------------------
Resolution: Later
I think weeding all these references out would be extremely challenging and I don't think we have anyone wanting to drive this, so I'll close for now.
> build most of impala with -fno-exceptions
> -----------------------------------------
>
> Key: IMPALA-3181
> URL: https://issues.apache.org/jira/browse/IMPALA-3181
> Project: IMPALA
> Issue Type: Improvement
> Components: Backend
> Affects Versions: Impala 2.5.0
> Reporter: Daniel Hecht
> Assignee: Michael Ho
> Priority: Minor
>
> In the backend, we only use exceptions when interfacing with third party libraries that throw exceptions (e.g. boost), which we wrap with try-catch. Outside of that, we don't expect, nor handle, exceptions unwinding impala code.
> So, we could isolate calls to those thirdparty libraries to .cc files, and then compile the rest of Impala with -fno-exceptions. The advantages to doing so are:
> * Better code. All the stack unwinding code goes away and potentially more optimizations are possible.
> * We'll get compiler errors if try-catch is written in places where it won't work anyway (IR code since we disable generating exception handling code). This probably could have caught IMPALA-2184 at compile time.
> A good starting point is probably to turn on -fno-exceptions for IR since we already don't generate exception handling code. This may require refactoring use of boost headers, however, since statically exceptions may be possible on these paths.
> An alternative would be to use 'noexcept', but this would require annotating every function.
> Example:
> {code}
> #include <stdio.h>
> struct Foo {
> Foo() { printf("Foo()"); }
> ~Foo() { printf("~Foo()"); }
> };
> void NoExcept() noexcept;
> void Except();
> void CallNoExcept() {
> Foo foo;
> NoExcept();
> }
> void CallExcept() {
> Foo foo;
> Except();
> }
> int main() {
> CallExcept();
> }
> {code}
> {code:title="-std=c++11 -O2 -S"}
> CallNoExcept():
> .LFB18:
> .cfi_startproc
> .cfi_personality 0x3,__gxx_personality_v0
> .cfi_lsda 0x3,.LLSDA18
> subq $8, %rsp
> .cfi_def_cfa_offset 16
> movl $.LC0, %edi
> xorl %eax, %eax
> .LEHB0:
> call printf
> .LEHE0:
> call NoExcept()
> movl $.LC1, %edi
> xorl %eax, %eax
> addq $8, %rsp
> .cfi_def_cfa_offset 8
> jmp printf
> .cfi_endproc
> ...
> CallExcept():
> .LFB19:
> .cfi_startproc
> .cfi_personality 0x3,__gxx_personality_v0
> .cfi_lsda 0x3,.LLSDA19
> pushq %rbx
> .cfi_def_cfa_offset 16
> .cfi_offset 3, -16
> movl $.LC0, %edi
> xorl %eax, %eax
> .LEHB1:
> call printf
> .LEHE1:
> .LEHB2:
> call Except()
> .LEHE2:
> popq %rbx
> .cfi_remember_state
> .cfi_def_cfa_offset 8
> movl $.LC1, %edi
> xorl %eax, %eax
> jmp printf
> .L5:
> .cfi_restore_state
> movq %rax, %rbx
> movl $.LC1, %edi
> xorl %eax, %eax
> call printf
> movq %rbx, %rdi
> .LEHB3:
> call _Unwind_Resume
> .LEHE3:
> .cfi_endproc
> {code}
> {code:title="-std=c++11 -O2 -fno-exceptions -S"}
> CallNoExcept():
> .LFB18:
> .cfi_startproc
> subq $8, %rsp
> .cfi_def_cfa_offset 16
> movl $.LC0, %edi
> xorl %eax, %eax
> call printf
> call NoExcept()
> movl $.LC1, %edi
> xorl %eax, %eax
> addq $8, %rsp
> .cfi_def_cfa_offset 8
> jmp printf
> .cfi_endproc
> ...
> CallExcept():
> .LFB19:
> .cfi_startproc
> subq $8, %rsp
> .cfi_def_cfa_offset 16
> movl $.LC0, %edi
> xorl %eax, %eax
> call printf
> call Except()
> movl $.LC1, %edi
> xorl %eax, %eax
> addq $8, %rsp
> .cfi_def_cfa_offset 8
> jmp printf
> .cfi_endproc
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)