<br><br><div class="gmail_quote">On Tue, Apr 12, 2011 at 5:48 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;</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>
&gt;<br>
&gt; On Tue, Apr 12, 2011 at 2:04 PM, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; On Tue, Apr 12, 2011 at 01:40:22PM +0200, Mariano Martinez Peck wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; So...I need to go to C, and &quot;translate in my mind&quot; what that part of<br>
&gt; &gt; SLANG<br>
&gt; &gt; &gt; should look like in C, and search it in the C code. XCode is FAAAR to<br>
&gt; &gt; slow<br>
&gt; &gt; &gt; to browe the interp.c . Morever, with inlined methods it is even more<br>
&gt; &gt; &gt; difficult to find...<br>
&gt; &gt;<br>
&gt; &gt; XCode might be slow, but Squeak is fast :) Have a look at SlangBrowser<br>
&gt; &gt; for this. It has not been updated for either Pharo or oscog, but if<br>
&gt; &gt; anyone is interested maybe we can get that working too. Source is in<br>
&gt; &gt; the SqueakSource VMMaker project, and info at:<br>
&gt; &gt;<br>
&gt; &gt;  <a href="http://wiki.squeak.org/squeak/5916" target="_blank">http://wiki.squeak.org/squeak/5916</a><br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt; Thanks Dave. I wasn&#39;t aware of what SlangBrowser was...I always saw it in<br>
&gt; the VMMaker repo but I didn&#39;t know what it was until today. Cool project. I<br>
&gt; really like the idea.<br>
&gt; It would be awesome to extendt it so that it can not only supports<br>
&gt; ObjectMemory/Interpreter/Plugins  but also CompiledMethods of those classes<br>
&gt; :)<br>
&gt;<br>
&gt; For example,  (Interpreter &gt;&gt;#lookupInMethodCacheSel:class:)  asCString<br>
&gt; that would be lovely :)<br>
<br>
Try this:<br>
<br>
  Transcript<br>
    open;<br>
    clear;<br>
    show: (Interpreter asCString: #lookupInMethodCacheSel:class:)<br>
<br>
&gt; Just for the record (if you want to include it in the wiki), in order to<br>
&gt; make it work (the asCString) I needed to first load MemoryAccess because it<br>
&gt; is used in VMMaker class &gt;&gt;cCodeGenerator: aClass inCache: cache inlined:<br>
&gt; doInlining<br>
&gt;<br>
&gt; You can...or document that on the wiki or maybe add a Smalltalk at:   ?<br>
&gt;<br>
<br>
Oops that&#39;s a bug, thanks.<br>
<br>
&gt; Anyway, how much effort do you think it could be to adapt at least the<br>
&gt; asCString to the new Cog versions ?    because this is a nice feature for<br>
&gt; when you are learning<br>
&gt;<br>
<br>
It should not be too hard. It&#39;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: &#39;Cross&#39;)</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>