def generate_code(self):
        indent = lambda t, i: ('\n' + '  ' * i).join(t.split('\n'))
        code_dict = {}

        code_dict['wrapper_name'] = 'wrap_executor'
        code_dict['executor_arg'] = "%s %s" % (slope.Executor.meta['ctype_exec'],
                                               slope.Executor.meta['name_param_exec'])

        # Construct the wrapper
        _wrapper_args = ', '.join([arg.c_wrapper_arg() for arg in self._args])
        _wrapper_decs = ';\n'.join([arg.c_wrapper_dec() for arg in self._args])
        if len(Const._defs) > 0:
            _const_args = ', '
            _const_args += ', '.join([c_const_arg(c) for c in Const._definitions()])
        else:
            _const_args = ''
        _const_inits = ';\n'.join([c_const_init(c) for c in Const._definitions()])

        code_dict['wrapper_args'] = _wrapper_args
        code_dict['const_args'] = _const_args
        code_dict['wrapper_decs'] = indent(_wrapper_decs, 1)
        code_dict['const_inits'] = indent(_const_inits, 1)

        # Construct kernels invocation
        _loop_chain_body, _user_code, _ssinds_arg = [], [], []
        for i, loop in enumerate(zip(self._kernel, self._itspace, self._all_args)):
            kernel, it_space, args = loop

            # Obtain code_dicts of individual kernels, since these have pieces of
            # code that can be straightforwardly reused for this code generation
            loop_code_dict = host.JITModule(kernel, it_space, *args).generate_code()

            # Need to bind executor arguments to this kernel's arguments
            # Using a dict because need comparison on identity, not equality
            args_dict = dict(zip([_a.data for _a in self._args], self._args))
            binding = OrderedDict(zip(args, [args_dict[a.data] for a in args]))
            if len(binding) != len(args):
                raise RuntimeError("Tiling code gen failed due to args mismatching")
            binding = ';\n'.join([a0.c_arg_bindto(a1) for a0, a1 in binding.items()])

            loop_code_dict['args_binding'] = binding
            loop_code_dict['tile_iter'] = self._executor.gtl_maps[i]['DIRECT']
            loop_code_dict['tile_init'] = self._executor.c_loop_init[i]
            loop_code_dict['tile_start'] = slope.Executor.meta['tile_start']
            loop_code_dict['tile_end'] = slope.Executor.meta['tile_end']

            _loop_chain_body.append(strip(JITModule._kernel_wrapper % loop_code_dict))
            _user_code.append(kernel._user_code)
            _ssinds_arg.append(loop_code_dict['ssinds_arg'])
        _loop_chain_body = "\n\n".join(_loop_chain_body)
        _user_code = "\n".join(_user_code)
        _ssinds_arg = ", ".join([s for s in _ssinds_arg if s])

        code_dict['user_code'] = indent(_user_code, 1)
        code_dict['ssinds_arg'] = _ssinds_arg
        executor_code = indent(self._executor.c_code(indent(_loop_chain_body, 2)), 1)
        code_dict['executor_code'] = executor_code

        return code_dict
dataset/ETHPy150Open OP2/PyOP2/pyop2/fusion.py/JITModule.generate_code/original