Where can I read about the standard primitives in Squeak? I can find lots of resources on writing my own primitives, but I want to know what the existing ones do. For example, I'm looking at the "new" method in Behavior and I see "<primitive: 70>". Where can I find a description of that does? Is there an easy way to find the corresponding C source code?
--- Mark Volkmann
Mark Volkmann a écrit :
Where can I read about the standard primitives in Squeak? I can find lots of resources on writing my own primitives, but I want to know what the existing ones do. For example, I'm looking at the "new" method in Behavior and I see "<primitive: 70>". Where can I find a description of that does? Is there an easy way to find the corresponding C source code?
Mark Volkmann
I forgot the links, but search for Smalltalk blue book at Stephane Ducasse site.
If you load VMMaker, you will have the code for most of these primitives in Smalltalk pseudo-C code (slang). Most of C "source" is in fact generated from that.
Nicolas
At Sat, 1 Nov 2008 10:17:38 -0500, Mark Volkmann wrote:
Where can I read about the standard primitives in Squeak? I can find lots of resources on writing my own primitives, but I want to know what the existing ones do. For example, I'm looking at the "new" method in Behavior and I see "<primitive: 70>". Where can I find a description of that does?
For "new", you would probably like to know the object and object memory format as well. So, reading the related sections in:
http://www.google.com/search?q=squeak+back+to+the+future
would help. Then, the source is the best "resource". Install the VMMaker and look at the Interpreter class>>initializePrimitiveTable. It says primitive 70 is primitiveNew. So browse the implementor(s) of primitiveNew and you see what it does.
Or, you can view the versions up to when the Interpreter was still maintained in the image at:
http://tinlizzie.org:8080/seaside/examples/authorship2
check off the "show only existing" box, and navigate to Interpreter and navigate to primitiveNew. You see the code with diffs.
Is there an easy way to find the corresponding C source code?
The best thing is to generate the C code by yourself from VMMaker, but just to get the feel of it, go to:
http://squeakvm.org/cgi-bin/viewcvs.cgi/trunk/platforms/unix/src/vm/interp.c...
and search for primitiveNew.
It is also a good idea to download an old image where the InterpreterSimulator still works. Squeak 2.4c would be good, if I remember correctly.
-- Yoshiki
On Sat, Nov 01, 2008 at 08:41:16AM -0700, Yoshiki Ohshima wrote:
At Sat, 1 Nov 2008 10:17:38 -0500, Mark Volkmann wrote:
Is there an easy way to find the corresponding C source code?
The best thing is to generate the C code by yourself from VMMaker, but just to get the feel of it, go to:
http://squeakvm.org/cgi-bin/viewcvs.cgi/trunk/platforms/unix/src/vm/interp.c...
and search for primitiveNew.
Also, if you want to browse the generated C code within the image, you can use SlangBrowser: http://wiki.squeak.org/squeak/5916
This will let you view the C code directly in Squeak browsers, with and without method inlining. In other words, you can look at the #primitiveNew method as it is written in Smalltalk, switch to a "translate to C" view to see the same method translated to C, then switch to a "translate inlined C" view to see the effect of method inlining (this is how the function will appear in the generated interp.c file).
Dave
On Nov 1, 2008, at 8:17 AM, Mark Volkmann wrote:
Where can I read about the standard primitives in Squeak? I can find lots of resources on writing my own primitives, but I want to know what the existing ones do. For example, I'm looking at the "new" method in Behavior and I see "<primitive: 70>". Where can I find a description of that does? Is there an easy way to find the corresponding C source code?
Mark Volkmann
As mentioned the VM is built from Slang code, but it requires some platform specific code to interact with the operating system, there is now some documentation at http://isqueak.org/PlatformVMAP
Of course if you don't have an operating system http://sourceforge.net/projects/squeaknos/
-- = = = ======================================================================== John M. McIntosh johnmci@smalltalkconsulting.com Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com = = = ========================================================================
squeak-dev@lists.squeakfoundation.org