[Newbies] Just a curious question to the veterans

Bert Freudenberg bert at freudenbergs.de
Wed May 23 20:25:29 UTC 2018


Currently the VM is built via C, correct. The core of the VM is written in
Smalltalk, which is translated to C using the VMMaker package. The
generated C files are compiled to machine code using some C compiler (and
also linked with platform-specific hand-written C files).

So what we actually want is machine code, that is, code executable by the
CPU in your machine. There is no intrinsic need for C at all. Machine code
could be produced directly from our Smalltalk sources. In fact, that is how
BEE Smalltalk works (
http://esug.org/data/ESUG2014/IWST/Papers/iwst2014_Design%20and%20implementation%20of%20Bee%20Smalltalk%20Runtime.pdf),
and COLA was imagined (
http://piumarta.com/software/cola/colas-whitepaper.pdf).

These papers also give good reasons why having all this in Smalltalk is
great.

The reason Squeak is using an external C compiler is to leverage the amount
of work people put in to make this work on any imaginable platform. Being
based on C is part of what makes Squeak so portable. Someone else (the C
implementer) is taking care of producing the right machine code for all
kinds of processors, and all ABIs (the convention used to call system
libraries). All of this would have to be implemented for every CPU and
every operating system in Smalltalk - we just don't have the man power for
that.

- Bert -


On 22 May 2018 at 21:46, Jeremy Landry <hakyoku at gmail.com> wrote:

> I'm not at the level where this would mean anything to me in a practical
> sense, but I was curious about the VM and compiling the VM and the fact VM
> exports C-code (DJGPP or something?).  I was curious as to whether it would
> be beneficial at all to write a C compiler inside of squeak, at least for
> the common 'systems'. I suppose having an external compiler let's one
> ignore some of the more important details of the host system to compile for
> and probably contributes to a lack of one.  But I was curious if anyone's
> ever tried making any kind of compiler that spits out standalone VMs or
> other types of very specific-use external programs with squeak/smalltalk
> and if that was ever a consideration of something that any users had tried
> to tackle.
>
> Again, keep it somewhat 'dumb' in the answer. Compilers and such are way
> over my head, but I had the thought about this question while reading
> repeatedly that the VM gets exported to be compiled by a C compiler rather
> than natively inside of the running system and wondered if there are any
> advantages to that other than just being a part of the puzzle that is
> handled much better by a 3rd party maintaining a compiler separately.
>
> Thanks and sorry if this is in the wrong mailing list.
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20180523/19dfa1c6/attachment.html>


More information about the Beginners mailing list