According to https://ethervm.io, when CALL instruction is executed, the stack layout like this:
[address, value, argOffset, argLen, retOffset, retLen]
So CALL would pop 6 words from stack bottom to retrieve necessary information.
But when I looked at the opcode of this Solidity code:
contract Test {
function withdraw() public {
uint x = 123;
msg.sender.call.value(x)();
}
}
I can see the related opcode is like below:
33 caller
90 swap1
82 dup3
90 swap1
60 00 push1 00
81 dup2
81 dup2
81 dup2
85 dup6
87 dup8
5a gas
f1 call
We can see that before CALL, GAS push the remaining gas into stack bottom. But this changes the stack layout, and the bottom word is not caller address anymore.
Does this mean information from https://ethervm.io is incorrect, or do I miss something here?
Thanks!