[Vm-dev] Slang's type inference and typing

Guillermo Polito guillermopolito at gmail.com
Mon Dec 16 14:02:21 UTC 2019


Coucou,

> El 16 dic 2019, a las 13:07, pierre misse <pierre_misse25 at msn.com> escribió:
> I'm currently trying to understand Slang's type inference, and to do so trying to write tests.
> 
> 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).
> 
Did you look at the methods

- #returnType[:]
- #typeFor:in:

and their senders?

There is also a method protocol “type inference” with methods that may seem interesting.

Check for senders to try to understand the callgraph backwards :)
> Also, I have been wondering what is the semantic of sqInt.
> 
sqInt was introduced, if I’m not mistaken, to abstract the vm for the underlying exact type used.
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).
> I found out it was an alias for a long, but i couldn't find better than that.
> 
Which in linux and osx is 64bit long ;)
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.

To check the actual definition/size, you can try to do a textual search on the entire vmmaker using “method source with it”.
> Are there offsets to find objects in the object memory?
> 
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.
Instead, each object has its own size encoded in its header (hidden from the image).
The VM uses that size to find where the object finishes, and where the next object starts.

You may check:

- #objectAfter:
- https://clementbera.wordpress.com/2014/01/16/spurs-new-object-format/ <https://clementbera.wordpress.com/2014/01/16/spurs-new-object-format/>
> Are there cast as pointers?
> 
Well, technically sqInts are used as pointers.

Check #longAt: and senders.
> Thank you in advance :)
> 
> Pierre.
> 
> 
> 
> 
> 
> 
> 
> On 16/12/2019 08:27, Tobias Pape wrote:
>>  
>> 
>> 
>> (sorry, short on Time atm.)
>> 
>>>> You are receiving this because you are subscribed to this thread.
>> Reply to this email directly, view it on GitHub <https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/450?email_source=notifications&email_token=AIJPEW7MIZ52B4XAWLM3UPDQY4UXFA5CNFSM4JYBTAVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG5YPYI#issuecomment-565938145>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AIJPEW4O6CMJIZPIRGJFE3TQY4UXFANCNFSM4JYBTAVA>.
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20191216/37efc20d/attachment.html>


More information about the Vm-dev mailing list