コード例 #1
0
ファイル: Building.py プロジェクト: zhangf911/Nuitka
def createModuleTree(module, source_ref, source_filename, is_main):
    if Options.isShowProgress():
        memory_watch = Utils.MemoryWatch()

    source_code = readSourceCodeFromFilename(source_filename)

    module_body = buildParseTree(
        provider    = module,
        source_code = source_code,
        source_ref  = source_ref,
        is_module   = True,
        is_main     = is_main
    )

    module.setBody(
        module_body
    )

    completeVariableClosures(module)

    if Options.isShowProgress():
        memory_watch.finish()

        Tracing.printLine(
            "Memory usage changed loading module '%s': %s" % (
                module.getFullName(),
                memory_watch.asStr()
            )
        )
コード例 #2
0
ファイル: Optimization.py プロジェクト: zhangf911/Nuitka
def optimizePythonModule(module):
    if _progress:
        printLine(
            "Doing module local optimizations for '{module_name}'.".format(
                module_name=module.getFullName()))

    # The tag set is global, so it can react to changes without context.
    # pylint: disable=W0603
    global tag_set
    tag_set = TagSet()

    touched = False

    if _progress:
        memory_watch = Utils.MemoryWatch()

    while True:
        tag_set.clear()

        _optimizeModulePass(module=module)

        if not tag_set:
            break

        touched = True

    if _progress:
        memory_watch.finish()

        printLine("Memory usage changed during optimization of '%s': %s" %
                  (module.getFullName(), memory_watch.asStr()))

    return touched
コード例 #3
0
ファイル: Optimization.py プロジェクト: TheKK/Nuitka
def optimizePythonModule(module):
    if _progress:
        printLine(
            "Doing module local optimizations for '{module_name}'.".format(
                module_name=module.getFullName()))

    global tag_set
    tag_set = TagSet()

    touched = False

    if _progress:
        memory_watch = Utils.MemoryWatch()

    while True:
        tag_set.clear()

        _optimizeModulePass(module=module, tag_set=tag_set)

        if not tag_set:
            break

        touched = True

    if _progress:
        memory_watch.finish()

        printLine("Memory usage changed during optimization of '%s': %s" %
                  (module.getFullName(), memory_watch.asStr()))

    return touched