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

Process return in inlined functions properly. #1785

Merged
merged 2 commits into from
Mar 1, 2021
Merged

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Feb 26, 2021

Close #1784 .

@codecov
Copy link

codecov bot commented Feb 26, 2021

Codecov Report

Merging #1785 (7577bbe) into master (347212c) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1785      +/-   ##
==========================================
+ Coverage   83.52%   83.60%   +0.08%     
==========================================
  Files         271      271              
  Lines       22004    22015      +11     
==========================================
+ Hits        18378    18405      +27     
+ Misses       2501     2482      -19     
- Partials     1125     1128       +3     
Impacted Files Coverage Δ
pkg/compiler/codegen.go 90.66% <100.00%> (+0.02%) ⬆️
pkg/compiler/inline.go 100.00% <100.00%> (ø)
pkg/services/oracle/request.go 62.29% <0.00%> (+4.91%) ⬆️
pkg/services/oracle/oracle.go 89.87% <0.00%> (+12.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 347212c...7577bbe. Read the comment docs.

fyrchik added 2 commits March 1, 2021 11:48
Some control-flow statements drop stack items, for example
`return` when it is used inside of `range` loop.
For inlined calls this `return` should drop only portion of stack
which belongs to inlined call.
Consider function call `f(1, g(2, 3))` when
both `f` and `g` are inlined. If `f` contains some locals,
inlining `g` will replace them with it's another locals map,
because slices in Go reuse storage on `append`.
Thus scope needs to be copied.
@roman-khimov roman-khimov merged commit 3227de8 into master Mar 1, 2021
@roman-khimov roman-khimov deleted the fix/compiler branch March 1, 2021 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler Go smart contract compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some interops inside for loop break it
2 participants