在将其编译为EVM字节码的过程中,坚固性会降低到LLL吗?

Does Solidity gets reduced to LLL in the process of compiling it to EVM bytecode?

本文关键字:坚固性 LLL 过程中 编译 EVM 字节      更新时间:2023-10-16

查看固体编译器GitHub存储库,我看到该项目还集成了LLL编译器。

这让我想知道在编译为EVM字节码的过程中是否降低了固体性?

我已经读到LLL是EVM ASM的包装纸,因此,直观地将牢固性编译到LLL是有意义的吗?

或LLL编译器只是作为坚固项目的一部分,因为它太小而无法用作项目?

实际上我也有同样的问题,但是我认为答案是肯定的!以坚固性,您可以使用汇编段

assembly {
    // LLL OR OPCODES HERE
}

lll 中,您可以在哪里编写代码,相同的语法和相当便宜的 gas> gas 成本,在我的经验上至少30%。

pragma solidity ^0.4.24;
/*
    Autor: Javier Guajardo J.
    Website: https://ethereumchile.cl
    Twitter: @EthereumChile
*/
contract Assembly {
    function returnSum1(uint a, uint b) public pure returns (uint sum) {
        // We ADD a and b in a new variable called doSum
        assembly {
            let doSum := add(a, b)
            sum := doSum
        }
    }
    function returnSum2(uint a, uint b) public pure returns (uint sum) {
        // OR you can ADD a and b directly
        assembly {
            sum := add(a, b)
        }
    }
    function returnSum3(uint a, uint b) public pure returns (uint) {
        // OR you can ADD a and b into 0x40 memory address 
        assembly {
            let sum := mload(0x40) // loading 0x40 address memory
            mstore(sum, add(a, b)) // We store the add(a, b) in 0x40 address memory
            return(sum, 32) // We return result.
        }
    }
}

导致混音IDE

ScreenCapture.png组装固体,Javier Guajardo

与上一个答案相反,实际正确答案是否。坚固性编译器将坚固的代码直接汇编为EVM。有一种固体性的中间语言称为朱莉娅(Julia),这实际上是assembly{}块所接受的,但尚未开发到从坚固性代码生成朱莉娅代码的点。LLL编译器主要出于历史原因包括在固体存储库中。