oop - Argument count limit of methods in Smalltalk-80 implementation -
the maximum number of arguments of method limited 2^5-1
(i.e. 31) because there 5 bits encode number of arguments in compiled method illustrated in figure 27.4 of blue book. double extended send bytecode has 8 bits encode number of arguments (see definition of doubleextendedsendbytecode
here), means can send many 2^8-1
(i.e. 127) arguments message (using perform:
or statement not compiled). contradiction? think bytecode uses many bits encode number of arguments.
yes, contradiction did not yet matter enough.
also, number of arguments in methods bounded maximum number of temporary variables in method, too, in smalltalks happen 2^8-1
.
there part that:
in squeak, number of arguments restricted 15 (2^4-1
), , has nibble (4 bit) of space in method header. comment of squeak's compiledmethod
states:
(index 18) 6 bits: number of temporary variables (#numtemps) (index 24) 4 bits: number of arguments method (#numargs)
with #numtemps
including number of arguments, too.
long story short, yes, the doubleextendedsendbytecode
encode more arguments expressible in compiledmethod
.
this 1 of reasons replaced in squeak doubleextendeddoanything
bytecode can more sends, limits number of arguments 2^5-1
(which still more compiledmethod
can encode, not unlikely compiledmethod
change in foreseeable future encode more 15 arguments).
Comments
Post a Comment