[Cuis-dev] Slang for Cuis (WIP, experimental)

David T. Lewis lewis at mail.msen.com
Sat May 30 11:22:16 PDT 2020


Hi Philip,


On Sat, May 30, 2020 at 07:42:57AM +0200, Philip Bernhart via Cuis-dev wrote:
> Hi Luciano,
> 
> Luciano Notarfrancesco via Cuis-dev <cuis-dev at lists.cuis.st> writes:
> 
> > This is great! Can this be used for writing named primitives (not FFI)
> > plugins? It was super easy to do that in Squeak, and I miss it. I think we
> > could do that without the VMMaker paraphernalia, just with an include file
> > corresponding to the VM we???re using. If I remember correctly, that???s how it
> > worked in Squeak.
> 
> in theory it could. The current state of the project is that I removed
> the VM plugin generation machinery, because it was intertwined with
> the VMMaker on one hand and on the other hand my current focus is to
> target FFI based plugins as this seems to be the bigger usecase for
> Slang. As named external plugin primitives were deemed by the SqueakVM
> list subscribers mostly a bad idea, which should be removed from the
> Opensmalltalk-VM I thought also that it wasn't worth the work to begin
> with this.
>

Don't believe everything you read on vm-dev ;-)

If you are interested in writing your own primitives for just about
any reason at all, then named primitives are exactly what you want.

Regarding stand-along slang generation, as a point of comparison you
may want to take a look at the interactive "slang browsing" in the
traditional VMMaker. This is set up to attempt C code translation for
any instance-side method in any class (not just the VM classes).

If you would like to look at this, here is how to do it:

1) Download a Squeak 4.6 image, either from the squeak.org home page or
directly from http://files.squeak.org/4.6/Squeak-4.6-All-in-One.zip.

2) Unpack the zip file, then run Squeak (on Linux, you would run the
squeak.sh script in the all-in-one folder).

3) Open a Monticello browser (world menu -> open... -> Monticello Browser).

4) In the Monticello browser, click the +Repository button, select HTTP
repository type, then paste this into the dialog:

MCHttpRepository
	location: 'http://source.squeak.org/VMMaker'
	user: ''
	password: ''
 
5) Highlight the VMMaker repository inthe Monticello browser, then click
the "Open" button.

6) Scroll down the left panel of the repository browser and select "update".
In the right panel, select update-dtl.20.mcm, then click the "Load" button.

7) Evaluate "VMMaker initialize" to set up slang browsing.

Now open a class browser and select an instance-side method in any
class you want to browse.

On the right side of the middle button panel of the browser, you will
see a button labeled "source". Click that button, then select either
"translate to C" or "translate inlined C".

Not all methods can be successfully translated, but often you can
proceed through warnings or errors and still end up with a C translation.
You can poke around a few classes and get an idea of what works and what
doesn't.

Class Random is a good one to look at. You will get one warning that
you can procede through, and all of the methods will give you plausible
looking C code.

HTH,
Dave



 
> There are a couple of implementation problems with external
> named primitive plugins too, for example how do you keep the plugin
> interface of the VM you are developing on in line with the generated
> plugin, so the sq.h header file and all its dependencies? I also
> don't want to put pressure on Juan Vuletich for say packaging always
> the correct set of the opensmalltalk-vm headers with it or only
> allow the functioning of Cuis Slang on systems which have a "proper"
> installation with headers in place.
> 
> BUT I try to find a way if I can put back that functionality,
> without the baggage.
> 
> I try to document my progress in the projects journal:
>  https://github.com/Phantasus/Cuis-Smalltalk-Slang/blob/master/Journal.md
> 
> 
> Thanks for your interest,
> Philip
> 
> -- 
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev


More information about the Cuis-dev mailing list