Outline VM log

This commit is contained in:
nicksavers 2014-08-03 22:43:18 +02:00
parent adc2313308
commit ac8d2a96f9
2 changed files with 16 additions and 16 deletions

View File

@ -306,7 +306,7 @@ public class Program {
this.refundGas(refundGas, "remain gas from the internal call");
if (logger.isInfoEnabled()){
logger.info("The remain gas refunded, account: [ {} ], gas: [ {} ] ",
logger.info("The remaining gas is refunded, account: [ {} ], gas: [ {} ] ",
Hex.toHexString(this.getOwnerAddress().getLast20Bytes()),
refundGas);
}
@ -317,7 +317,7 @@ public class Program {
* That method implement internal calls
* and code invocations
*
* @param gas - gas to pay for the call, remain gas will be refunded to the caller
* @param gas - gas to pay for the call, remaining gas will be refunded to the caller
* @param toAddressDW - address to call
* @param endowmentValue - the value that can be transfer along with the code execution
* @param inDataOffs - start of memory to be input data to the call
@ -431,13 +431,13 @@ public class Program {
BigInteger refundGas = gas.value().subtract(BigInteger.valueOf(result.getGasUsed()));
if (refundGas.compareTo(BigInteger.ZERO) == 1) {
this.refundGas(refundGas.intValue(), "remain gas from the internal call");
logger.info("The remain gas refunded, account: [ {} ], gas: [ {} ] ",
refundGas.toString(), refundGas.toString());
this.refundGas(refundGas.intValue(), "remaining gas from the internal call");
logger.info("The remaining gas refunded, account: [ {} ], gas: [ {} ] ",
Hex.toHexString(senderAddress), refundGas.toString());
}
} else {
this.refundGas(gas.intValue(), "remain gas from the internal call");
this.refundGas(gas.intValue(), "remaining gas from the internal call");
}
}

View File

@ -55,6 +55,7 @@ public class VM {
private Logger logger = LoggerFactory.getLogger("VM");
private static BigInteger _32_ = BigInteger.valueOf(32);
private static String logString = "[ {} ]\t Op: [ {} ]\t Gas: [ {} ]\t Deep: [ {} ] Hint: [ {} ]";
public void step(Program program) {
@ -699,10 +700,10 @@ public class VM {
DataWord inSize = program.stackPop();
if (logger.isInfoEnabled())
logger.info("[ {} ] Op: [ {} ] Gas: [ {} ] Deep: [ {} ] Hint: [ {} ]",
program.getPC(), OpCode.code(op).name(), program
.getGas().longValue(), program.invokeData
.getCallDeep(), hint);
logger.info(logString, program.getPC(), OpCode.code(op)
.name(), program.getGas().longValue(),
program.invokeData.getCallDeep(), hint);
program.createContract(value, inOffset, inSize);
program.step();
@ -719,9 +720,9 @@ public class VM {
DataWord outDataSize = program.stackPop();
if (logger.isInfoEnabled())
logger.info("[ {} ] Op: [ {} ] Gas: [ {} ] Deep: [ {} ] Hint: [ {} ]" ,program.getPC(),
OpCode.code(op).name(), program.getGas().longValue(),
program.invokeData.getCallDeep(), hint);
logger.info(logString, program.getPC(), OpCode.code(op)
.name(), program.getGas().longValue(),
program.invokeData.getCallDeep(), hint);
program.callToAddress(gas, toAddress, value, inDataOffs, inDataSize, outDataOffs, outDataSize);
@ -751,9 +752,8 @@ public class VM {
if (logger.isInfoEnabled())
if (!OpCode.code(op).equals(CALL) && !OpCode.code(op).equals(CREATE))
logger.info("[ {} ] Op: [ {} ] Gas: [ {} ] Deep: [ {} ] Hint: [ {} ]",
stepBefore, OpCode.code(op).name(), gasBefore, program.invokeData
.getCallDeep(), hint);
logger.info(logString, stepBefore, OpCode.code(op).name(),
gasBefore, program.invokeData.getCallDeep(), hint);
// memory gas calc
int newMemSize = program.getMemSize();