eBPF from Go - III - Reducing the SSA
Again some progress. I’m mostly focussing on removing code from the SSA representation
(-internal-dumpssa
), so that I can work with a clean slate. As BPF is so limited almost none of
the features from Go make sense, although in some far fetched future it would be super cool to have
channels and goroutines to something in BPF - but not today. First need to get to “Hello World”.
I’m building this code:
package main
func main() {
add(5, 5)
}
func add(x int, y int) int {
return x + y
}
With this tinygo command line:
./build/tinygo build -serial=none -internal-dumpssa -internal-nodwarf \
-no-debug -panic=trap -scheduler=none -gc=leaking -o miekg/main.bpf ./miekg/main.go
Before -serial=none
I got 20K lines of (SSA) output, with it, 122…
The remaining useless bits if the call to initialize the reflect package:
call: reflect.init
runtime.alloc: 16 -> <38>
gep: [<38> 0 16 0 -1] -> <38>
icmp: <38> eq 0 -> false
br [0 12 1] -> 1
...
Read other posts