<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-cite-prefix">On 16/12/2019 15:02, Guillermo Polito wrote:<br>
</div>
<blockquote type="cite" cite="mid:577291B9-9F5B-4D38-8A5E-B2C2FD9D68C1@gmail.com">
<pre class="moz-quote-pre" wrap=""> </pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> Coucou,<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">El 16 dic 2019, a las 13:07, pierre misse <<a href="mailto:pierre_misse25@msn.com" class="" moz-do-not-send="true">pierre_misse25@msn.com</a>> escribió:</div>
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class="">I'm currently trying to understand Slang's type inference, and to do so trying to write tests.</p>
<p class="">I'm using CCodeGenerator >> #compileToTMethodSelector:in: to get the TMethod, but i cannot seem to find how to use the type inference on this TMethod (or in the instance of CCodeGenerator).</p>
</div>
</div>
</blockquote>
Did you look at the methods</div>
<div><br class="">
</div>
<div>- #returnType[:]</div>
<div>- #typeFor:in:</div>
<div><br class="">
</div>
<div>and their senders?</div>
<div><br class="">
</div>
<div>There is also a method protocol “type inference” with methods that may seem interesting.</div>
</blockquote>
Indeed, but didn't find something that would allow me to launch type inference on something.<br>
<blockquote type="cite" cite="mid:577291B9-9F5B-4D38-8A5E-B2C2FD9D68C1@gmail.com">
<div><br class="">
</div>
<div>Check for senders to try to understand the callgraph backwards :)<br class="">
</div>
</blockquote>
I did, got stuck several times, hence me asking.<br>
<blockquote type="cite" cite="mid:577291B9-9F5B-4D38-8A5E-B2C2FD9D68C1@gmail.com">
<div>
<blockquote type="cite" class="">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class="">Also, I have been wondering what is the semantic of sqInt.</p>
</div>
</div>
</blockquote>
sqInt was introduced, if I’m not mistaken, to abstract the vm for the underlying exact type used.</div>
<div>This was for the initial effort of compiling the VM both for 32 and 64 bits (thus redefining sqInt for the correct one depending on the case).<br class="">
<blockquote type="cite" class="">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class="">I found out it was an alias for a long, but i couldn't find better than that.
</p>
</div>
</div>
</blockquote>
<div>Which in linux and osx is 64bit long ;)</div>
In Windows a long is 32bits but either there is a conditional define for that case stating a long long, or we are super tied to gcc/clang.</div>
<div><br class="">
</div>
<div>To check the actual definition/size, you can try to do a textual search on the entire vmmaker using “method source with it”.<br class="">
<blockquote type="cite" class="">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class="">Are there offsets to find objects in the object memory?</p>
</div>
</div>
</blockquote>
<div>Objects in memory have variable sizes (an array of 10 elements is larger than an array of 2) so there is no such thing as fixed offsets.</div>
<div>Instead, each object has its own size encoded in its header (hidden from the image).</div>
<div>The VM uses that size to find where the object finishes, and where the next object starts.</div>
</div>
</blockquote>
I know that part, but I was thinking that an OOP might be an offsets from the start of the object memory, which would point to the start of the object.<br>
<blockquote type="cite" cite="mid:577291B9-9F5B-4D38-8A5E-B2C2FD9D68C1@gmail.com">
<div>
<div><br class="">
</div>
<div>You may check:</div>
<div><br class="">
</div>
<div>- #objectAfter:</div>
<div>- <a href="https://clementbera.wordpress.com/2014/01/16/spurs-new-object-format/" class="" moz-do-not-send="true">https://clementbera.wordpress.com/2014/01/16/spurs-new-object-format/</a></div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class="">Are there cast as pointers?<br class="">
</p>
</div>
</div>
</blockquote>
<div>Well, technically sqInts are used as pointers.</div>
<div><br class="">
</div>
<div>Check #longAt: and senders.</div>
<blockquote type="cite" class="">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<p class=""></p>
<p class="">Thank you in advance :)<br class="">
</p>
<p class="">Pierre.<br class="">
</p>
</div>
</div>
</blockquote>
</div>
</blockquote>
Pierre<br>
</body>
</html>