Just a curious question to the veterans

Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Just a curious question to the veterans

Jeremy L.
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Just a curious question to the veterans

Hannes Hirzel
Hello Jeremy,

an interesting question indeed.

A C compiler (or a kind of assistant) in Squeak which 'senses' on
which platform Squeak is running and then produces C - code which is
specific for that platform looks like a useful tool.


Another idea is to consider creating WebAssembly [1] code instead of C.

A VM in the browser, a new endeavour ....


Regards
Hannes


[1] https://en.wikipedia.org/wiki/WebAssembly

WebAssembly (Wasm, WA) is a web standard that defines a binary format
and a corresponding assembly-like text format for executable code in
Web pages. It is meant to enable executing code nearly as fast as
running native machine code.

On 5/23/18, Jeremy Landry <[hidden email]> 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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Just a curious question to the veterans

Bert Freudenberg
In reply to this post by Jeremy L.
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 <[hidden email]> 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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners