Remove KernelCached base class

Convert AST to C code in the Kernel constructor, which has the side
benefit of saving the cost of AST preprocessing every time before
computing the cache key.