Change the stack representation of the selector in external function pointers (left-aligned or packed)
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
External function types are represented using two stack slots, selector and address.
However, counterintuitively, the selector is right-aligned.
For consistency with the fact that high-level selectors are ``bytes4`` and thus left-aligned (and potentially for efficiency in using the selector for creating the calldata for a call), we should consider changing this, making the selector slot of function types left-aligned.
Alternatively, we can consider switching towards using the packed layout for external function pointers on stack as well.
We may only change this in the reimplementation of external function pointers in experimental solidity, though.
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating the experimental Solidity reimplementation of external function pointers and compare the proposed left-aligned and packed stack layouts. Done means selecting and implementing a layout with agreement on its compatibility and efficiency implications, backed by relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- blockchain, compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100