Primitive argument count

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Primitive argument count

Bert Freudenberg-3
I just noticed that many primitives do not check methodArgumentCount  
but just pop a fixed assumed number of arguments. Wouldn't it be  
better to always check this and fail if called with the wrong count?  
I guess stack corruption isn't as big a problem for us as it is for  
other systems, but still ... Another idea might be to "pop: self  
methodArgumentCount + 1" in the end so it doesn't matter how many  
arguments were supplied.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Primitive argument count

Lex Spoon-3
Bert Freudenberg <[hidden email]> wrote:
> I just noticed that many primitives do not check methodArgumentCount  
> but just pop a fixed assumed number of arguments. Wouldn't it be  
> better to always check this and fail if called with the wrong count?  
> I guess stack corruption isn't as big a problem for us as it is for  
> other systems, but still ... Another idea might be to "pop: self  
> methodArgumentCount + 1" in the end so it doesn't matter how many  
> arguments were supplied.
>
> - Bert -

Keep in mind, though, that some people like to use Squeak in web
browsers.  For such people, it is vital that the VM not corrupt memory
no matter what code is running at the Squeak level.

-Lex