public static function patch($classes = [], $options = [])
    {
        $loaders = spl_autoload_functions();
        $loader = reset($loaders);

        $interceptor = null;

        if (method_exists($loader[0], 'patchers')) {
            $interceptor = $loader[0];
            // When using an already existing interceptor, make sure the added patcher
            // won't need to autoload anything to prevent infinite loop.
            class_exists('Lead\Jit\JitException');
            class_exists('Lead\Jit\Node\NodeDef');
            class_exists('Lead\Jit\Node\FunctionDef');
            class_exists('Lead\Jit\Node\BlockDef');
            class_exists('Lead\Jit\TokenStream');
            class_exists('Lead\Jit\Parser');
        } elseif (isset($options['loader'])) {
            $interceptor = Interceptor::patch($options);
            static::$_unpatch = true;
        } else {
            foreach ($loaders as $loader) {
                if ($loader[0] instanceof ClassLoader) {
                    $options['loader'] = [$loader[0], 'loadClass'];
                    $interceptor = Interceptor::patch($options);
                    static::$_unpatch = true;
                    break;
                }
            }
        }
        if (!$interceptor) {
            throw new Exception("Unable to find a valid autoloader to apply the JIT filter patcher.");
        }
        $filter = new Filter(['patch' => $classes]);
        $patchers = $interceptor->patchers();
        $patchers->add('filter', $filter);
        return static::$_interceptor = $interceptor;
    }