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

test: Add one more br_if test case #378

Merged
merged 1 commit into from
Jun 25, 2020
Merged

test: Add one more br_if test case #378

merged 1 commit into from
Jun 25, 2020

Conversation

chfast
Copy link
Collaborator

@chfast chfast commented Jun 8, 2020

Idea taken from #367 (comment).

This seems to be running slightly slower, so leaving only tests case.
Diff for reference:

--- a/lib/fizzy/execute.cpp
+++ b/lib/fizzy/execute.cpp
@@ -678,20 +678,19 @@ execution_result execute(
                 goto end;
             break;
         }
-        case Instr::br:
+
         case Instr::br_if:
-        case Instr::return_:
-        {
-            // Check condition for br_if.
-            if (instruction == Instr::br_if && static_cast<uint32_t>(stack.pop()) == 0)
+            if (static_cast<uint32_t>(stack.pop()) == 0)
             {
                 immediates += BranchImmediateSize;
                 break;
             }
-
+            [[fallthrough]];
+        case Instr::br:
+        case Instr::return_:
             branch(code, stack, pc, immediates);
             break;
-        }
+
         case Instr::br_table:
         {
             const auto br_table_size = read<uint32_t>(immediates);

@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #378 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #378   +/-   ##
=======================================
  Coverage   99.32%   99.32%           
=======================================
  Files          42       42           
  Lines       12814    12834   +20     
=======================================
+ Hits        12728    12748   +20     
  Misses         86       86           

@chfast chfast force-pushed the br_execute_refactor branch 2 times, most recently from 85b29fe to 5ca940b Compare June 25, 2020 08:51
@chfast chfast force-pushed the br_execute_refactor branch from 5ca940b to caddec7 Compare June 25, 2020 12:37
@chfast chfast changed the title Refactor br/br_if cases in execute() test: Add one more br_if test case Jun 25, 2020
@chfast chfast requested review from axic and gumb0 June 25, 2020 12:38
@chfast chfast merged commit 81f0320 into master Jun 25, 2020
@chfast chfast deleted the br_execute_refactor branch June 25, 2020 12:48
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

Successfully merging this pull request may close these issues.

3 participants