[Vm-dev] Slang's type inference and typing
pierre_misse25 at msn.com
Mon Dec 16 14:40:09 UTC 2019
On 16/12/2019 15:02, Guillermo Polito wrote:
El 16 dic 2019, a las 13:07, pierre misse <pierre_misse25 at msn.com<mailto: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
and their senders?
There is also a method protocol “type inference” with methods that may seem interesting.
Indeed, but didn't find something that would allow me to launch type inference on something.
Check for senders to try to understand the callgraph backwards :)
I did, got stuck several times, hence me asking.
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.
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.
You may check:
Are there cast as pointers?
Well, technically sqInts are used as pointers.
Check #longAt: and senders.
Thank you in advance :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev