Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | List of all members
dev::eth::jit::GasMeter Class Reference

#include <GasMeter.h>

Inheritance diagram for dev::eth::jit::GasMeter:
[legend]
Collaboration diagram for dev::eth::jit::GasMeter:
[legend]

Public Member Functions

 GasMeter (IRBuilder &_builder, RuntimeManager &_runtimeManager, evm_mode mode)
 
void count (Instruction _inst)
 Count step cost of instruction. More...
 
void count (llvm::Value *_cost, llvm::Value *_jmpBuf=nullptr, llvm::Value *_gasPtr=nullptr)
 Count additional cost. More...
 
void countSStore (class Ext &_ext, llvm::Value *_index, llvm::Value *_newValue)
 Calculate & count gas cost for SSTORE instruction. More...
 
void countExp (llvm::Value *_exponent)
 Calculate & count additional gas cost for EXP instruction. More...
 
void countLogData (llvm::Value *_dataLength)
 Count gas cost of LOG data. More...
 
void countSha3Data (llvm::Value *_dataLength)
 Count gas cost of SHA3 data. More...
 
void commitCostBlock ()
 Finalize cost-block by checking gas needed for the block before the block. More...
 
void giveBack (llvm::Value *_gas)
 Give back an amount of gas not used by a call. More...
 
void countMemory (llvm::Value *_additionalMemoryInWords, llvm::Value *_jmpBuf, llvm::Value *_gasPtr)
 Generate code that checks the cost of additional memory used by program. More...
 
void countCopy (llvm::Value *_copyWords)
 Count addional gas cost for memory copy. More...
 

Private Member Functions

int64_t getStepCost (Instruction inst) const
 

Private Attributes

int64_t m_blockCost = 0
 Cumulative gas cost of a block of instructions Handle overflow. More...
 
llvm::CallInst * m_checkCall = nullptr
 
llvm::Function * m_gasCheckFunc = nullptr
 
RuntimeManagerm_runtimeManager
 
evm_mode m_mode
 EVM compatibility mode. More...
 

Additional Inherited Members

- Protected Member Functions inherited from dev::eth::jit::CompilerHelper
 CompilerHelper (IRBuilder &_builder)
 
 CompilerHelper (const CompilerHelper &)=delete
 
CompilerHelperoperator= (CompilerHelper)=delete
 
llvm::Module * getModule ()
 Reference to the IR module being compiled. More...
 
llvm::Function * getMainFunction ()
 Reference to the main module function. More...
 
- Protected Attributes inherited from dev::eth::jit::CompilerHelper
IRBuilderm_builder
 Reference to parent compiler IR builder. More...
 

Detailed Description

Definition at line 16 of file GasMeter.h.

Constructor & Destructor Documentation

dev::eth::jit::GasMeter::GasMeter ( IRBuilder _builder,
RuntimeManager _runtimeManager,
evm_mode  mode 
)

Definition at line 18 of file GasMeter.cpp.

Here is the call graph for this function:

Member Function Documentation

void dev::eth::jit::GasMeter::commitCostBlock ( )

Finalize cost-block by checking gas needed for the block before the block.

Definition at line 135 of file GasMeter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void dev::eth::jit::GasMeter::count ( Instruction  _inst)

Count step cost of instruction.

Definition at line 56 of file GasMeter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void dev::eth::jit::GasMeter::count ( llvm::Value *  _cost,
llvm::Value *  _jmpBuf = nullptr,
llvm::Value *  _gasPtr = nullptr 
)

Count additional cost.

Definition at line 67 of file GasMeter.cpp.

Here is the call graph for this function:

void dev::eth::jit::GasMeter::countCopy ( llvm::Value *  _copyWords)

Count addional gas cost for memory copy.

Definition at line 160 of file GasMeter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void dev::eth::jit::GasMeter::countExp ( llvm::Value *  _exponent)

Calculate & count additional gas cost for EXP instruction.

Definition at line 81 of file GasMeter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void dev::eth::jit::GasMeter::countLogData ( llvm::Value *  _dataLength)

Count gas cost of LOG data.

Definition at line 108 of file GasMeter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void dev::eth::jit::GasMeter::countMemory ( llvm::Value *  _additionalMemoryInWords,
llvm::Value *  _jmpBuf,
llvm::Value *  _gasPtr 
)

Generate code that checks the cost of additional memory used by program.

Definition at line 154 of file GasMeter.cpp.

Here is the call graph for this function:

void dev::eth::jit::GasMeter::countSha3Data ( llvm::Value *  _dataLength)

Count gas cost of SHA3 data.

Definition at line 116 of file GasMeter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void dev::eth::jit::GasMeter::countSStore ( class Ext _ext,
llvm::Value *  _index,
llvm::Value *  _newValue 
)

Calculate & count gas cost for SSTORE instruction.

Definition at line 97 of file GasMeter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t dev::eth::jit::GasMeter::getStepCost ( Instruction  inst) const
private

Definition at line 166 of file GasMeter.cpp.

Here is the caller graph for this function:

void dev::eth::jit::GasMeter::giveBack ( llvm::Value *  _gas)

Give back an amount of gas not used by a call.

Definition at line 129 of file GasMeter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int64_t dev::eth::jit::GasMeter::m_blockCost = 0
private

Cumulative gas cost of a block of instructions Handle overflow.

Definition at line 56 of file GasMeter.h.

llvm::CallInst* dev::eth::jit::GasMeter::m_checkCall = nullptr
private

Definition at line 58 of file GasMeter.h.

llvm::Function* dev::eth::jit::GasMeter::m_gasCheckFunc = nullptr
private

Definition at line 59 of file GasMeter.h.

evm_mode dev::eth::jit::GasMeter::m_mode
private

EVM compatibility mode.

Definition at line 64 of file GasMeter.h.

RuntimeManager& dev::eth::jit::GasMeter::m_runtimeManager
private

Definition at line 61 of file GasMeter.h.


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