本文整理汇总了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())
示例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