[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
If any language takes over the world, I'm happy it's BPF that's doing so.
- Subject: If any language takes over the world, I'm happy it's BPF that's doing so.
- From: zen at freedbms.net (Zenaan Harkness)
- Date: Sun, 2 Dec 2018 12:12:28 +1100
Teh Linux kernel's BPF is soon to take over the world - Linus once
half joked that the goal of Linux is nothing short of world
domination, but it's taken ~30 years to get here with BPF rapidaly
rising the totem pole:
Comment:
https://lwn.net/Articles/773497/
LLVM bitcode, in addition to the lack of portability between LLVM
releases etc, is a hell of a lot further from the machine than
(e)BPF is. BPF is really quite remarkably easy to JIT down to
x86_64 and most other modern machine languages, and the interpreter
core is pretty small and easy to read as well, as such things go:
most opcodes translate directly into a little bit of obvious C
acting directly on the variables that hold the register contents.
(Far more work goes into the verifier, which of course is necessary
even, perhaps especially, if you're JITting).
One sign that BPF is nicely designed: as someone who's been
hand-writing BPF recently (rewriting a code generator that used to
generate output for a much more, ah, *verbose* intermediate
representation with many more opcodes), whenever I found I needed a
particular opcode, it was there, and nothing I didn't need was
there except the weird historical stuff to do packet content
inspection.
I like BPF. I thought I'd hate it, because all such things are
generally hateful, but it's not hateful at all: it has no horrible
irregularities that make you scream and most of the annoying limits
as a general-purpose-but-verified language (stack size, etc, lack
of even constrained loops, etc) are being raised or fixed as we
speak. If any language takes over its world like BPF is doing, I'm
happy it's BPF that's doing so.
Article (I think such LWN articles are paywalled for 7 days only - I
wouldn't be a subscriber otherwise...):
Binary portability for BPF programs
https://lwn.net/Articles/773198/