refactor COMPILE-KERNEL-FUNCTION