<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>At the moment methods are limited to 15 arguments at most.</p>
    <p>Trying to compile a method with more arguments fails:<br>
    </p>
    <blockquote><font face="monospace">with: arg1 with: arg2 with: arg3
        with: arg4 with: arg5 with: arg6 with: arg7 with: arg8 with:
        arg9 with: arg10 with: arg11 with: arg12 with: arg13 with: arg14
        with: arg15 with:  "Too many arguments ->"arg16 <br>
        <br>
            ^ 42</font><br>
    </blockquote>
    <p>This limitation is enforced in Encoder >> bindArg:</p>
    <blockquote><font face="monospace">bindArg: name <br>
            "Declare an argument."<br>
            | node |<br>
            nTemps >= 15<br>
                ifTrue: [^self notify: 'Too many arguments'].<br>
            node := self bindTemp: name.<br>
            ^ node nowHasDef nowHasRef</font></blockquote>
    <p>Looking at where this limitation comes from, I noticed that a
      method header only has 4 bits reserved for the number of
      arguments:</p>
    <blockquote><font face="monospace">header<br>
            "Answer the word containing the information about the form
        of the <br>
             receiver and the form of the context needed to run the
        receiver.<br>
        <br>
                sign:1 29-28:accessModifier 27-24:numArgs 23-18:numTemps
        17:largeFrameFlag 16:hasPrimitive 15:isOptimized 14-0:numLits"<br>
        <br>
            ^self objectAt: 1</font><br>
    </blockquote>
    <p>This, however, only uses 32 bits in total. In a 64bit image, the
      other 32 bits seem to be unused.<br>
    </p>
    <p>Question: Is the limit of 15 arguments still accurate on modern
      VMs & bytecode sets?<br>
    </p>
    <p>Stephan</p>
    <p><br>
    </p>
    <p>Disclaimer: No, I do not want to pass every single pixel of my
      bitmap as an argument ^^. But apparently other people's C-style
      libraries do, and I need to interface with one through FFI. Yes, I
      could build and invoke ExternalFunctions manually, but I would
      reeeaaally prefer not to if given a choice.<br>
    </p>
  </body>
</html>