在将其编译为EVM字节码的过程中,坚固性会降低到LLL吗?
Does Solidity gets reduced to LLL in the process of compiling it to EVM bytecode?
查看固体编译器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编译器主要出于历史原因包括在固体存储库中。
相关文章:
- 多态性和功能结合
- 找不到成员对象:没有名为get_event()的成员,也处理多态性和向量
- 为什么与常规GCC不同,即使有"学究性错误",MinGW-GCC也能容忍丢失的返回类型
- 使用取消引用的指针的多态性会产生意外的结果.为什么?
- 松弛原子与无同步情况下的记忆连贯性
- C++Union/Struct位域的实现和可移植性
- C++boost序列化多态性问题
- 如何更改唯一指针向量的可见性
- 获取 SFML 窗口的 HWND 和高可用性?
- 当指向对象的指针作为参数传递给 std::thread 时,内存可见性
- 为什么 std::reduce 需要交换性?
- 如何查找哪个类对象位于数组的特定索引上(多态性)
- 如何在多线程中正确使用unique_ptr进行多态性?
- C++ 优先性和关联性
- 如何实现自定义匹配器以检查 Catch2 中的对象相等性
- OpenMP for 循环并行性问题
- 混叠和指针互转换性
- 具有智能指针的多态性
- 从以太坊坚固性合约运行C++脚本
- 在将其编译为EVM字节码的过程中,坚固性会降低到LLL吗?