Hope you are doing well. We were running a simple contract and trying to analyse the assembly code generated by the browser compiler. In the .data part we found a section where the compiler executes a specific logic where it matches the method id of the methods, written in the code and generates the specific tags. But before it matches the method id it executes some logic which we could not figure out why it is required? May you please explain the algorithm behind this....
The contract
pragma solidity ^0.4.0; contract Test { uint x = 0; uint y = 8; function calculate() { uint z = x+y; } }
-----------------.data section in the assembly code--------------------
PUSH1 0x60 PUSH1 0x40 MSTORE PUSH1 0x0 CALLDATALOAD PUSH29 0x100000000000000000000000000000000000000000000000000000000 SWAP1 DIV PUSH4 0xFFFFFFFF AND DUP1 PUSH4 0xCA77AB65 EQ PUSH1 0x3C JUMPI
It will be immensely helpful if you can help us to understand this algorithm and why it does this.
Thank you in advance.
Thanks, Shamik.