Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
IR::OperatorDecoderStream Struct Reference

#include <Operators.h>

Public Member Functions

 OperatorDecoderStream (const std::vector< U8 > &codeBytes)
 
 operator bool () const
 
template<typename Visitor >
Visitor::Result decodeOp (Visitor &visitor)
 
template<typename Visitor >
Visitor::Result decodeOpWithoutConsume (Visitor &visitor)
 

Detailed Description

Definition at line 613 of file Operators.h.

Constructor & Destructor Documentation

◆ OperatorDecoderStream()

IR::OperatorDecoderStream::OperatorDecoderStream ( const std::vector< U8 > & codeBytes)
inline

Definition at line 615 of file Operators.h.

616 : nextByte(codeBytes.data()), end(codeBytes.data()+codeBytes.size()) {}

Member Function Documentation

◆ decodeOp()

template<typename Visitor >
Visitor::Result IR::OperatorDecoderStream::decodeOp ( Visitor & visitor)
inline

Definition at line 621 of file Operators.h.

622 {
623 WAVM_ASSERT_THROW(nextByte + sizeof(Opcode) <= end);
624 Opcode opcode = *(Opcode*)nextByte;
625 switch(opcode)
626 {
627 #define VISIT_OPCODE(opcode,name,nameString,Imm,...) \
628 case Opcode::name: \
629 { \
630 WAVM_ASSERT_THROW(nextByte + sizeof(OpcodeAndImm<Imm>) <= end); \
631 OpcodeAndImm<Imm>* encodedOperator = (OpcodeAndImm<Imm>*)nextByte; \
632 nextByte += sizeof(OpcodeAndImm<Imm>); \
633 return visitor.name(encodedOperator->imm); \
634 }
636 #undef VISIT_OPCODE
637 default:
638 nextByte += sizeof(Opcode);
639 return visitor.unknown(opcode);
640 }
641 }
#define WAVM_ASSERT_THROW(cond)
Definition Errors.h:29
#define ENUM_OPERATORS(visitOp)
Definition Operators.h:571
Opcode
Definition Operators.h:576
VISIT_OPCODE(opcode, name,...)
variant< > opcode
Definition opcodes.hpp:79
Here is the caller graph for this function:

◆ decodeOpWithoutConsume()

template<typename Visitor >
Visitor::Result IR::OperatorDecoderStream::decodeOpWithoutConsume ( Visitor & visitor)
inline

Definition at line 644 of file Operators.h.

645 {
646 const U8* savedNextByte = nextByte;
647 typename Visitor::Result result = decodeOp(visitor);
648 nextByte = savedNextByte;
649 return result;
650 }
uint8_t U8
Definition BasicTypes.h:5
Visitor::Result decodeOp(Visitor &visitor)
Definition Operators.h:621
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator bool()

IR::OperatorDecoderStream::operator bool ( ) const
inline

Definition at line 618 of file Operators.h.

618{ return nextByte < end; }

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