Browse Source

Test dynamic jumps.

cl-refactor
Paweł Bylica 9 years ago
parent
commit
3ffdcd9f13
  1. 2
      evmjit/libevmjit/Compiler.cpp
  2. 99
      test/libevm/VMTestsFiller/vmIOandFlowOperationsTestFiller.json

2
evmjit/libevmjit/Compiler.cpp

@ -103,7 +103,7 @@ llvm::BasicBlock* Compiler::getJumpTableBlock()
m_builder.SetInsertPoint(m_jumpTableBlock->llvm());
auto dest = m_builder.CreatePHI(Type::Word, 8, "target");
auto switchInstr = m_builder.CreateSwitch(dest, m_abortBB);
for (auto&& p : m_basicBlocks) // FIXME: It mast be done at the end
for (auto&& p : m_basicBlocks)
{
if (p.second.isJumpDest())
switchInstr->addCase(Constant::get(p.first), p.second.llvm());

99
test/libevm/VMTestsFiller/vmIOandFlowOperationsTestFiller.json

@ -140,7 +140,7 @@
"0x01" : "0x17"
}
}
},
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "100000000000000000000000",
@ -2211,6 +2211,99 @@
}
},
"DynamicJump_value1": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "100000000000000000000000",
"nonce" : "0",
"code" : "(asm 1 2 3 CALLVALUE JUMP
JUMPDEST POP POP 0 MSTORE MSIZE 0 RETURN
JUMPDEST POP 0 MSTORE MSIZE 0 RETURN
JUMPDEST 0 MSTORE MSIZE 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "8",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "100000"
}
},
"DynamicJump_value2": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "100000000000000000000000",
"nonce" : "0",
"code" : "(asm 1 2 3 CALLVALUE JUMP
JUMPDEST POP POP 0 MSTORE MSIZE 0 RETURN
JUMPDEST POP 0 MSTORE MSIZE 0 RETURN
JUMPDEST 0 MSTORE MSIZE 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "18",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "100000"
}
},
"DynamicJump_value3": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "100000000000000000000000",
"nonce" : "0",
"code" : "(asm 1 2 3 CALLVALUE JUMP
JUMPDEST POP POP 0 MSTORE MSIZE 0 RETURN
JUMPDEST POP 0 MSTORE MSIZE 0 RETURN
JUMPDEST 0 MSTORE MSIZE 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "27",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "100000"
}
},
"BlockNumberDynamicJumpiAfterStop": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
@ -2226,7 +2319,7 @@
"0x03" : "0x02"
}
}
},
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "100000000000000000000000",
@ -3939,7 +4032,7 @@
"gas" : "100000"
}
},
"jumpi_at_the_end" : {
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",

Loading…
Cancel
Save