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