Sitelet https://web.archive.org/web/20201113050249/https://github.com/ethereum/solidity/pull/8951
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sol->Yul] Split internal dispatch into separate enumeration and code generation (refactor) #8951

Merged
merged 4 commits into from May 20, 2020

Conversation

@cameel
Copy link
Member

@cameel cameel commented May 14, 2020

Based on #8949 which needs to be merged first.

Refactoring changes extracted from #8943 (and before that from #8797). Does not affect functionality.
Related to #6788 and #8485.

@cameel cameel requested a review from chriseth May 14, 2020
@cameel cameel self-assigned this May 14, 2020
@cameel cameel force-pushed the sol-yul-refactor-split-internal-dispatch branch 2 times, most recently from fb815ad to 98b9955 May 14, 2020
@cameel cameel added this to Review in progress in Solidity May 14, 2020
@cameel cameel changed the title [Sol->Yul] Split internal dispatch into separate enumeration and code generation [Sol->Yul] Split internal dispatch into separate enumeration and code generation (refactor) May 14, 2020
@cameel cameel force-pushed the sol-yul-refactor-split-internal-dispatch branch from 9bb8922 to 08d1984 May 14, 2020
@cameel cameel force-pushed the sol-yul-refactor-add-arity branch from 6b76e97 to e31d66c May 15, 2020
@cameel cameel force-pushed the sol-yul-refactor-split-internal-dispatch branch 2 times, most recently from 15b0283 to 75efd4f May 15, 2020
@cameel cameel force-pushed the sol-yul-refactor-add-arity branch 2 times, most recently from 97378d0 to fc85050 May 19, 2020
@cameel cameel force-pushed the sol-yul-refactor-split-internal-dispatch branch 2 times, most recently from 9209810 to 8eb6838 May 19, 2020
Base automatically changed from sol-yul-refactor-add-arity to develop May 19, 2020
@@ -102,7 +102,8 @@ class IRGenerationContext

std::string newYulVariable();

std::string internalDispatch(YulArity const& _arity);
std::string generateInternalDispatchFunction(YulArity const& _arity);
std::string generateInternalDispatchFunction(YulArity const& _arity, std::set<FunctionDefinition const*> _functions);

This comment has been minimized.

@chriseth

chriseth May 19, 2020
Contributor

I still don't like this split very much. The problem here is that both functions are named the same and calling one function at whatever time is always safe but calling the second function with the wrong second argument can result in severe damage. Is it compatible with what follows to do it as follows?

string IRGenerationContext::generateInternalDispatchFunction(YulArity const& _arity)
{
	string funName = IRNames::internalDispatch(_arity);
    set<FunctionDefinition const*> functions = collectFunctionsOfArity(_arity); // this is the second function
	return m_functions.createFunction(funName, [funName, _arity, functions(move(_functions))]() {
        ...
    });
}

This comment has been minimized.

@cameel

cameel May 20, 2020
Author Member

Done.

It's fine for this PR but it forced me to reorganize the code in #8797 in an awkward way. I had to move the whole generateInternalDispatch() from IRGenerator to IRGenerationContext because otherwise I'd have to add more methods to context only to allow it to get the arities without consuming the dispatch content. It doesn't feel quite right to have a whole part of code generation (rather than just helpers) in the context.

@cameel cameel force-pushed the sol-yul-refactor-split-internal-dispatch branch from 8eb6838 to 2094b09 May 20, 2020
…ons from generateInternalDispatch() into a separate function
@cameel cameel force-pushed the sol-yul-refactor-split-internal-dispatch branch from 2094b09 to 6c6a8a7 May 20, 2020
@cameel cameel mentioned this pull request May 20, 2020
8 of 8 tasks complete
@chriseth chriseth merged commit 29405c2 into develop May 20, 2020
36 checks passed
36 checks passed
ci/circleci: b_archlinux Your tests passed on CircleCI!
Details
ci/circleci: b_docs Your tests passed on CircleCI!
Details
ci/circleci: b_ems Your tests passed on CircleCI!
Details
ci/circleci: b_osx Your tests passed on CircleCI!
Details
ci/circleci: b_ubu Your tests passed on CircleCI!
Details
ci/circleci: b_ubu18 Your tests passed on CircleCI!
Details
ci/circleci: b_ubu_asan Your tests passed on CircleCI!
Details
ci/circleci: b_ubu_asan_clang Your tests passed on CircleCI!
Details
ci/circleci: b_ubu_clang Your tests passed on CircleCI!
Details
ci/circleci: b_ubu_cxx20 Your tests passed on CircleCI!
Details
ci/circleci: b_ubu_ossfuzz Your tests passed on CircleCI!
Details
ci/circleci: b_ubu_release Your tests passed on CircleCI!
Details
ci/circleci: chk_antlr_grammar Your tests passed on CircleCI!
Details
ci/circleci: chk_buglist Your tests passed on CircleCI!
Details
ci/circleci: chk_coding_style Your tests passed on CircleCI!
Details
ci/circleci: chk_docs_pragma_min_version Your tests passed on CircleCI!
Details
ci/circleci: chk_proofs Your tests passed on CircleCI!
Details
ci/circleci: chk_pylint Your tests passed on CircleCI!
Details
ci/circleci: chk_spelling Your tests passed on CircleCI!
Details
ci/circleci: t_ems_compile_ext_colony Your tests passed on CircleCI!
Details
ci/circleci: t_ems_compile_ext_gnosis Your tests passed on CircleCI!
Details
ci/circleci: t_ems_compile_ext_zeppelin Your tests passed on CircleCI!
Details
ci/circleci: t_ems_solcjs Your tests passed on CircleCI!
Details
ci/circleci: t_osx_cli Your tests passed on CircleCI!
Details
ci/circleci: t_osx_soltest Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_asan_cli Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_asan_constantinople Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_asan_constantinople_clang Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_clang_soltest Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_cli Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_release_cli Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_release_soltest Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_soltest Your tests passed on CircleCI!
Details
ci/circleci: t_ubu_soltest_enforce_yul Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Solidity automation moved this from Review in progress to Done May 20, 2020
@chriseth chriseth deleted the sol-yul-refactor-split-internal-dispatch branch May 20, 2020
@cameel cameel added this to In progress in Sol -> Yul CodeGen via automation Jun 3, 2020
@cameel cameel moved this from In progress to Done in Sol -> Yul CodeGen Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Solidity
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.