2 ms·
Eric Dumazet, one of the many kernel hackers, wrote a JIT compiler that compiles BPFs directly to x86 code _in the kernel_. Much to learn from his code: http:/
by xtacy 12y ago
Eric Dumazet, one of the many kernel hackers, wrote a JIT compiler that compiles BPFs directly to x86 code _in the kernel_. Much to learn from his code: http://lwn.net/Articles/437884/ http://lwn.net/Articles/437884/
As tptacek notes, the VM is very simple -- it's straightforward to write a BPF VM to C-code translator that you can then compile by gcc. But it will still be slower than edumazet's compiled code.
- haberman 12y agoIn my article about DynASM I mention the BPF JIT and suggest that it could use DynASM (it would make the JIT more readable at basically no cost): http://blog.reverberate.org/2012/12/hello-jit-world-joy-of-simple-jits.html http://blog.reverberate.org/2012/12/hello-jit-world-joy-of-s...
- sbahra 12y agoFreeBSD has had limited support for this for a long time now (limitations may be lifted now, not sure). http://freebsd.1045724.n5.nabble.com/PATCH-BPF-Just-In-Time-compiler-td4005784.html http://freebsd.1045724.n5.nabble.com/PATCH-BPF-Just-In-Time-...