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

Implement the binary search dispatch for the IR codegen #12688

Closed
hrkrshnn opened this issue Feb 16, 2022 · 6 comments
Closed

Implement the binary search dispatch for the IR codegen #12688

hrkrshnn opened this issue Feb 16, 2022 · 6 comments
Labels
closed due inactivity The issue/PR was automatically closed due to inactivity. stale The issue/PR was marked as stale because it has been open for too long.

Comments

@hrkrshnn
Copy link
Member

The binary search for the function dispatch seems to be only implemented in the legacy codegen.

Context:

void ContractCompiler::appendInternalSelector(

Implement the same for the IR based codegen.

@cameel
Copy link
Member

cameel commented Feb 17, 2022

Related: #12650.

@chriseth
Copy link
Contributor

I would prefer binary search (or constant-time search) to be implemented for all switch statements instead of writing custom code for the external dispatch. This has the advantage that it 1) can use jumps because it will be in the evm code gen and 2) it automatically applies to the external and the internal dispatch.

@frangio
Copy link
Contributor

frangio commented Feb 17, 2022

I would prefer binary search (or constant-time search) to be implemented for all switch statements instead of writing custom code for the external dispatch.

I'm not sure this is possible for constant-time search without a special case for external dispatch. The last developments in #12650 make use of the fact that selectors are already random, so re-hashing is not needed. This will not be true of an arbitrary switch statement.

@chriseth
Copy link
Contributor

While that is true, we can still try. Since the case values are compile-time constants, we will know if it failed or not.

@github-actions
Copy link

This issue has been marked as stale due to inactivity for the last 90 days.
It will be automatically closed in 7 days.

@github-actions github-actions bot added the stale The issue/PR was marked as stale because it has been open for too long. label Mar 24, 2023
@github-actions
Copy link

github-actions bot commented Apr 1, 2023

Hi everyone! This issue has been automatically closed due to inactivity.
If you think this issue is still relevant in the latest Solidity version and you have something to contribute, feel free to reopen.
However, unless the issue is a concrete proposal that can be implemented, we recommend starting a language discussion on the forum instead.

@github-actions github-actions bot added the closed due inactivity The issue/PR was automatically closed due to inactivity. label Apr 1, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed due inactivity The issue/PR was automatically closed due to inactivity. stale The issue/PR was marked as stale because it has been open for too long.
Projects
None yet
Development

No branches or pull requests

5 participants