This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revised instruction-count bounding with fewer checks and loads/stores.
This PR revises the simple instruction-count binding work, which initially loaded and stored the instruction-count field from memory on every basic block and emitted an extra conditional branch and yielding block after every basic block, with two optimizations: 1. The instruction count is kept in a local variable (which the register allocator will ideally keep in a register unless spills are necessary), and this count is saved back to the field in memory only when necessary, e.g., before calls and returns. 2. The checks and conditional branches are inserted only in places where necessary to ensure bounded time between checks, at the cost of slightly more overrun/approximation in the bound: specifically, before calls and returns (to avoid unbounded runtime due to recursion) and at loop backedges.
- Loading branch information
Showing
8 changed files
with
330 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
lucet-runtime/tests/instruction_counting/long_loop_start.wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(module | ||
(start $start) | ||
(func $start (export "_start") (local i32) | ||
loop | ||
local.get 0 | ||
i32.const 1 | ||
i32.add | ||
local.tee 0 | ||
i32.const 10000 | ||
i32.ne | ||
br_if 0 | ||
end | ||
) | ||
(func $instruction_count (export "instruction_count") (result i64) | ||
i64.const 70000 | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.