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

Add static type to host functions #1144

Merged
merged 6 commits into from Sep 23, 2021
Merged

Conversation

SupunS
Copy link
Member

@SupunS SupunS commented Sep 23, 2021

Closes #1136


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@codecov-commenter
Copy link

codecov-commenter commented Sep 23, 2021

Codecov Report

Merging #1144 (7b40234) into master (75c54c6) will increase coverage by 0.01%.
The diff coverage is 96.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1144      +/-   ##
==========================================
+ Coverage   73.33%   73.35%   +0.01%     
==========================================
  Files         272      272              
  Lines       34572    34586      +14     
==========================================
+ Hits        25353    25369      +16     
+ Misses       8039     8037       -2     
  Partials     1180     1180              
Flag Coverage Δ
unittests 73.35% <96.89%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
runtime/interpreter/interpreter_transaction.go 100.00% <ø> (ø)
runtime/runtime.go 86.58% <ø> (ø)
runtime/interpreter/interpreter.go 88.40% <91.54%> (+0.04%) ⬆️
runtime/interpreter/function.go 53.44% <100.00%> (+2.57%) ⬆️
runtime/interpreter/value.go 79.02% <100.00%> (+0.11%) ⬆️
runtime/sema/authaccount_contracts.go 100.00% <100.00%> (ø)
runtime/sema/authaccount_type.go 100.00% <100.00%> (ø)
runtime/sema/check_composite_declaration.go 95.98% <100.00%> (+<0.01%) ⬆️
runtime/sema/checker.go 88.88% <100.00%> (ø)
runtime/sema/publicaccount_type.go 100.00% <100.00%> (ø)
... and 6 more

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 75c54c6...7b40234. Read the comment docs.

@SupunS SupunS marked this pull request as ready for review September 23, 2021 00:55
@SupunS SupunS self-assigned this Sep 23, 2021
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 👏

It might be worth it to cache the result of the ConvertStaticToSemaType in the values to avoid converting the static types to sema types each time. Maybe best to do this in a follow-up PR

runtime/interpreter/interpreter.go Outdated Show resolved Hide resolved
runtime/interpreter/interpreter.go Outdated Show resolved Hide resolved
runtime/interpreter/interpreter.go Outdated Show resolved Hide resolved
Co-authored-by: Bastian Müller <bastian@axiomzen.co>
@SupunS
Copy link
Member Author

SupunS commented Sep 23, 2021

It might be worth it to cache the result of the ConvertStaticToSemaType in the values to avoid converting the static types to sema types each time. Maybe best to do this in a follow-up PR

For function types, it shouldn't be too much of an overhead, since it only creates a thin wrapper. But definitely, we could cache these, and also cache parameter types, return types, etc in the FunctionStaticType.

@SupunS SupunS merged commit 2159ad8 into master Sep 23, 2021
@SupunS SupunS deleted the supun/host-func-static-type branch September 23, 2021 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add static types to HostFunctionValue
3 participants