当前位置: 首页>>代码示例>>Python>>正文


Python CStandaloneBuilder.stackless方法代码示例

本文整理汇总了Python中pypy.translator.c.genc.CStandaloneBuilder.stackless方法的典型用法代码示例。如果您正苦于以下问题:Python CStandaloneBuilder.stackless方法的具体用法?Python CStandaloneBuilder.stackless怎么用?Python CStandaloneBuilder.stackless使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.translator.c.genc.CStandaloneBuilder的用法示例。


在下文中一共展示了CStandaloneBuilder.stackless方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wrap_stackless_function

# 需要导入模块: from pypy.translator.c.genc import CStandaloneBuilder [as 别名]
# 或者: from pypy.translator.c.genc.CStandaloneBuilder import stackless [as 别名]
    def wrap_stackless_function(self, fn):
        def entry_point(argv):
            os.write(1, str(fn())+"\n")
            return 0

        from pypy.config.pypyoption import get_pypy_config
        config = get_pypy_config(translating=True)
        config.translation.gc = self.gcpolicy
        config.translation.stackless = True
        if self.stacklessgc:
            config.translation.gcrootfinder = "stackless"
        t = TranslationContext(config=config)
        self.t = t
        t.buildannotator().build_types(entry_point, [s_list_of_strings])
        t.buildrtyper().specialize()
        if self.backendopt:
            backend_optimizations(t)

        from pypy.translator.transform import insert_ll_stackcheck
        insert_ll_stackcheck(t)

        cbuilder = CStandaloneBuilder(t, entry_point, config=config)
        cbuilder.stackless = True
        cbuilder.generate_source()
        cbuilder.compile()
        res = cbuilder.cmdexec('')
        return int(res.strip())
开发者ID:antoine1fr,项目名称:pygirl,代码行数:29,代码来源:test_stackless.py

示例2: task_database_c

# 需要导入模块: from pypy.translator.c.genc import CStandaloneBuilder [as 别名]
# 或者: from pypy.translator.c.genc.CStandaloneBuilder import stackless [as 别名]
    def task_database_c(self):
        translator = self.translator
        if translator.annotator is not None:
            translator.frozen = True

        if self.libdef is not None:
            cbuilder = self.libdef.getcbuilder(self.translator, self.config)
            self.standalone = False
            standalone = False
        else:
            standalone = self.standalone

            if standalone:
                from pypy.translator.c.genc import CStandaloneBuilder as CBuilder
            else:
                from pypy.translator.c.genc import CExtModuleBuilder as CBuilder
            cbuilder = CBuilder(self.translator, self.entry_point,
                                config=self.config)
            cbuilder.stackless = self.config.translation.stackless
        if not standalone:     # xxx more messy
            cbuilder.modulename = self.extmod_name
        database = cbuilder.build_database()
        self.log.info("database for generating C source was created")
        self.cbuilder = cbuilder
        self.database = database
开发者ID:,项目名称:,代码行数:27,代码来源:


注:本文中的pypy.translator.c.genc.CStandaloneBuilder.stackless方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。