Browse Source

Change a bit the implementation of GAS instruction

[Delivers #79942174]
cl-refactor
Paweł Bylica 10 years ago
parent
commit
00e5afc1a5
  1. 3
      evmcc/Compiler.cpp
  2. 4
      evmcc/GasMeter.cpp
  3. 2
      evmcc/GasMeter.h

3
evmcc/Compiler.cpp

@ -690,8 +690,7 @@ std::unique_ptr<llvm::Module> Compiler::compile(const dev::bytes& bytecode)
case Instruction::GAS:
{
auto value = builder.CreateLoad(gasMeter.getLLVMGasVar());
stack.push(value);
stack.push(gasMeter.getGas());
break;
}

4
evmcc/GasMeter.cpp

@ -167,9 +167,9 @@ void GasMeter::checkMemory(llvm::Value* _additionalMemoryInWords, llvm::IRBuilde
_builder.CreateCall(m_gasCheckFunc, cost);
}
llvm::GlobalVariable* GasMeter::getLLVMGasVar()
llvm::Value* GasMeter::getGas()
{
return m_gas;
m_builder.CreateLoad(m_gas, "gas");
}
}

2
evmcc/GasMeter.h

@ -32,7 +32,7 @@ public:
/// Generate code that checks the cost of additional memory used by program
void checkMemory(llvm::Value* _additionalMemoryInWords, llvm::IRBuilder<>& _builder);
llvm::GlobalVariable* getLLVMGasVar();
llvm::Value* getGas();
private:
/// Cumulative gas cost of a block of instructions

Loading…
Cancel
Save