<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 15, 2013 at 10:17 AM, Bob Arning <span dir="ltr">&lt;<a href="mailto:arning315@comcast.net" target="_blank">arning315@comcast.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <font face="Georgia">I&#39;m not clear on what you are suggesting.
      Dispatching a message does</font> require the VM knowing the class
    of the receiver, but how and where the VM might collect that
    information is not clear. Perhaps an example would help.<br></div></blockquote><div><br></div><div>The JIT uses inline caches at send sites to optimize sends.  These tell you</div><div>- whether a send has been executed; if a send has never been executed the send site will be unlinked with no cache data.</div>
<div>- whether the send has been sent to a single class of receiver, and what that class is; if so, a send site will be linked to a method and have one class entry in the inline cache.</div><div>- whether the send has been sent to a small number of classes of receiver (in Cog up to 6), and what these are; if so the send site will be linked to a &quot;closed&quot; Polymorphic Inline Cache with up to 6 class entries.</div>
<div>- whether the send has been sent to more than 6 classes; if so the site will be linked to an &quot;open&quot; polymorphic inline cache, which is a first-level method lookup cache probe with no classes cached.</div><div>
<br></div><div>So the VM, in optimizing sends, collects type data on send sites, untaken, monomorphic, polymorphic or megamorphic.  This is the bases of adaptive optimization in VMs such as HotSpot and V8.  After Spur, this is the next target for Cog.</div>
<div><br></div><div>See e.g. <a href="http://www.mirandabanda.org/cogblog/2011/03/01/build-me-a-jit-as-fast-as-you-can/">build me a jit</a> for gory details.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
    <br>
    Cheers,<br>
    Bob</div></blockquote><div><br></div><div>HTH</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">

    <br>
    <div>On 9/15/13 1:06 PM, Frank Shearar
      wrote:<br>
    </div>
    <blockquote type="cite">
      <pre>On 15 September 2013 17:38, Florin Mateoc <a href="mailto:florin.mateoc@gmail.com" target="_blank">&lt;florin.mateoc@gmail.com&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre>On 9/15/2013 11:47 AM, Frank Shearar wrote:
</pre>
        <blockquote type="cite">
          <pre>On 15 Sep 2013, at 14:57, Florin Mateoc <a href="mailto:florin.mateoc@gmail.com" target="_blank">&lt;florin.mateoc@gmail.com&gt;</a> wrote:

</pre>
          <blockquote type="cite">
            <pre>On 9/15/2013 5:54 AM, Frank Shearar wrote:
</pre>
            <blockquote type="cite">
              <pre>I was rereading Phlip&#39;s &quot;what&#39;s wrong with our IDEs&quot; post -
<a href="http://www.oreillynet.com/onlamp/blog/2008/05/dynamic_languages_vs_editors.html" target="_blank">http://www.oreillynet.com/onlamp/blog/2008/05/dynamic_languages_vs_editors.html</a>
- and realised that he&#39;s just verbalised something I&#39;ve only
half-thought.

When we run our tests (because of course we&#39;re using TDD) we know the
precise types/expected classes of everything, because the VM
automatically collects (or can collect) this information.

But how do we get that information out of the VM?

frank


</pre>
            </blockquote>
            <pre>You don&#39;t need to extract it from the VM, you can have a type profiler that collects it for you in the image.
</pre>
          </blockquote>
          <pre>Doesn&#39;t that just mean twice as much work? The VM of necessity has already typed the call sites (even if the typing is only eventually correct). Why could a mirror not expose the typing thus far?

frank

</pre>
          <blockquote type="cite">
            <pre>Florin

</pre>
          </blockquote>
          <pre></pre>
        </blockquote>
        <pre>Doing it in the image means you do it in Smalltalk. Extracting it from the VM means you are doing it in C/assembly.
And I definitely do not understand the argument with twice as much work. Work for whom? For the computer? Well, that&#39;s
its job. As the developer, you only do it once, regardless which option you chose. I prefer doing it in Smalltalk
</pre>
      </blockquote>
      <pre>Well, someone  has to write the code to collect and extract the information.

Unless I&#39;ve completely misunderstood you, you&#39;re saying I should build
an interpreter within which to run my tests, and that collects this
type information. I&#39;m saying that the VM has to do this _already_ and
exposing this information to the image (through a mirror or similar)
means that (a) you get accurate type information and (b) you don&#39;t
have to write an interpreter.

How would a type profiler collect information at least as accurately
as the VM already does?

frank


</pre>
    </blockquote>
    <br>
  </div></div></div>

<br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>