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

Asm.fif: splitting of large function bodies incorrectly interfere with inlines #375

Closed
EmelyanenkoK opened this issue May 18, 2022 · 1 comment

Comments

@EmelyanenkoK
Copy link
Member

PROGRAM{
  DECLPROC foo
  DECLPROC main
  foo PROC:<{
    { NOP } 1000 times
  }>
  main PROC:<{
    foo INLINECALLDICT
    123456789 PUSHINT
  }>
}END>c

The following code will return nothing instead of 123456789: it is result that inserted due to split JMPREFs will jump out of the main.

Possible solution is to wrap large inline functions with <{ }> PUSHCONT EXECUTE or CALLREF.
Issue was found by @SpyCheese

SpyCheese added a commit to SpyCheese/ton that referenced this issue May 19, 2022
EmelyanenkoK added a commit that referenced this issue Aug 4, 2022
* Don't use IFJMP/IFNOTJMP in inline functions

* Fix incorrect ifelse branch code generation 

#374

* Make generate_code_all clearer

* Don't replace IFJMP with IF in inner blocks in inline functions

* Allow unbalance if/else by using RETALT

* Fix wrong PUSHCONT

* Bugfix in IF code generation for inline functions

* Fix unbalanced if/else

* Bugfix and improvements in code generation

* Fix analyzing while(0) in func

#377

* FunC and Asm.fif: Fix inlining large functions

#375

Co-authored-by: SpyCheese <[email protected]>
EmelyanenkoK added a commit that referenced this issue Aug 4, 2022
* Don't use IFJMP/IFNOTJMP in inline functions

* Fix incorrect ifelse branch code generation 

#374

* Make generate_code_all clearer

* Don't replace IFJMP with IF in inner blocks in inline functions

* Allow unbalance if/else by using RETALT

* Fix wrong PUSHCONT

* Bugfix in IF code generation for inline functions

* Fix unbalanced if/else

* Bugfix and improvements in code generation

* Fix analyzing while(0) in func

#377

* FunC and Asm.fif: Fix inlining large functions

#375

Co-authored-by: SpyCheese <[email protected]>
@Maxim17081983
Copy link

0XSNCRYPTO added a commit to 0XSNCRYPTO/ton that referenced this issue Aug 26, 2024
* Don't use IFJMP/IFNOTJMP in inline functions

* Fix incorrect ifelse branch code generation 

ton-blockchain/ton#374

* Make generate_code_all clearer

* Don't replace IFJMP with IF in inner blocks in inline functions

* Allow unbalance if/else by using RETALT

* Fix wrong PUSHCONT

* Bugfix in IF code generation for inline functions

* Fix unbalanced if/else

* Bugfix and improvements in code generation

* Fix analyzing while(0) in func

ton-blockchain/ton#377

* FunC and Asm.fif: Fix inlining large functions

ton-blockchain/ton#375

Co-authored-by: SpyCheese <[email protected]>
0XSNCRYPTO added a commit to 0XSNCRYPTO/ton that referenced this issue Aug 26, 2024
* Don't use IFJMP/IFNOTJMP in inline functions

* Fix incorrect ifelse branch code generation 

ton-blockchain/ton#374

* Make generate_code_all clearer

* Don't replace IFJMP with IF in inner blocks in inline functions

* Allow unbalance if/else by using RETALT

* Fix wrong PUSHCONT

* Bugfix in IF code generation for inline functions

* Fix unbalanced if/else

* Bugfix and improvements in code generation

* Fix analyzing while(0) in func

ton-blockchain/ton#377

* FunC and Asm.fif: Fix inlining large functions

ton-blockchain/ton#375

Co-authored-by: SpyCheese <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@EmelyanenkoK @Maxim17081983 and others