[Vm-dev] Question about primitives
K. K. Subramaniam
subbukk at gmail.com
Tue Feb 9 02:55:47 UTC 2010
On Monday 08 February 2010 11:12:50 pm Mariano Martinez Peck 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 ?
Yes. Slang is like lex or yacc and primitives are like API bindings. Each
plugin has two layers coded in C - the top layer has a regular pattern and is
usually generated automatically from Slang and the bottom layer which is hand-
coded. The main program is also a platform-specific layer and is hand-coded.
> 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.
The code generated by VMMaker from Slang is just a library. The platform team
hand-codes the main program, platform support code and the build scripts. For
instance, the unix source tree has:
/platforms/Cross/ - platform independent support code (hand-coded)
/platforms/unix/ - unix specific VM and plugin code (hand-coded)
/platforms/unix/src/ - VM interpreter library and plugins (Slang-coded)
/platforms/unix/cmake/ - build scripts
The build scripts for the VM and its plugins merge the code from Cross/ unix/
and unix/src to build the complete VM and its plugins.
> 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?
The first line of a generated file will contain information about the Slang
source code and the VM used to generate this file.
HTH .. Subbu
More information about the Vm-dev
mailing list