some refactoring to make the JIT inlining easier