mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-13 03:51:01 +00:00
94ec34c4d5
Separate between compilation and linker phases to allow deploy time linking and back-porting era compiler changes to fix #91. Unlinked contract binaries (caused by missing libraries or missing factory dependencies in turn) are emitted as raw ELF object. Few drive by fixes: - #98 - A compiler panic on missing libraries definitions. - Fixes some incosistent type forwarding in JSON output (empty string vs. null object). - Remove the unused fallback for size optimization setting. - Remove the broken `--lvm-ir` mode. - CI workflow fixes. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com> Signed-off-by: xermicus <bigcyrill@hotmail.com> Signed-off-by: xermicus <cyrill@parity.io>
55 lines
1.9 KiB
Plaintext
55 lines
1.9 KiB
Plaintext
object "Test" {
|
|
code {
|
|
{
|
|
mstore(64, 128)
|
|
if callvalue() { revert(0, 0) }
|
|
let _1 := datasize("Test_deployed")
|
|
codecopy(0, dataoffset("Test_deployed"), _1)
|
|
return(0, _1)
|
|
}
|
|
}
|
|
object "Test_deployed" {
|
|
code {
|
|
{
|
|
mstore(64, 128)
|
|
if iszero(lt(calldatasize(), 4))
|
|
{
|
|
let _1 := 0
|
|
switch shr(224, calldataload(_1))
|
|
case 0x3df4ddf4 {
|
|
if callvalue() { revert(_1, _1) }
|
|
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
|
|
let memPos := allocate_memory(_1)
|
|
mstore(memPos, 0x2a)
|
|
return(memPos, 32)
|
|
}
|
|
case 0x5a8ac02d {
|
|
if callvalue() { revert(_1, _1) }
|
|
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
|
|
let memPos_1 := allocate_memory(_1)
|
|
return(memPos_1, sub(abi_encode_uint256(memPos_1, 0x63), memPos_1))
|
|
}
|
|
}
|
|
revert(0, 0)
|
|
}
|
|
function abi_encode_uint256(headStart, value0) -> tail
|
|
{
|
|
tail := add(headStart, 32)
|
|
mstore(headStart, value0)
|
|
}
|
|
function allocate_memory(size) -> memPtr
|
|
{
|
|
memPtr := mload(64)
|
|
let newFreePtr := add(memPtr, and(add(size, 31), not(31)))
|
|
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr))
|
|
{
|
|
mstore(0, shl(224, 0x4e487b71))
|
|
mstore(4, 0x41)
|
|
revert(0, 0x24)
|
|
}
|
|
mstore(64, newFreePtr)
|
|
}
|
|
}
|
|
}
|
|
}
|