Fabcoin Core
0.16.2
P2P Digital Currency
|
#include <GasMeter.h>
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 |
RuntimeManager & | m_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 | |
CompilerHelper & | operator= (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 | |
IRBuilder & | m_builder |
Reference to parent compiler IR builder. More... | |
Definition at line 16 of file GasMeter.h.
dev::eth::jit::GasMeter::GasMeter | ( | IRBuilder & | _builder, |
RuntimeManager & | _runtimeManager, | ||
evm_mode | mode | ||
) |
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.
void dev::eth::jit::GasMeter::count | ( | Instruction | _inst | ) |
Count step cost of instruction.
Definition at line 56 of file GasMeter.cpp.
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.
void dev::eth::jit::GasMeter::countCopy | ( | llvm::Value * | _copyWords | ) |
Count addional gas cost for memory copy.
Definition at line 160 of file GasMeter.cpp.
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.
void dev::eth::jit::GasMeter::countLogData | ( | llvm::Value * | _dataLength | ) |
Count gas cost of LOG data.
Definition at line 108 of file GasMeter.cpp.
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.
void dev::eth::jit::GasMeter::countSha3Data | ( | llvm::Value * | _dataLength | ) |
Count gas cost of SHA3 data.
Definition at line 116 of file GasMeter.cpp.
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.
|
private |
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.
|
private |
Cumulative gas cost of a block of instructions Handle overflow.
Definition at line 56 of file GasMeter.h.
|
private |
Definition at line 58 of file GasMeter.h.
|
private |
Definition at line 59 of file GasMeter.h.
|
private |
EVM compatibility mode.
Definition at line 64 of file GasMeter.h.
|
private |
Definition at line 61 of file GasMeter.h.