Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
July 05, 2020 [Issue 21013] dwarfeh: Comparing LSDA is too unreliable to determine if two exceptions can be merged | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21013 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |GDC CC| |ibuclaw@gdcproject.org -- |
July 05, 2020 [Issue 21013] dwarfeh: Comparing LSDA is too unreliable to determine if two exceptions can be merged | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21013 --- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> --- One stable input that could instead be used is the function FQN, or perhaps better, the hash of it. This cannot be done by changing the constructor signature of Exception/Error to: @nogc @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable nextInChain = null, string func = __PRETTY_FUNCTION__); This does not work, as __FUNCTION__ will be the name of the constructor that super() was called, not the function of the originating throw statement. (Not to mention that it breaks far to much user code to do so). So the _d_throw function signature must change instead (I'm using a string here for example purposes, a hash_t would be better IMO): void _d_throw(Throwable object, string func); So the calling code: throw new Exception("msg"); Gets lowered as: _d_throwX(Exception.__ctor(_d_newclass(&Exception.__class)), "foo.bar"); And the ExceptionHeader created in _d_throwX saves this information: ExceptionHeader *eh = ExceptionHeader.create(object, func); The two referenced lines in the D personality functions would then be updated as presented below: [1] --- // Don't combine when the exceptions are from different functions if (eh.func != ehn.func) { //printf("break: %s %s\n", eh.func.ptr, ehn.func.ptr); break; } --- [2] --- // like __dmd_personality_v0, don't combine when the exceptions are // from different functions (fixes issue 19831, exception thrown and // caught while inside finally block) if (eh.func != ehn.func) { // printf("break: %s %s\n", eh.func.ptr, ehn.func.ptr); break; } --- -- |
July 05, 2020 [Issue 21013] dwarfeh: Comparing LSDA is too unreliable to determine if two exceptions can be merged | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21013 --- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> --- (In reply to Iain Buclaw from comment #1) > One stable input that could instead be used is the function FQN, or perhaps better, the hash of it. > Though shortly after sending the last message, I now see that I was thinking only about problem [2], and not what would also work for [1] as well. What instead works for both would be if an internal state were to be updated when entering each try/catch or try/finally region. e.g: --- void bug1513a() { throw new Exception("d"); } void bug1513() { try { /// _d_eh_setContext("bug1513"); /// try { /// _d_eh_setContext("bug1513"); /// bug1513a(); } finally { throw new Exception("f"); } } catch(Exception e) { assert(e.msg == "d"); assert(e.next.msg == "f"); assert(!e.next.next); } } --- void test4() { void throw_catch() { try { /// _d_eh_setContext("test4.throw_catch"); /// throw new MyException; } catch (MyException) { } catch (Exception) { assert(false); } } try { /// _d_eh_setContext("test4"); /// try { /// _d_eh_setContext("test4"); /// throw new Exception("a"); } finally { throw_catch(); } } catch(Exception e) { assert(e.msg == "a"); assert(!e.next); } } --- Which means there's unfortunately going to be a heavy performance penalty for using EH. -- |
July 05, 2020 [Issue 21013] dwarfeh: Comparing LSDA is too unreliable to determine if two exceptions can be merged | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21013 kinke <kinke@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kinke@gmx.net --- Comment #3 from kinke <kinke@gmx.net> --- Excellent findings. I think that's finally the explaination for one remaining unittest failure with 32-bit ARM a few years back (std.random IIRC; could be worked around by disabling inlining). I'm still not convinced exception chaining is worth all these troubles. -- |
December 17, 2022 [Issue 21013] dwarfeh: Comparing LSDA is too unreliable to determine if two exceptions can be merged | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21013 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
December 07 [Issue 21013] dwarfeh: Comparing LSDA is too unreliable to determine if two exceptions can be merged | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21013 --- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17189 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation