<div dir="ltr"><div>And for your other question concerning the plugin:</div><div><br></div><div>1. it's been fixed only recently</div><div>2. it's not completely fixed with this regard!</div><div><br></div><div>See ThreadedFFIPlugin>>checkAlignmentOfStructSpec:OfLength:StartingAt:</div><div>We are always using the filedSize in case of atomic type as fieldAlignment...</div><div>So it ain't gonna work for double/longlong/ulonglong on 32 bits linux</div><div>(unless library is compiled with -malign-double or other exotic flags, but how could FFI guess that...)</div><div>Ideally, the alignment would be occupying some bits in the type spec.</div><div>Or we hardcode the well known exception in a second place.</div><div>Anyway, the plugin also had to duplicate the alignment algorithm as you can see...</div><div><br></div><div>We live in a world full of such accidental complexity...</div><div>At least, while mankind is taking care of such detail, this leaves less time for killing each other, so let's declare that it's a good thing ;)<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 29 mai 2020 à 17:37, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Found a 32bits debian VM:</div><div><br></div><div>st@debi9:~$ gcc test_align.c <br>st@debi9:~$ ./a.out <br>size of x = 16<br>size of y = 16</div><div><br></div><div>So keep the code, just correct it!<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 29 mai 2020 à 17:01, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Try with this:</div><div><br></div><div>cat > test_align.c <<END<br></div><div>#include <stdio.h><br><br>struct foo1 {int a; long long b; int d;};<br>struct foo2 {int a; double c; int d;};<br><br>int main() {<br>struct foo1 x;<br>struct foo2 y;<br>printf("size of x = %d\n",sizeof(x));<br>printf("size of y = %d\n",sizeof(y));<br>return 0;<br>}</div><div>END</div><div>i686-w64-mingw32-gcc test_align.c</div><div> ./a.exe</div><div><br></div><div>size of x = 24<br>size of y = 24</div><div><br></div><div>so at leat in windows (mingw) the alignment is 8 bytes for both long long and double.</div><div>I have no 32bits linux handy, but it should be easy enough to pass the same test...<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 29 mai 2020 à 16:45, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Good catch!</div><div>Wikipedia page does not even agree on longlong... But it's not the ultimate normative reference, better check by ourselves!</div><div><a href="https://en.wikipedia.org/wiki/Data_structure_alignment" target="_blank">https://en.wikipedia.org/wiki/Data_structure_alignment</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 29 mai 2020 à 15:53, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id="gmail-m_-6700768556464274831gmail-m_-4328114573563368736gmail-m_-350231688662115500gmail-m_3414838106470931193__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0)">Hi, there.<div></div><div><br></div><div>In ExternalType class >> #initializeAtomicTypes, there is an interesting claim and a piece of dead code:</div><div><br></div><div><div>"On 32 bits Windows and MacOS, double and long have an alignment of 8. But on Linux, their alignment is 4"</div><div>(Smalltalk wordSize = 4 and: [Smalltalk platformName = 'unix']) ifTrue: [</div><div><span style="white-space:pre-wrap">  </span>(#('double longlong ulonglong') includes: typeName) ifTrue: [</div><div><span style="white-space:pre-wrap">            </span>byteAlignment := 4</div><div><span style="white-space:pre-wrap">       </span>]</div><div>].</div></div><div><br></div><div>As you can see, there are single quotes missing and so will the path "byteAlignment  := 4" never be reached.</div><div><br></div><div>I tried to figure out whether one should either fix the conditional or remove the entire passage. Maybe this got long fixed inside the FFI plugin?</div><div><br></div><div>Best,</div><div>Marcel</div></div><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>