-
Notifications
You must be signed in to change notification settings - Fork 102
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
ReplaceJumpWithRet #1159
ReplaceJumpWithRet #1159
Conversation
480e590
to
93a5924
Compare
This is the first time I add new instructions to the optimized contract, and the added RET is not binded to source codes with debuginfo. For now this may not be a big problem, but in the future we may need to bind new instructions to source codes. |
84b11b3
to
21c640f
Compare
This make harder the method detection, currently we only have one ret for each method |
do we have limitation on using ret? i dont know that. |
Are we now really restricting the count of RET and detecting methods using the only RET? I can write a robust method detection if needed. I can also abandon this PR and (slowly) write something else to ensure only a single RET exists in a method. |
Go compiler can generate as many RETs for a method as needed and typical Go style even encourages that. Method boundaries are usually tracked with manifests, it's just more reliable. |
@@ -22,7 +22,7 @@ namespace Neo.Optimizer | |||
{ | |||
static class Reachability | |||
{ | |||
[Strategy(Priority = int.MaxValue)] | |||
[Strategy(Priority = int.MaxValue - 16)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a brief comment to explain what 16 means here would be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means nothing. Just reserving spaces for other optimizers. We are not even using the Strategy
attribute now. In the future we may sort all the [Strategy] methods and execute them (cyclically) ordered by Priority
.
@shargon Hey shargon, any further detail about this? |
It complicate the reverse engineering but maybe we should take care more avoid optimization instead of reversing |
If a JMP or JMP_L jumps to a RET, replace the JMP with RET