Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::wasm_injections::wasm_binary_injection Class Reference

#include <wasm_sysio_injection.hpp>

Public Member Functions

 wasm_binary_injection (IR::Module &mod)
 
void inject ()
 

Detailed Description

Definition at line 598 of file wasm_sysio_injection.hpp.

Constructor & Destructor Documentation

◆ wasm_binary_injection()

sysio::chain::wasm_injections::wasm_binary_injection::wasm_binary_injection ( IR::Module & mod)
inline

Definition at line 600 of file wasm_sysio_injection.hpp.

600 : _module( &mod ) {
601 // initialize static fields of injectors
603 }
Here is the call graph for this function:

Member Function Documentation

◆ inject()

void sysio::chain::wasm_injections::wasm_binary_injection::inject ( )
inline

Definition at line 605 of file wasm_sysio_injection.hpp.

605 {
606
607 for ( auto& fd : _module->functions.defs ) {
608 wasm_ops::SYSIO_OperatorDecoderStream<pre_op_injectors> pre_decoder(fd.code);
609 wasm_ops::instruction_stream pre_code(fd.code.size()*2);
610
611 while ( pre_decoder ) {
612 auto op = pre_decoder.decodeOp();
613 if (op->is_post()) {
614 op->pack(&pre_code);
615 op->visit( { _module, &pre_code, &fd, pre_decoder.index() } );
616 }
617 else {
618 op->visit( { _module, &pre_code, &fd, pre_decoder.index() } );
619 if (!(op->is_kill()))
620 op->pack(&pre_code);
621 }
622 }
623 fd.code = pre_code.get();
624 }
625 for ( auto& fd : _module->functions.defs ) {
626 wasm_ops::SYSIO_OperatorDecoderStream<post_op_injectors> post_decoder(fd.code);
627 wasm_ops::instruction_stream post_code(fd.code.size()*2);
628
629 while ( post_decoder ) {
630 auto op = post_decoder.decodeOp();
631 if (op->is_post()) {
632 op->pack(&post_code);
633 op->visit( { _module, &post_code, &fd, post_decoder.index() } );
634 }
635 else {
636 op->visit( { _module, &post_code, &fd, post_decoder.index() } );
637 if (!(op->is_kill()))
638 op->pack(&post_code);
639 }
640 }
641 fd.code = post_code.get();
642 }
643 }
IndexSpace< FunctionDef, IndexedFunctionType > functions
Definition Module.h:133
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: