Closed larryk85 closed 1 year ago
You will also need to look to CDT's EOSIOLIB for how to expose the host functions so that you can call them. Hint, they look a lot like extern "C", an eerie amount like them.
Does requirement "Total number of memory operations executed." means that all 25 memory instructions should be intercepted and counted?
Answer from @larryk85 : each type of the memory operation should be counted separately.
Update for the educational task from @larryk85:
For anyone who wants additional work for this.
One thing of note is that you can implement both static and dynamic analysis for this and have your tool produce both. I.e. one that counts the number of memory ops without running the wasm (i.e. static count) and one that is used via extending the interpret_visitor.
An additional task for you and others who want more would be to analyze the running WASM and output a listing of WASM pointers to material addresses (i.e. fully materialized on the native side), additional points if you can output the WASM line number information of those memory operations.
Review what "tail calls" are https://en.wikipedia.org/wiki/Tail_call. Analyze the WASM in the same way that you would write your analyze either statically or dynamically "find" the locations for sites where tail call optimizations would be available.
Compile EOS-VM into a small program of your creation,
The program should do the following:
Create a set of host functions:
LEAP
host functions for reference).Any additional ones you want to make is worth additional golden banana stickers.
Create a visitor that extends https://github.com/AntelopeIO/eos-vm/blob/main/include/eosio/vm/interpret_visitor.hpp that captures debug data:
You should create a new 'backend' with your visitor to be used in the same manner as the normal interpreter or JIT backend.