Refactor table and simplify calls#616
Conversation
Codecov Report
@@ Coverage Diff @@
## master #616 +/- ##
==========================================
+ Coverage 98.33% 98.35% +0.01%
==========================================
Files 69 69
Lines 9535 9526 -9
==========================================
- Hits 9376 9369 -7
+ Misses 159 157 -2 |
45c070b to
98a8d93
Compare
| // This pointer is empty most of the time and is used only to keep instance alive in one edge | ||
| // case, when start function traps, but instantiate has already modified some elements of a | ||
| // shared (imported) table. | ||
| std::shared_ptr<Instance> shared_instance; |
There was a problem hiding this comment.
This is a simple way to keep instance alive as long as there is function using it in some table. This was previously achieved by capturing this shared_ptr<Instance> in std::function of table element.
Now this looks like an overhead included in each table element every time, but needed only in weird edge case.
But on the other hand, previously there was std::function's dynamic allocation overhead for each table element all the time, and now this shared_ptr stays empty in normal cases, so this theoretically should be overall more efficient than before.
There was a problem hiding this comment.
This is better now. But I'd still prefer to handle that differently (not necessarily in this PR): either separate start() from instantiate() or return tuble Instance*, bool from instantiate().
|
Clang10 with LTO |
| // This pointer is empty most of the time and is used only to keep instance alive in one edge | ||
| // case, when start function traps, but instantiate has already modified some elements of a | ||
| // shared (imported) table. | ||
| std::shared_ptr<Instance> shared_instance; |
There was a problem hiding this comment.
This is better now. But I'd still prefer to handle that differently (not necessarily in this PR): either separate start() from instantiate() or return tuble Instance*, bool from instantiate().
b7c4c9a to
4ab5a58
Compare
|
AMD EPYC 7601, GCC10, no LTO |
|
AMD EPYC 7601, GCC10, LTO |
4ab5a58 to
74bda14
Compare
|
Pulled out of #615