Marmot, an Alternative Go Compiler
Hacker News 热议:Marmot, an Alternative Go Compiler(68 赞 / 18 评论,来源 marmot.gaurav.zip)
一句话概要
Keep your Go code, switch the compiler, and get small native executables. Fast builds and errors that teach.
原文开头节选
marmot is a Go compiler built on MLIR and LLVM. Keep your Go code and your go.mod, switch the compiler, and get small, fast native binaries and errors that show you the fix.
Experimental: marmot compiles real Go programs, including itself, and checks every test program against Go, but it is not ready for production.
var s int32 for _, x := range xs { s += x } return s MLIR, with the go dialect Still Go: an index into a slice, with its bounds check.
%v9 = llvm.extractvalue %a0[0] : !llvm.struct<(ptr, i64, i64)> %v10 = llvm.extractvalue %a0[1] : !llvm.struct<(ptr, i64, i64)> %v11 = go.index %v9[%v7] len %v10, i32 : i64 %v12 = llvm.load %v11 {alignment = 4 : i64, go.unsafe} : !llvm.ptr -> i32 %v13 = llvm.add %v1, %v12 : i32 LLVM IR The check is gone; four int32 values at a time.
(以上为原文节选,完整内容见下方”原文来源”)
这条动态今日登上 Hacker News 首页(68 赞 / 18 评论,来源 marmot.gaurav.zip)。技术雷达每日自动聚合 AI 工程、后端架构、DevOps 方向的前沿动态;相关工程落地可浏览下方的相关服务与延伸阅读,或直接与我们团队交流。
原文来源: Hacker News