[Issue 21013] dwarfeh: Comparing LSDA is too unreliable to determine if two exceptions can be merged
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 5 14:04:48 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21013
--- Comment #2 from Iain Buclaw <ibuclaw at 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.
--
More information about the Digitalmars-d-bugs
mailing list