Mindaugas Rasiukevicius wrote: > Hi Alex, > The code from FreeBSD is pretty small and simple. It is also mature and > more widely tested.
I agree with the above. But their code is only for quite powerful x86 cpus. If you want to support arm or mips, someone has to make two new implementations. > 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. sljit.kmod is 34K on amd64. Sljit is quite easy to use. In my opinion, it's easier than generating machine code directly. And it's definitely easier to write one sljit-based implementation than i386, amd64, arm, mips and ppc implementations. Maintainance is easier too. Sljit lacks a proper documentation, though. I'm going to discuss it with Zoltan. > Do we need a generic JIT compiler, though? I don't see many uses of code generator in the kernel. BPF is one case. There is more potential in the base e.g. regular expressions, or even interpreted languages (I don't think anyone would dare to touch awk, though ;). BTW, I started working on a code generation in my clone of cdbr. I don't expect a big performance difference, just some moderate increase in performance. Alex