Hi Alex, Alexander Nasonov <al...@yandex.ru> wrote: > Mindaugas Rasiukevicius wrote: > > > Log Message: > > > Add BPF JIT compiler, currently supporting amd64 and i386. Code > > > obtained from FreeBSD. Also, make few BPF fixes and simplifications > > > while here. Note that bpf_jit_enable is false for now. > > I wonder why do you want to generate code yourself while you could use > some jit library? I've almost finished my bpfjit library, I just need > one or two weekends to clean up all mess I made in my local tree while > trying to figure out the best way to integrate my changes into the tree. > Unfortunately, my day job keeps me busy.
The code from FreeBSD is pretty small and simple. It is also mature and more widely tested. If we decide to have a generic JIT compiler, like sljit, I think BPF can just be converted to use that. However, sljit is larger and the library is not straightforward to use for in-kernel compilation. Do we need a generic JIT compiler, though? > > FYI: > > > > FreeBSD has quite comprehensive regression tests for BPF. With some > > changes they run on NetBSD. > > I have tests too. See https://github.com/alnsn/bpfjit > > Alex -- Mindaugas