<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>After the existing legacy Compiler implementation in Squeak/Pharo,</div><div>I draw the contour of an Opal Compiler variant for compiling methods/messages with more than 15 arguments.</div><div>I'am using the single array scheme, but this could be changed easily IMO to 14+excess...</div><div><br></div><div>Contrarily to what I wrote in the comment, the VM does NOT crash and I can implement methods and send messages like this</div><div><br></div><div>a1: a1 a2: a2 a3: a3 a4: a4 a5: a5 a6: a6 a7: a7 a8: a8 a9: a9 a10: a10<br>a11: a11 a12: a12 a13: a13 a14: a14 a15: a15 a16: a16 a17: a17 a18: a18 a19: a19 a20: a20<br>    ^(a1+a2+a3+a4+a5+a6+a7+a8+a9+a10) + (a11+a12+a13+a14+a15+a16+a17+a18+a19+a20)</div><div><br></div><div>testSend<br>    ^(self <br>        a1: 1 a2: 2 a3: 3 a4: 4 a5: 5 a6: 6 a7: 7 a8: 8 a9: 9 a10: 10<br>        a11: 11 a12: 12 a13: 13 a14: 14 a15: 15 a16: 16 a17: 17 a18: 18 a19: 19 a20: 20) = (20*21/2)<br></div><div><br></div><div>Playground: TestManyArgs new testSend. -> true</div><div><br></div><div>Find it here:</div><div><a href="http://www.squeaksource.com/Smallapack/Smallapack-OpalCompiler-nice.1.diff">http://www.squeaksource.com/Smallapack/Smallapack-OpalCompiler-nice.1.diff</a></div><div><br></div><div>It would be nice to re-integrate these tricks in Pharo8 once stable.<br></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Le mer. 9 janv. 2019 à 01:46, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr">Le mar. 8 janv. 2019 à 23:31, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Nicolas,</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 8, 2019 at 1:51 PM Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi all,</div><div>particularly Clement and Eliot,</div><div><br></div><div>One of the most annoying limit of bytecode is the number of arguments (<16 in V3), not so much annoying for pure Smalltalk, but certainly so for FFI (FORTRAN 77 lacks structures so existing code base often have functions with many arguments).</div><div>For scientific Smalltalk, some of those old FORTRAN libraries are still around nowadays (LAPACK is an example).</div></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>Agreed.  There are VW users out there with autogenerated code that requires more than 15 arguments.  Clément and I already have a design in mind, which is much more elegant than using the extra bit below.  However, it does require that we change the maximum Context stack size, which is one reason (the other being lack of time) why we haven't implemented this so far.</div><div><br></div><div>]In 2008 my closure design introduced indirection vectors for closed over arguments and among the five bytecodes added to implement it was the Create Array bytes ode that can do one of two things:</div><div><br></div><div>V3PlusClosures:</div><div><div><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>138   10001010 jkkkkkkk<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>Push (Array new: kkkkkkk) (j = 0)</div><div><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">                                         </span>or<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>Pop kkkkkkk elements into: (Array new: kkkkkkk) (j = 1)</div></div><div><br></div><div>SistaV1:</div><div><div><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>231<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>11100111<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>jkkkkkkk<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>Push (Array new: kkkkkkk) (j = 0)</div><div><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">                                         </span>&<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>Pop kkkkkkk elements into: (Array new: kkkkkkk) (j = 1)</div></div><div><br></div><div>This bytecode is used to create indirection vectors, and to create tuples of size <= 8.  e.g. { thisContext method symbolic. 2. 3. 4. 5. 6. 7. 8 }</div><div>#('89 <52> pushThisContext: </div><div>90 <81> send: method</div><div>91 <80> send: symbolic</div><div>92 <E8 02> pushConstant: 2</div><div>94 <E8 03> pushConstant: 3</div><div>96 <E8 04> pushConstant: 4</div><div>98 <E8 05> pushConstant: 5</div><div>100 <E8 06> pushConstant: 6</div><div>102 <E8 07> pushConstant: 7</div><div>104 <E8 08> pushConstant: 8</div><div>106 <E7 88> pop 8 into (Array new: 8)</div><div>108 <5C> returnTop</div><div><br></div><div>We call this version of the bytecode the cons array bytecode.  The other form, used to create in direction vectors is the greater array bytecode.</div><div><br></div><div>(c.f. { thisContext method symbolic. 2. 3. 4. 5. 6. 7. 8. 9 } which produces much more code but requires only 2 elements of stack depth).</div><div><br></div><div>There are also three bytecodes used to access indirection vectors:</div><div><br></div><div><div>V3PlusClosures:</div><div></div><div><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>140   10001100 kkkkkkkk jjjjjjjj <span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>Push Temp At kkkkkkkk In Temp Vector At: jjjjjjjj</div><div><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>141   10001101 kkkkkkkk jjjjjjjj <span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>Store Temp At kkkkkkkk In Temp Vector At: jjjjjjjj</div><div><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>142   10001110 kkkkkkkk jjjjjjjj <span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>Pop and Store Temp At kkkkkkkk In Temp Vector At: jjjjjjjj</div></div><div>SistaV1:</div><div><div><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>251<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>11111011 kkkkkkkk<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>sjjjjjjj<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>Push Temp At kkkkkkkk In Temp Vector At: jjjjjjj, s = 1 implies remote inst var access instead of remote temp vector access </div><div>*<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>252<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>(3)<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>11111100 kkkkkkkk<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>sjjjjjjj<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>Store Temp At kkkkkkkk In Temp Vector At: jjjjjjj s = 1 implies remote inst var access instead of remote temp vector access </div><div>*<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>253<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>(3)<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>11111101 kkkkkkkk<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>sjjjjjjj<span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>Pop and Store Temp At kkkkkkkk In Temp Vector At: jjjjjjj s = 1 implies remote inst var access instead of remote temp vector access</div></div><div><br></div><div>So the insight is that if we pass arguments beyond 14 in an indirection vector we can have up to 15 + 127 = 142 arguments without needing any extra bits in a CompiledMethod header or range in a bytecode.  We simply pop arguments beyond the 14th into an indirection vector, using the cons array bytecode.  Yes, this is slow compared to "native" support, but such methods are extremely rare, and supporting them this way means we have less waste elsewhere.  It will require some sophistication in the Decompiler, but otherwise seems quite simple.  </div><div><br></div><div>With this design, as far as the VM is concerned the maximum argument count is still 15.  Only the image need bother with how to record the argument count for a method that has 15 or more arguments, and indeed a method with 15 arguments can still use all 15 arguments without having to create an indirection vector.  This isolates the effects to the compiler (arguments beyond the 14th in methods with more than 15 arguments must be accessed using the indirection vector bytecodes above), but otherwise are quite localized: indirection vector creation occurs immediately after normal argument marshaling and immediately before the send bytecode.</div><div><br></div><div>Does this design appeal to you?  If it does, then we should discuss when and how it should be implemented.  One thing would be to make the maximum size of a Context, defined at the image level by CompiledCode's LargeFrame class variable, but hard coded into the VM, some kind of VM parameter, e.g. stored in the image header and read at start-up.  It would be quite easy to add this.  If we did so we should also ensure the stack page size calculation allows for a stack page big enough for one or two huge frames.  Note that the design also means that a large stack is needed only to *marshal* arguments, not to activate a method with many arguments, since the excess arguments are stored in an indirection vector.  </div><div><br></div><div>P.S. Indeed we could use the scheme used for arbitrary sized tuples to marshall extra arguments, but this would affect code generation much more.  Different code would have to be used to marshall each argument beyond 15; whereas using the cons array bytecode</div><div><br></div></div></div></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>Didn't we discussed that already?</div><div>The fact that we have not super fast calls is OK for me.<br></div><div>But I prefer a single Array because I will use invokeWthArguments: FFI primitive.</div><div><br></div><div>transformFFICallwithManyArguments: aPattern<br>    "Transform current parseNode into an invokeWithArguments: send suitable for the case of many arguments"<br>    <br>    ^BlockNode new<br>        temporaries: #() ; "Just to avoid later problems with BlockAnalyzer"<br>        arguments: #()<br>        statements: (OrderedCollection with: (MessageNode new<br>                    receiver: (BlockNode new<br>                            temporaries: #() ; "Just to avoid later problems with BlockAnalyzer"<br>                            arguments: #()<br>                            statements: (OrderedCollection<br>                                    with: (MessageNode new<br>                                            receiver: (encoder encodeLiteral: encoder literals first)<br>                                            selector: #invokeWithArguments:<br>                                            arguments: aPattern arguments<br>                                            precedence: 3<br>                                            from: encoder))<br>                            returns: false<br>                            from: encoder)<br>                    selector: #ifError:<br>                    arguments: (Array with: (parseNode temporaries: parseNode temporaries; yourself))<br>                    precedence: 3<br>                    from: encoder) asReturnNode)<br>        returns: true<br>        from: encoder</div><div><br></div><div>to generate somthing like:</div><div><br></div><div><cdecl: long 'dtgexc_' (long* long* long* double* long* double* long* double* long* double* long* long* long* double* long* long*)><br>65 <8B 78 00> callPrimitive: 120<br>68 <10> pushTemp: 0<br>69 <8F 10 00 04> closureNumCopied: 1 numArgs: 0 bytes 73 to 76<br>73     <23> pushConstant: <cdecl: long 'dtgexc_' (long* long* long* double* long* double* long* double* long* double* long* long* long* double* long* long*)><br>74     <10> pushTemp: 0<br>75     <E2> send: invokeWithArguments:<br>76     <7D> blockReturn<br>77 <8F 00 00 03> closureNumCopied: 0 numArgs: 0 bytes 81 to 83<br>81     <70> self<br>82     <D4> send: externalCallFailed<br>83     <7C> returnTop<br>84 <E1> send: ifError:<br>85 <7C> returnTop<br></div><br><div><div><div>If first 14 arguments come individually, and excess
 arguments into a separate Array, then I will have to remarshall all the
 arguments into a larger Array.</div><div>Unless primitive 120 (primitiveCalloutToFFI) learns how to unmashall by itself?</div><div>Currently primitive 120 will fail (I could eventually remove the primitive number but I don't remember if some image side code depends on it...)</div><div><br></div></div></div><div>Note that I have a kind of SmalltalkPattern that will answer the already packed list of arguments if # >15 (temp 0 above)<br></div><div>SmalltalkPatternForCodeGeneration>>arguments<br>    ^arrayArgumentVariable<br>            ifNil: [argumentNodes asArray]<br>            ifNotNil: [Array with: arrayArgumentVariable].</div><div><br></div><div>SmalltalkPattern>>bindArg: name encoder: encoder <br>    "Accumulate another argument.<br>    Check byte code limit and work around"<br>    | node |<br>    argumentNames size = 15<br>        ifTrue: [arrayArgumentVariable := encoder resetArgumentsAsArray: #singleArrayOfArguments.<br>            argumentNodes := encoder<br>                        rebindArguments: argumentNames<br>                        asArray: arrayArgumentVariable<br>                        pattern: self].<br>    argumentNames add: name.<br>    arrayArgumentVariable isNil<br>        ifTrue: [node := encoder bindTemp: name]<br>        ifFalse: [node := self buildAccessorForArgumentRank: argumentNames size encoder: encoder.<br>            encoder bind: name to: node].<br>    node nowHasDef nowHasRef.<br>    argumentNodes add: node.<br>    ^ node<br></div><br><div>For Marshalling, I already use the BraceNode, which we did not care yet to optimize...</div><div>SmallapackMessageNode>>sizeCodeForValue: encoder<br>    | total argSize |<br>    arguments size > 15 ifFalse: [^super sizeCodeForValue: encoder].<br>    receiver == NodeSuper<br>        ifTrue: [selector := selector copy "only necess for splOops"].<br>    total := selector<br>                sizeCode: encoder<br>                args: 1<br>                super: receiver == NodeSuper.<br>    receiver == nil<br>        ifFalse: [total := total + (receiver sizeCodeForValue: encoder)].<br>    "re-use equalNode for creating the array argument... not a very clean hack"<br>    equalNode := BraceNode new elements: arguments.<br>    argSize := equalNode sizeCodeForValue: encoder.<br>    total := total + argSize.<br>    sizes := Array with: argSize.<br>    ^ total</div><div><br></div><div>97 <70> self<br>98 <75> pushConstant: 0<br>99 <E0> send: cIntegerPointerOn:<br>100 <82 4F> popIntoTemp: 15<br>102 <70> self<br>103 <43> pushLitVar: #Array=>Array<br>104 <24> pushConstant: 16<br>105 <E2> send: braceStream:<br>106 <88> dup<br>107 <70> self<br>108 <10> pushTemp: 0<br>109 <E5> send: cLogicalPointerOn:<br>110 <C4> send: nextPut:<br>111 <87> pop<br>112 <88> dup<br>113 <70> self<br>114 <11> pushTemp: 1<br>115 <E5> send: cLogicalPointerOn:<br>116 <C4> send: nextPut:<br>117 <87> pop<br>118 <88> dup<br>119 <70> self<br>120 <12> pushTemp: 2<br>121 <E0> send: cIntegerPointerOn:<br>122 <C4> send: nextPut:<br>123 <87> pop<br>124 <88> dup<br>125 <13> pushTemp: 3<br>126 <C4> send: nextPut:<br>127 <87> pop<br>128 <88> dup<br>129 <70> self<br>130 <14> pushTemp: 4<br>131 <E0> send: cIntegerPointerOn:<br>132 <C4> send: nextPut:<br>133 <87> pop<br>134 <88> dup<br>135 <15> pushTemp: 5<br>136 <C4> send: nextPut:<br>137 <87> pop<br>138 <88> dup<br>139 <70> self<br>140 <16> pushTemp: 6<br>141 <E0> send: cIntegerPointerOn:<br>142 <C4> send: nextPut:<br>143 <87> pop<br>144 <88> dup<br>145 <17> pushTemp: 7<br>146 <C4> send: nextPut:<br>147 <87> pop<br>148 <88> dup<br>149 <70> self<br>150 <18> pushTemp: 8<br>151 <E0> send: cIntegerPointerOn:<br>152 <C4> send: nextPut:<br>153 <87> pop<br>154 <88> dup<br>155 <19> pushTemp: 9<br>156 <C4> send: nextPut:<br>157 <87> pop<br>158 <88> dup<br>159 <70> self<br>160 <1A> pushTemp: 10<br>161 <E0> send: cIntegerPointerOn:<br>162 <C4> send: nextPut:<br>163 <87> pop<br>164 <88> dup<br>165 <1B> pushTemp: 11<br>166 <C4> send: nextPut:<br>167 <87> pop<br>168 <88> dup<br>169 <1C> pushTemp: 12<br>170 <C4> send: nextPut:<br>171 <87> pop<br>172 <88> dup<br>173 <1D> pushTemp: 13<br>174 <C4> send: nextPut:<br>175 <87> pop<br>176 <88> dup<br>177 <70> self<br>178 <1E> pushTemp: 14<br>179 <E0> send: cIntegerPointerOn:<br>180 <C4> send: nextPut:<br>181 <87> pop<br>182 <88> dup<br>183 <1F> pushTemp: 15<br>184 <C4> send: nextPut:<br>185 <87> pop<br>186 <D6> send: braceArray<br>187 <E1> send: #xtgexcWithwantq:wantz:n:a:lda:b:ldb:q:ldq:z:ldz:ifst:ilst:work:lwork:info: (1 arg)<br>188 <87> pop<br>189 <1F> pushTemp: 15<br>190 <D8> send: getHandle<br>191 <76> pushConstant: 1<br>192 <E7> send: signedLongAt:<br>193 <7C> returnTop<br><br></div><div>For unmarshalling, I did not care too much to optimize the bytecode either, because most use cases are just wrappers to FFI:</div><div>SmalltalkPatternForCodeGeneration>>buildAccessorForArgumentRank: index encoder: encoder <br>    | indexNode |<br>    indexNode := encoder encodeLiteral: index.<br>    ^ MessageForTooManyArgNode new<br>        receiver: arrayArgumentVariable<br>        selector: #at:<br>        arguments: (Array with: indexNode)<br>        precedence: 3<br>        from: encoder<br></div><div><br></div><div>Note that the quick hacks that I already have could be transformed to the form you suggest (14 args + excess_array) without too much efforts if you think that primitiveCalloutToFFI (120) can be re-written to handle 14+excess...</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I patched the old Squeak compiler in Smallapack to workaround this limitation (it was easy enough to pass a single Array, and invoke FFI with many args).<br></div><div>In modern Pharo flavour, this is more involved with the new OpalCompiler (iit does not seem to be designed for extensibility as it seems necessary to patch many pieces/subclasses for a single feature change...).</div><div><br></div><div>But we now have Sista V1 bytecodes which removed a lot of limitations (# inst vars, #literals, max jump offset ...). Alas I don't see a modified limit for number of arguments (source: <a href="https://hal.inria.fr/hal-01088801/document" target="_blank">https://hal.inria.fr/hal-01088801/document</a> a bytecode set for adaptive optimization): there is still a limit of 4 reserved bits in compiled method header documented in link above.</div><div>Though, there is an adjacent unused bit now...</div><div>In Squeak,/Pharo, EncoderForSistaV1>>genSend:numArgs: suggests that the limit is 31 (sic)<br></div><div><br>    (nArgs < 0 or: [nArgs > 31]) ifTrue:<br>        [^self outOfRangeError: 'numArgs' index: nArgs range: 0 to: 31 "!!"].</div><div><br></div><div>or at least 2047 if we believe code below:</div><div><br>    "234        11101010    i i i i i j j j    Send Literal Selector #iiiii (+ Extend A * 32) with jjj (+ Extend B * 8) Arguments"<br></div><div><br></div><div><a href="https://github.com/pharo-project/pharo/blob/50992c3e5fed790b7e660954aee983f4681da658/src/Kernel-BytecodeEncoders/EncoderForSistaV1.class.st" target="_blank">https://github.com/pharo-project/pharo/blob/50992c3e5fed790b7e660954aee983f4681da658/src/Kernel-BytecodeEncoders/EncoderForSistaV1.class.st</a></div><div><br></div><div>Pharo also limit the numArgs to 15 whatever the encoding in CompiledMethod>><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-m_-4305280914427063382gmail-pl-c1">newBytes:</span><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-m_-4305280914427063382gmail-pl-c1">trailerBytes:</span><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-m_-4305280914427063382gmail-pl-c1">nArgs:</span><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-m_-4305280914427063382gmail-pl-c1">nTemps:</span><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-m_-4305280914427063382gmail-pl-c1">nStack:</span><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-m_-4305280914427063382gmail-pl-c1">nLits:</span><span class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail-m_-4305280914427063382gmail-pl-c1">primitive:</span><br></div><div><a href="https://github.com/pharo-project/pharo/blob/50992c3e5fed790b7e660954aee983f4681da658/src/Kernel/CompiledMethod.class.st" target="_blank">https://github.com/pharo-project/pharo/blob/50992c3e5fed790b7e660954aee983f4681da658/src/Kernel/CompiledMethod.class.st</a></div><div><br></div><div>But Squeak does not limit nArgs at all in</div><div>EncoderForSistaV1>>computeMethodHeaderForNumArgs:numTemps:numLits:primitive:<br></div><div><br></div><div>So my questions:</div><div>- is that doc up-to-date?</div><div>- if so, couldn't we expand the limit to 31 args by using the unused bit?</div><div><br></div><div>Note: there is another unused bit in V3 (not adjacent), and the double extended (send) byte code has room for 31 args in V3 too, since only the first 3 bits of second byte encode the type of operation...<br></div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-1178358579132542344gmail-m_-4814448897662012392gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>