本文整理汇总了Python中pypy.translator.c.database.LowLevelDatabase.globalcontainers方法的典型用法代码示例。如果您正苦于以下问题:Python LowLevelDatabase.globalcontainers方法的具体用法?Python LowLevelDatabase.globalcontainers怎么用?Python LowLevelDatabase.globalcontainers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.translator.c.database.LowLevelDatabase
的用法示例。
在下文中一共展示了LowLevelDatabase.globalcontainers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_database
# 需要导入模块: from pypy.translator.c.database import LowLevelDatabase [as 别名]
# 或者: from pypy.translator.c.database.LowLevelDatabase import globalcontainers [as 别名]
def build_database(self, exports=[], pyobj_options=None):
translator = self.translator
gcpolicyclass = self.get_gcpolicyclass()
if self.config.translation.stackless:
if not self.standalone:
raise Exception("stackless: only for stand-alone builds")
from pypy.translator.stackless.transform import StacklessTransformer
stacklesstransformer = StacklessTransformer(
translator, self.originalentrypoint,
stackless_gc=gcpolicyclass.requires_stackless)
self.entrypoint = stacklesstransformer.slp_entry_point
else:
stacklesstransformer = None
db = LowLevelDatabase(translator, standalone=self.standalone,
gcpolicyclass=gcpolicyclass,
stacklesstransformer=stacklesstransformer,
thread_enabled=self.config.translation.thread)
# pass extra options into pyobjmaker
if pyobj_options:
for key, value in pyobj_options.items():
setattr(db.pyobjmaker, key, value)
# we need a concrete gcpolicy to do this
self.libraries += db.gcpolicy.gc_libraries()
# give the gc a chance to register interest in the start-up functions it
# need (we call this for its side-effects of db.get())
list(db.gcpolicy.gc_startup_code())
# build entrypoint and eventually other things to expose
pf = self.getentrypointptr()
pfname = db.get(pf)
self.exports[self.entrypoint.func_name] = pf
for obj in exports:
if type(obj) is tuple:
objname, obj = obj
elif hasattr(obj, '__name__'):
objname = obj.__name__
else:
objname = None
po = self.getentrypointptr(obj)
poname = db.get(po)
objname = objname or poname
if objname in self.exports:
raise NameError, 'duplicate name in export: %s is %s and %s' % (
objname, db.get(self.exports[objname]), poname)
self.exports[objname] = po
db.complete()
# add library dependencies
seen = dict.fromkeys(self.libraries)
for node in db.globalcontainers():
if hasattr(node, 'libraries'):
for library in node.libraries:
if library not in seen:
self.libraries.append(library)
seen[library] = True
return db