www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - 1.1.0 ABI change for classes inheriting from interfaces

reply Johan Engelen <j j.nl> writes:
Hi all,
  I just discovered an important ABI change from 1.0.0 to 1.1.0.

For this code
```
interface I {
     void foo();
}

class A : I {
     int field;

     void foo() {}
}
```

1.0.0 generates the type:
     %abi.A = type { %abi.A.__vtbl*, i8*, i32, [4 x i8], { 
%object.Interface*, void (%abi.A*)* }* }
whereas 1.1.0 generates the type:
     %abi.A = type { %abi.A.__vtbl*, i8*, { %object.Interface*, 
void (%abi.A*)* }*, i32 }

Note that the location of the interface vtbl ptr was moved!

1.1.0 behavior is according to spec: 
https://dlang.org/spec/abi.html

-Johan
Nov 21 2016
next sibling parent reply Johan Engelen <j j.nl> writes:
On Monday, 21 November 2016 at 16:28:28 UTC, Johan Engelen wrote:
 Hi all,
  I just discovered an important ABI change from 1.0.0 to 1.1.0.
Which turns out is a 2.070 -> 2.071 ABI change (DMD shows the same).
Nov 21 2016
parent reply ZombineDev <petar.p.kirov gmail.com> writes:
On Monday, 21 November 2016 at 16:31:15 UTC, Johan Engelen wrote:
 On Monday, 21 November 2016 at 16:28:28 UTC, Johan Engelen 
 wrote:
 Hi all,
  I just discovered an important ABI change from 1.0.0 to 1.1.0.
Which turns out is a 2.070 -> 2.071 ABI change (DMD shows the same).
Yes, DMD's ABI behavior and the spec were changed between 2.070 and 2.071 by Walter. The goal, IIRC, was better extern(C++) ABI compatability, in addition to other stuff like DWARF exception handling. Relevant PR: https://github.com/dlang/dlang.org/pull/1225
Nov 21 2016
parent ZombineDev <petar.p.kirov gmail.com> writes:
On Monday, 21 November 2016 at 16:38:33 UTC, ZombineDev wrote:
 On Monday, 21 November 2016 at 16:31:15 UTC, Johan Engelen 
 wrote:
 On Monday, 21 November 2016 at 16:28:28 UTC, Johan Engelen 
 wrote:
 Hi all,
  I just discovered an important ABI change from 1.0.0 to 
 1.1.0.
Which turns out is a 2.070 -> 2.071 ABI change (DMD shows the same).
Yes, DMD's ABI behavior and the spec were changed between 2.070 and 2.071 by Walter. The goal, IIRC, was better extern(C++) ABI compatability, in addition to other stuff like DWARF exception handling. Relevant PR: https://github.com/dlang/dlang.org/pull/1225
See also: https://github.com/dlang/dmd/pull/5361
Nov 21 2016
prev sibling parent Johan Engelen <j j.nl> writes:
On Monday, 21 November 2016 at 16:28:28 UTC, Johan Engelen wrote:
 Hi all,
  I just discovered an important ABI change from 1.0.0 to 1.1.0.
If you know of other ABI changes, please add them to the 1.1.0 release notes. (These are important for our industrial user Weka.io!) thanks, Johan
Nov 21 2016