In other words, do any opcodes pop a variable number of elements from the stack?
The Ethereum Virtual Machine allows up to 1024 elements on the stack, so it should be possible to allow a variable number of inputs as long as this limit is respected.
In other words, do any opcodes pop a variable number of elements from the stack?
The Ethereum Virtual Machine allows up to 1024 elements on the stack, so it should be possible to allow a variable number of inputs as long as this limit is respected.
As of 2023-10-01 all opcodes take a fixed number of stack inputs. https://ethereum.org/en/developers/docs/evm/opcodes/
Some opcodes, like call, accept an arbitrary amount of data, but they receive the length and a pointer to memory through the stack.
The EVM is not a register machine but a stack machine, so all computations are performed on a data area called the stack. It has a maximum size of 1024 elements and contains words of 256 bits. Access to the stack is limited to the top end in the following way: It is possible to copy one of the topmost 16 elements to the top of the stack or swap the topmost element with one of the 16 elements below it. All other operations take the topmost two (or one, or more, depending on the operation) elements from the stack and push the result onto the stack. Of course it is possible to move stack elements to storage or memory in order to get deeper access to the stack, but it is not possible to just access arbitrary elements deeper in the stack without first removing the top of the stack.