Do not assemble `deployedObject` when not requested
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
Currently the runtime subassembly is always created if present, even if the `evm.deployedBytecode`/`--bin-runtime` output is not requested. It happens even when this output is not available, e.g. in command-line Yul mode. While this is not the slowest part of the pipeline, it's still a fair chunk of unnecessary processing that may add up in big projects and could be completely avoided.
### Details
We have two separate places where this happens:
- [In `CompilerStack::assembleYul()`](https://github.com/ethereum/solidity/blob/v0.8.28/libsolidity/interface/CompilerStack.cpp#L1426) for Solidity compilation (note that despite the name, this handles the non-IR assembling as well; we should rename the function).
- [In `YulStack::assembleWithDeployed()`](https://github.com/ethereum/solidity/blob/v0.8.28/libyul/YulStack.cpp#L285) for pure Yul compilation.
We should make the deployed `LinkerObject` and optional result and only generate it when requested.
Note that code generation, optimization and Yul->EVM transformation is already being reused, because creation and deployed assemblies are a part of the same object tree. It's just the final assembling step that is performed independently.
Contributor guide
Research direction
Start by reading CompilerStack::assembleYul() in libsolidity/interface/CompilerStack.cpp and YulStack::assembleWithDeployed() in libyul/YulStack.cpp. Trace when deployed output is requested for Solidity and command-line Yul compilation. Done means the deployed LinkerObject and optional result are assembled only when the corresponding output is requested, without changing shared creation or deployed code generation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100