<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 5/23/2011 11:14, Mariano Martinez Peck wrote:
    <blockquote
      cite="mid:BANLkTikjv5gD0ZiMGAHuLa5hxpVRyxmgoA@mail.gmail.com"
      type="cite">
      <pre wrap=""> </pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      Excellent point. Thanks Andreas. I am serializing to disk a CM and
      I want to be sure it will work when I materialize it and load back
      later on in an image (it can be even a different image). So, I
      guess that the externalPrimitiveTable can change and even more the
      module of such named primitive may not be loaded at that time.<br>
      <br>
      So, it is correct so assume that the safest approach is to put a
      zero as function index ?&nbsp; this way it will always work?<br>
    </blockquote>
    <br>
    Yes.<br>
    &nbsp; - A.<br>
    <br>
    <blockquote
      cite="mid:BANLkTikjv5gD0ZiMGAHuLa5hxpVRyxmgoA@mail.gmail.com"
      type="cite"><br>
      Thanks!<br>
      <br>
      Mariano<br>
      <br>
      <div class="gmail_quote">On Mon, May 23, 2011 at 10:09 AM, Andreas
        Raab <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">&nbsp;<br>
          <div bgcolor="#ffffff" text="#000000"> See the comment in
            Interpreter&gt;&gt;primitiveExternalCall.<br>
            <br>
            primitiveExternalCall<br>
            &nbsp;&nbsp;&nbsp; "Call an external primitive. The external primitive
            methods <br>
            &nbsp;&nbsp;&nbsp; contain as first literal an array consisting of: <br>
            &nbsp;&nbsp;&nbsp; * The module name (String | Symbol) <br>
            &nbsp;&nbsp;&nbsp; * The function name (String | Symbol) <br>
            &nbsp;&nbsp;&nbsp; * The session ID (SmallInteger) [OBSOLETE] <br>
            &nbsp;&nbsp;&nbsp; * The function index (Integer) in the
            externalPrimitiveTable <br>
            &nbsp;&nbsp;&nbsp; For fast failures the primitive index of any method
            where the <br>
            &nbsp;&nbsp;&nbsp; external prim is not found is rewritten in the method
            cache <br>
            &nbsp;&nbsp;&nbsp; with zero. This allows for ultra fast responses as long
            as the <br>
            &nbsp;&nbsp;&nbsp; method stays in the cache. <br>
            &nbsp;&nbsp;&nbsp; The fast failure response relies on lkupClass being
            properly <br>
            &nbsp;&nbsp;&nbsp; set. This is done in <br>
            &nbsp;&nbsp;&nbsp; #addToMethodCacheSel:class:method:primIndex: to <br>
            &nbsp;&nbsp;&nbsp; compensate for execution of methods that are looked up
            in a <br>
            &nbsp;&nbsp;&nbsp; superclass (such as in primitivePerformAt). <br>
            &nbsp;&nbsp;&nbsp; With the latest modifications (e.g., actually flushing
            the <br>
            &nbsp;&nbsp;&nbsp; function addresses from the VM), the session ID is
            obsolete. <br>
            &nbsp;&nbsp;&nbsp; But for backward compatibility it is still kept around.
            Also, a <br>
            &nbsp;&nbsp;&nbsp; failed lookup is reported specially. If a method has
            been <br>
            &nbsp;&nbsp;&nbsp; looked up and not been found, the function address is
            stored <br>
            &nbsp;&nbsp;&nbsp; as -1 (e.g., the SmallInteger -1 to distinguish from <br>
            &nbsp;&nbsp;&nbsp; 16rFFFFFFFF which may be returned from the lookup). <br>
            &nbsp;&nbsp;&nbsp; It is absolutely okay to remove the rewrite if we run
            into any <br>
            &nbsp;&nbsp;&nbsp; problems later on. It has an approximate speed
            difference of <br>
            &nbsp;&nbsp;&nbsp; 30% per failed primitive call which may be noticable but
            if, <br>
            &nbsp;&nbsp;&nbsp; for any reasons, we run into problems (like with J3) we
            can <br>
            &nbsp;&nbsp;&nbsp; always remove the rewrite. <br>
            &nbsp;&nbsp;&nbsp; "<br>
            <br>
            <br>
            On 5/23/2011 10:03, Mariano Martinez Peck wrote:
            <blockquote type="cite">
              <pre> </pre>
              <br>
              <fieldset></fieldset>
              <br>
              Hi folks. I was inspecting for example the CM of&nbsp; Integer
              &gt;&gt; #bitAnd:&nbsp;&nbsp; and the first literal is an array like
              this: #(#LargeIntegers #primDigitBitAnd 0 17)<br>
              <br clear="all">
              I understand the first and the second elements, but I
              don't the third and the fourth. What are they? (0 and 17)
              because then even seem to change their value.<br>
              <br>
              I am asking because I am serializing CompiledMethod and
              then at materialization time I am putting just two zeros
              for the moment. But I am not sure what they mean.<br>
              <br>
              Thanks in advance,<br clear="all">
              <br>
              -- <br>
              Mariano<br>
              <a moz-do-not-send="true"
                href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
              <br>
            </blockquote>
          </div>
          <br>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      Mariano<br>
      <a moz-do-not-send="true" href="http://marianopeck.wordpress.com"
        target="_blank">http://marianopeck.wordpress.com</a><br>
      <br>
    </blockquote>
  </body>
</html>