On 4/8/14, 12:56 PM, David Nadlinger wrote:
On Tuesday, 8 April 2014 at 18:55:35 UTC, Brad Roberts wrote:
I think, for a mixed language application, that the important part is proper 
object lifetime
management more than being able to catch exceptions from different languages.  
When unwinding a
c++ exception that has stack frames intermixed with D, destructors need to be 
executed
appropriately, and vice versa.

I haven't actually tried to do this, but in theory, this should be the easy 
part with libunwind. You
just ignore foreign exceptions during the search phase (i.e. not catch them), 
and during the unwind
phase, your own personality function is called again for cleanup regardless of 
the handler the stack
actually unwinds to.

This is also an important part of having abi compatibility between D compilers, 
something which we
don't have today but really must have eventually.. hopefully not years away.

This really depends on somebody familiar with the DMD backend committing to 
going through with it. I
think both on the GDC and LDC sides, there is agreement that we need to work on 
a common ABI.
However, the whole thing would be somewhat of a futile effort without DMD on 
board as well.

On x86_64, ABI compatibility is not an unreasonable goal at all (and a very 
important one, in my
opinion). There are some areas that will need a lot of careful spec'ing and 
likely entail changes in
all three compilers, such as the construction of nested scopes. However, in 
some cases, e.g.
exception unwinding, or proper variadic arguments, it's definitely the case 
that GDC and LDC would
be easy to align, whereas DMD would have to give up its own bespoke solution. 
Does DMD still do
things like magically accessing the scope of the parent function in in/out 
contract calls?

David

Most of the areas where DMD is 'odd' are a case of "I can't figure out the right way, so any way is better than no way". That's particularly true for var args and eh. I'm confident that pulls that fix these issues can and will be accepted. I'm less confident that someone will volunteer to fix it, but it's something I care about.

Reply via email to