Rustle: the first static analyzer for smart contracts in Rustcontracts in Rust Background LLVM IR Design C; C++ Rust Go Front-end Clang Rustc Gollvm LLVM IR Back-end x86 ARM BPF WASM LLVM Pass: rich APIs to analysis the LLVM IR Background Near Blockchains can analyze the logic on the LLVM IR Rich experience in auditing smart contracts in Rust Background Design Workflow Design Compile Smart Contracts LLVM IR LLVM Pass Extracted Patterns Pattern 0 = sub i128 %6, %amount, !dbg !4688 %_25.1 = icmp ult i128 %6, %amount, !dbg !4688 %7 = call i1 @llvm.expect.i1(i1 %_25.1, i1 false), !dbg !4688 br i1 %7, label %panic, label %bb12, !dbg !4688 bb13:0 码力 | 28 页 | 4.49 MB | 1 年前3
秘猿先锋-文愿-Axon 应用链框架的 Rust 开发实践• LLVM IR • … 如何优雅地在代码中加入埋点 ■ Prometheus API 1. 在 Rust 代码编译成 LLVM IR 之前解析 AST,找到需要埋点的函数 2. 为这些函数生成对应的监控指标定义代码 3. 在进入和退出这些函数的 IR 指令前插入对指标的操作 (inc 等) 4. 重新打包成 Rust 代码并编译,得到增加埋点的可执行文件 ■ LLVM IR 插入监控埋点0 码力 | 32 页 | 3.63 MB | 1 年前3
KCL: Rust 在编译器领域的实践与探索Package Manager 02 用 Rust 重写 KCL Python 代码翻译 栈式虚拟机 Rust 编译器 KCL 编译器架构升级 Source Code AST LLVM IR Native/WASM Source Code AST Bit code VM Source Code Python code Pros Cons 简单易上手 生态丰富 研发效率高 Rust? > https://github.com/Peefy/StackMachine CPython RustPython GPython VM(go) VM(Rust) VM(Python) LLVM Native Code 简单Case a = 1 0.05s 0.125s 0.012s 0.01s 0.008s 0.6s 0.001s for b = [i for i in rang(20000)] RustCodeBook: Rust源码解读 Compiler Base: 更通用的编译器组件 KCL Source Code AST LLVM IR Native/WASM Smart Contract Source Code AST LLVM IR ABI • Error • Span & SourceMap • Session • Paraller • …… IDE 友好的编译器架构0 码力 | 25 页 | 3.50 MB | 1 年前3
Comprehensive Rust(Português do Brasil) 202412adicionar dependências para seu projeto editando Cargo.toml. Quando você execute os comandos cargo, ele irá baixar e compilar automaticamente dependências para você. Tente encorajar os participantes do curso 2015: • Rust é uma linguagem compilada estaticamente e tem um papel semelhante ao C++ – rustc usa o LLVM como seu backend. • Rust suporta muitas plataformas e arquiteturas: – x86, ARM, WebAssembly, .. qualquer caractere Unicode. Este slide tenta deixar os alunos familiarizados com o código em Rust. Eles irão ver bastante conteúdo nos próximos quatro dias, então começamos devagar com algo familiar. Pontos0 码力 | 389 页 | 1.05 MB | 10 月前3
Comprehensive Rust(Español) 202412lanzó su versión 1.0 en el 2015: • Rust es un lenguaje compilado estático similar a C++ – rustc usa LLVM como backend. • Rust es compatible con muchas plataformas y arquitecturas: – x86, ARM, WebAssembly Event { todo!() } fn main() { println!( "Un pasajero de la planta baja ha pulsado el botón para ir hacia arriba: {:?}", lobby_call_button_pressed(0, Direction::Up) ); println!("El ascensor ha llegado or(floor)) } fn main() { 61 println!( "Un pasajero de la planta baja ha pulsado el botón para ir hacia arriba: {:?}", lobby_call_button_pressed(0, Direction::Up) ); println!("El ascensor ha llegado0 码力 | 389 页 | 1.04 MB | 10 月前3
2021-11-22 - Rust CTCFT - Rust for Linuxeven on unoptimised builds. Language Architecture & GCC support We are constrained by LLVM arch support + LLVM support in Linux itself. Currently we have arm, arm64, powerpc, riscv, riscv64, x86. GCC kernel ↔ compiler cyclic dependency. Custom targets are not stable. Unlikely to be (too tied to LLVM). Not all target options seem to be available/exposed. e.g. -mregparm for x86. Tooling Target same names. Moonshot: cross-language, cross-toolchain standard way. Point already raised to a few LLVM & kernel folks to test the waters. Idea: bring all stakeholders to the linux-toolchains ML. Tooling0 码力 | 53 页 | 332.50 KB | 9 月前3
Building Linux Distribution(Linux 分布式)- 贾晓宇rust-src(cross-compile core and alloc),rust-bindgen • llvm(clang) make LLVM=1 rustavailable make CC=clang rustavailable •Compile kernel • make LLVM=1(CC=clang) rustavailable • enbale Rust support in0 码力 | 19 页 | 723.62 KB | 1 年前3
Rust语言核心竞争力-庄晓立{ i8*, void (i8*)** }* %r, i32 0, i32 1 store void (i8*)** %1, void (i8*)*** %3 call void @llvm.dbg.declare(metadata { i8*, void (i8*)** }* %r, metadata !40, metadata !34), !dbg !41 %4 = getelementptr void @_ZN4doit20h5077d4eddc5f4032eaaE(i8* nonnull) unnamed_addr #0 { entry-block: call void @llvm.memset.p0i8.i64(i8* nonnull %0, i8 66, i64 32, i32 1, i1 false) ret void } http://is.gd/oJ2XcT entry-block: %1 = getelementptr inbounds %MyData, %MyData* %0, i64 0, i32 0, i64 0 call void @llvm.memset.p0i8.i64(i8* %1, i8 66, i64 32, i32 1, i1 false) ret void } #[inline(never)] fn doit(v:0 码力 | 51 页 | 1.09 MB | 1 年前3
Comprehensive Rust(Ukrainian) 202412• Rust — це статично скомпільована мова, яка виконує таку саму роль, як C++ – rustc використовує LLVM як бекенд. • Rust підтримує багато платформ і архітектур: – x86, ARM, WebAssembly, ... – Linux, них явну чи неявну довіру: • rustc (компілятор Rust), який, у свою чергу, залежить від бібліотек LLVM, компілятор Clang, вихідні коди rustc (отримані з GitHub, переглянуті командою компілятора Rust), скриптах збірки. Ці дії не підтримуються у контексті Chromium --- наша система збірки gn, ninja та LLVM дуже специфічна у вираженні взаємозв'язків між діями збірки. Отже, у вас є наступні варіанти: •0 码力 | 396 页 | 1.08 MB | 10 月前3
Comprehensive Rust(Persian ) 202412� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � C + + � � � � – rustc � � LLVM � � � � � � � � � � � � � � � � � � � � � � � � � � � . • � � � � � � � � � � � � � � � � � � � � � � � � � � � : • rustc ) � � � � � � � � Rust ( � � � � � � � � � � � � � � � � � � � � � � � � LLVM � � � � � � � � � Clang � � � � � � rustc ) � � � � � � � � � GitHub � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � Chromium � � � � � � � � � � � --- � � � � � � � � � gn� ninja � LLVM � � � � � � � � � � � � � � � � build actions � � � � � � � � � � � � � . � � � � � � � � � � � �0 码力 | 393 页 | 987.97 KB | 10 月前3
共 26 条
- 1
- 2
- 3













