[Vm-dev] Question about primitives

Eliot Miranda eliot.miranda at gmail.com
Tue Feb 9 17:48:59 UTC 2010


On Tue, Feb 9, 2010 at 8:41 AM, Mariano Martinez Peck <marianopeck at gmail.com
> wrote:

>
>
>
> On Mon, Feb 8, 2010 at 7:41 PM, Eliot Miranda <eliot.miranda at gmail.com>wrote:
>
>>
>>
>>
>> On Mon, Feb 8, 2010 at 9:42 AM, Mariano Martinez Peck <
>> marianopeck at gmail.com> wrote:
>>
>>>
>>> Hi folks. Disusing with a friend, he asked me if Squeak was completely
>>> written in itself (actually, SLANG). I think (I am not sure) that some parts
>>> of the VM as Interpreter, ObjectMemory, and most primitives are written in
>>> SLANG and then using VMMaker I can convert from that to C. Ok.....but...I
>>> think I heard that there are primitives that are directly written in C (not
>>> SLANG, no translation).  Is this true ?
>>>
>>
>> If you look at the blue book and its definition of what Smalltalk-80 is
>> then all of that except lower-level window management (creating the window
>> in which Squeak appears, collecting events from the GUI), and image I/O
>> (reading and writing the image to and from the snapshot file) is entirely
>> written in Slang and can be run as a simulation.  But go beyond that to the
>> large array of primitives for sound, video and so on and lots of the Slang
>> code for the primitives is merely a wrapper around some library that
>> actually implements the functionality.
>>
>
>
> Thanks Eliot for the explanation. This is new for me so I will be learning
> and bothering for a while ;)
>
>
>>
>>
>>> If true, how can be that addressed ? where is the C code of that?
>>> because, I take VMMaker, I convert to C, then compile, install and I have a
>>> working VM. So...that C code must come somewhere...where is it ? how can I
>>> know if a primitive is written in SLANG or directly in C?
>>>
>>
>> As far as I'm aware all primitives are written in Slang, even if they're
>> simply wrappers.  But if you look in the files in
>>     platforms/{Cross,Mac OS,unix}/plugins/FooPlugin
>> you'll find cross-platform and platform-specific support code for each
>> plugin (a plugin being a related suite of primitives),
>>
>
>
> perfect, I got it and I could see it :)
>
>
>
>> and look in the src tree for plugins and extplugins and look in their
>> subdirectries you'll find all the generated Slang plugin code.
>>
>
>
> I didn't find this. I guess you are talking about the src folder where
> VMMaker put the genereated code, however, I couldn't make it work yet (after
> I tell you the problem)
>

Right, and where the generated code is can vary.  Look for directories
called src or src32. (Or, better generate the code as you're trying to
below; I can help ;) )


>
>
>>
>> A better place to look is in VMMaker using the browser.  There you'll see
>> different kinds of primitive from things like GeniePlugin where all the code
>> is written in Slang to SocketPlugin where all the code is merely wrappers
>> around platform-specific support code.
>>
>
>
> I saw it! Thanks...much clear now.   I have, however, a couple of
> problems/questions:
>
> - I couldn't compile in VMMaker as I have the error:
> "MacOSPowerPCOS9VMMaker could not find directory for: Mac OS specific files;
> is the platform root path set correctly?"   However, I have correctly set
> the path. I attach a screenshot of the pharo image and the output of a
> console.
> Do you know what the problem can be ?
>

The directory the  MacOSPowerPCOS9VMMaker expects is called 'Mac OS' not
MacOS or Macos or...  So either change it to expect MacOS or move or copy
your platforms subdirectory from platforms/MacOS to 'platforms/Mac OS'.


- can I download a "standard" VMMaker configuration from somewhere?
>

John and David are the experts here.  I have a decidedly non-standard
configuration (for the time being) and so am of no help.


>
> - shouldn't be a good idea every time a new official VM is done, to save
> the configuration into a .config file and to include it in the zip ?  So
> that I can reproduce it and know what was done :)
>

Uh, yes :)


> - is there a way to know which are the "core" plugins ? I mean, suppose I
> want to deploy an application, do you know more or less which plugins will
> be VERY likely to be needed ?   For example, I guess I don't need
> CroquetPlugin or FFI if I don't use it in my app, but FilePlugin for
> example, I guess it is needed even to bootstrap (maybe I am wrong, it is
> just an example).
> What I am trying to do is to see how can I create the minimal "production"
> vm according to my needs.
>

I don't know of any proper list.  But these are excellent questions.  I
think we do need a core list and as we work towards a kernel image we should
try and arrange that those primitives needed by things loaded into the core
image but not needed by the kernel image itself are available as external
plugins, with notable exceptions such as the core graphics.  Having a more
modular VM should make it easier to configure, not more difficult, because
the core VM will be a simpler leaner more known quantity and plugins will be
freer to evolve with the packages that they support.



>

> - I know nothing about SLANG, but something surprised me:  "self"  referes
> directly to the C function name ?
> For example, in SocketPlugin >> primitiveResolverAddressLookupResult    it
> does:
> "sz := self sqResolverAddrLookupResultSize."
>
> and sqResolverAddrLookupResultSize is the name of the C function of the
> plugin. WOWWW!!!
>

Yes, in Slang the receiver is elided, except for sends to the
interpreterProxy.  There is effectively only one receiver in the main VM,
the VM itself, and C has no concept of the receiver, so Slang just deletes
it, or converts interpreterProxy foo: arg info interpreterProxy->foo(arg).

You'll see some implementations of the C functions in the
InterpreterSimulator and in subclasses of various plugins that simulate
those plugins (e.g. look at subclasses of the FilePlugin).


>
>
> Thanks for all the help.
>
> Mariano
>
>
>> HTH
>> Eliot
>>
>>
>>> I hope someone can help this newbie :)
>>>
>>> Thanks in advance,
>>>
>>> Mariano
>>>
>>>
>>>
>>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100209/5f0135b5/attachment.htm


More information about the Vm-dev mailing list