[Vm-dev] [CRAZY IDEA] "Breakpoints" in the VM from SLANG

David T. Lewis lewis at mail.msen.com
Wed Apr 13 01:03:39 UTC 2011


On Tue, Apr 12, 2011 at 05:57:25PM -0700, Eliot Miranda wrote:
>  
> On Tue, Apr 12, 2011 at 5:48 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> 
> >
> > On Tue, Apr 12, 2011 at 05:50:56PM +0200, Mariano Martinez Peck wrote:
> > >
> > > On Tue, Apr 12, 2011 at 2:04 PM, David T. Lewis <lewis at mail.msen.com>
> > wrote:
> > >
> > > >
> > > > On Tue, Apr 12, 2011 at 01:40:22PM +0200, Mariano Martinez Peck wrote:
> > > > >
> > > > > So...I need to go to C, and "translate in my mind" what that part of
> > > > SLANG
> > > > > should look like in C, and search it in the C code. XCode is FAAAR to
> > > > slow
> > > > > to browe the interp.c . Morever, with inlined methods it is even more
> > > > > difficult to find...
> > > >
> > > > XCode might be slow, but Squeak is fast :) Have a look at SlangBrowser
> > > > for this. It has not been updated for either Pharo or oscog, but if
> > > > anyone is interested maybe we can get that working too. Source is in
> > > > the SqueakSource VMMaker project, and info at:
> > > >
> > > >  http://wiki.squeak.org/squeak/5916
> > > >
> > >
> > >
> > > Thanks Dave. I wasn't aware of what SlangBrowser was...I always saw it in
> > > the VMMaker repo but I didn't know what it was until today. Cool project.
> > I
> > > really like the idea.
> > > It would be awesome to extendt it so that it can not only supports
> > > ObjectMemory/Interpreter/Plugins  but also CompiledMethods of those
> > classes
> > > :)
> > >
> > > For example,  (Interpreter >>#lookupInMethodCacheSel:class:)  asCString
> > > that would be lovely :)
> >
> > Try this:
> >
> >  Transcript
> >    open;
> >    clear;
> >    show: (Interpreter asCString: #lookupInMethodCacheSel:class:)
> >
> > > Just for the record (if you want to include it in the wiki), in order to
> > > make it work (the asCString) I needed to first load MemoryAccess because
> > it
> > > is used in VMMaker class >>cCodeGenerator: aClass inCache: cache inlined:
> > > doInlining
> > >
> > > You can...or document that on the wiki or maybe add a Smalltalk at:   ?
> > >
> >
> > Oops that's a bug, thanks.
> >
> > > Anyway, how much effort do you think it could be to adapt at least the
> > > asCString to the new Cog versions ?    because this is a nice feature for
> > > when you are learning
> > >
> >
> > It should not be too hard. It's just a matter of creating the
> > CCodeGenerator
> > for any given class in the same way that VMMaker would have done, and using
> > it to generate the code into strings that you can browse in the image
> > and/or
> > display in the browser code pane.
> >
> 
> Take a look at the Slang Test Workspace in
> http://www.squeakvm.org/svn/squeak/branches/Cog/image/VMMaker-Squeak4.1.image.
>  It is all there...  e.g.  (see the sel := assignment).
> 
> Transcript show: [| sel s cg cogitClasses cogitClass structClasses progress
> |
> sel := #remapIfObjectRef:pc:hasYoung:.
> cg := (VMMaker forPlatform: 'Cross')
> interpreterClass: CoInterpreter;
> buildCodeGeneratorForCogit.
> 
> cg removeUnneededBuiltins.
> cg vmClass preGenerationHook: cg.
> cg retainMethods: { #compactCogCompiledCode. sel }.
> cg prepareMethods.
> cg doInlining: true.
> s := ReadWriteStream on: String new.
> (cg methodNamed: sel)
> halt;
> emitCCodeOn: s generator: cg.
> s contents] value

Thanks Eliot, that's what is needed.

Dave



More information about the Vm-dev mailing list