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

WIP: add Wasmi translation invariants checker #1233

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Oct 8, 2024

Closes #1209.

Post-Conditions

  • All registers of all instructions of a translated function are valid.
    • In particular register in the preservation space are properly defragmented.
  • All function, table, memory and global indices are valid for the given ModuleHeader and Engine.
  • If consume_fuel is enabled, no BranchOffset[16]s may be 0.
  • If consume_fuel is enabled, all BranchOffset[16]s that jump backwards must target a ConsumeFuel instruction.
  • All ConsumeFuel instructions must consume at least 1 fuel.
  • All BranchOffset[16]s must have valid jump destinations within the same function.
  • All (conditional) return instructions must return the same number as the number of results of the translated function.
  • For all instructions with parameter instructions, check if they are properly encoded in sequence.

@Robbepop Robbepop force-pushed the rf-translation-post-conditions branch from 939ee56 to 880f917 Compare October 11, 2024 10:59
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 27.73109% with 172 lines in your changes missing coverage. Please review.

Project coverage is 81.07%. Comparing base (1aa2256) to head (b4daaca).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
crates/wasmi/src/engine/translator/conditions.rs 26.81% 161 Missing ⚠️
crates/wasmi/src/module/mod.rs 0.00% 8 Missing ⚠️
crates/wasmi/src/engine/translator/stack/mod.rs 0.00% 2 Missing ⚠️
crates/wasmi/src/engine/translator/mod.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1233      +/-   ##
==========================================
- Coverage   81.58%   81.07%   -0.51%     
==========================================
  Files         306      307       +1     
  Lines       25270    25506     +236     
==========================================
+ Hits        20616    20680      +64     
- Misses       4654     4826     +172     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 debug post-conditions for Wasmi translation
1 participant