コード例 #1
0
    # Inline alias checks.
    time_start_inlining = time.time()
    if args.disable_inline:
        cmd = " ".join(("cp", bc_ac_opt, bc_ac_opt_inline))
    else:
        cmd = ng_utils.load_all_plugins("opt")
        cmd = " ".join((cmd, "-inline-alias-checker"))
        cmd = " ".join((cmd, "-o", bc_ac_opt_inline, "<", bc_ac_opt))
    rcs_utils.invoke(cmd)

    # Codegen.
    time_start_codegen = time.time()
    cmd = " ".join(("clang++", bc_ac_opt_inline))
    # ReportMissingAlias won't be inlined anyway, so we have to link
    # libDynAAAliasChecker.a
    cmd = " ".join((cmd, rcs_utils.get_libdir() + "/libDynAAAliasChecker.a"))
    cmd = " ".join((cmd, "-o", args.prog + ".ac"))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    # The pthread library is necessary for the online mode.
    linking_flags.append("-pthread")
    cmd = " ".join((cmd, " ".join(linking_flags)))
    rcs_utils.invoke(cmd)

    # Print runtime of each stage.
    time_finish = time.time()
    print "Inserting alias checks:", time_start_o3 - time_start_inserting
    print "Running O3:", time_start_inlining - time_start_o3
    print "Inlining:", time_start_codegen - time_start_inlining
    print "Codegen:", time_finish - time_start_codegen
コード例 #2
0
ファイル: ng_hybrid.py プロジェクト: chubbymaggie/neongoby
    # Inline alias checks.
    time_start_inlining = time.time()
    if args.disable_inline:
        cmd = ' '.join(('cp', bc_hybrid_opt, bc_hybrid_opt_inline))
    else:
        cmd = ng_utils.load_all_plugins('opt')
        cmd = ' '.join((cmd, '-inline-alias-checker'))
        cmd = ' '.join((cmd, '-o', bc_hybrid_opt_inline, '<', bc_hybrid_opt))
    rcs_utils.invoke(cmd)

    # Codegen.
    time_start_codegen = time.time()
    cmd = ' '.join(('clang++', bc_hybrid_opt_inline))
    # ReportMissingAlias won't be inlined anyway, so we have to link
    # libDynAAAliasChecker.a
    cmd = ' '.join((cmd, rcs_utils.get_libdir() + '/libDynAAAliasChecker.a'))
    cmd = ' '.join((cmd, rcs_utils.get_libdir() + '/libDynAAMemoryHooks.a'))
    cmd = ' '.join((cmd, '-o', exe_hybrid))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    cmd = ' '.join((cmd, ' '.join(linking_flags)))
    rcs_utils.invoke(cmd)

    # Print runtime of each stage.
    time_finish = time.time()
    print 'Inserting alias checks and hooking memory access:', \
        time_start_o3 - time_start_hybrid
    print 'Running O3:', time_start_inlining - time_start_o3
    print 'Inlining:', time_start_codegen - time_start_inlining
    print 'Codegen:', time_finish - time_start_codegen
コード例 #3
0
ファイル: ng_hook_mem.py プロジェクト: chubbymaggie/neongoby
                        help = 'instrument for test case reduction and ' + \
                               'trace slicing (False by default)',
                        action = 'store_true',
                        default = False)
    args = parser.parse_args()

    instrumented_bc = args.prog + '.inst.bc'
    instrumented_exe = args.prog + '.inst'

    cmd = ng_utils.load_all_plugins('opt')
    # Preparer doesn't preserve IDAssigner, so we put it after
    # -instrument-memory.
    cmd = ' '.join((cmd, '-instrument-memory', '-prepare'))
    if args.hook_all:
        cmd = ' '.join((cmd, '-hook-all-pointers'))
    if args.diagnose:
        cmd = ' '.join((cmd, '-diagnose'))
    cmd = ' '.join((cmd, '-o', instrumented_bc))
    cmd = ' '.join((cmd, '<', args.prog + '.bc'))
    rcs_utils.invoke(cmd)

    cmd = ' '.join(('clang++', instrumented_bc,
                    rcs_utils.get_libdir() + '/libDynAAMemoryHooks.a',
                    '-o', instrumented_exe))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    # Memory hooks use pthread functions.
    if '-pthread' not in linking_flags:
        linking_flags.append('-pthread')
    cmd = ' '.join((cmd, ' '.join(linking_flags)))
    rcs_utils.invoke(cmd)
コード例 #4
0
ファイル: loom_instrument.py プロジェクト: columbia/loom
import argparse

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
            description = 'insert Loom update engine to the program')
    parser.add_argument('prog', help = 'the program name (e.g. mysqld)')
    args = parser.parse_args()

    instrumented_bc = args.prog + '.loom.bc'
    instrumented_exe = args.prog + '.loom'

    # TODO: loom_utils.load_all_plugins
    cmd = rcs_utils.load_plugin('opt', 'RCSID')
    cmd = rcs_utils.load_plugin(cmd, 'RCSCFG')
    cmd = rcs_utils.load_plugin(cmd, 'libLoomUtils')
    cmd = rcs_utils.load_plugin(cmd, 'LoomAnalysis')
    cmd = rcs_utils.load_plugin(cmd, 'LoomInstrumenter')
    cmd = ' '.join((cmd, '-break-crit-invokes', '-insert-checks', '-clone-bbs'))
    cmd = ' '.join((cmd, '-o', instrumented_bc))
    cmd = ' '.join((cmd, '<', args.prog + '.bc'))
    rcs_utils.invoke(cmd)

    cmd = ' '.join(('clang++', instrumented_bc,
                    rcs_utils.get_libdir() + '/libLoomUpdateEngine.a',
                    rcs_utils.get_libdir() + '/libLoomUtils.a',
                    '-o', instrumented_exe,
                    '-g', '-O3'))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    cmd = ' '.join((cmd, ' '.join(linking_flags), '-pthread'))
    rcs_utils.invoke(cmd) 
コード例 #5
0
    # Inline alias checks.
    time_start_inlining = time.time()
    if args.disable_inline:
        cmd = ' '.join(('cp', bc_hybrid_opt, bc_hybrid_opt_inline))
    else:
        cmd = ng_utils.load_all_plugins('opt')
        cmd = ' '.join((cmd, '-inline-alias-checker'))
        cmd = ' '.join((cmd, '-o', bc_hybrid_opt_inline, '<', bc_hybrid_opt))
    rcs_utils.invoke(cmd)

    # Codegen.
    time_start_codegen = time.time()
    cmd = ' '.join(('clang++', bc_hybrid_opt_inline))
    # ReportMissingAlias won't be inlined anyway, so we have to link
    # libDynAAAliasChecker.a
    cmd = ' '.join((cmd, rcs_utils.get_libdir() + '/libDynAAAliasChecker.a'))
    cmd = ' '.join((cmd, rcs_utils.get_libdir() + '/libDynAAMemoryHooks.a'))
    cmd = ' '.join((cmd, '-o', exe_hybrid))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    cmd = ' '.join((cmd, ' '.join(linking_flags)))
    rcs_utils.invoke(cmd)

    # Print runtime of each stage.
    time_finish = time.time()
    print 'Inserting alias checks and hooking memory access:', \
        time_start_o3 - time_start_hybrid
    print 'Running O3:', time_start_inlining - time_start_o3
    print 'Inlining:', time_start_codegen - time_start_inlining
    print 'Codegen:', time_finish - time_start_codegen
コード例 #6
0
ファイル: loom_instrument.py プロジェクト: junfengy/loom
import argparse

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='insert Loom update engine to the program')
    parser.add_argument('prog', help='the program name (e.g. mysqld)')
    args = parser.parse_args()

    instrumented_bc = args.prog + '.loom.bc'
    instrumented_exe = args.prog + '.loom'

    # TODO: loom_utils.load_all_plugins
    cmd = rcs_utils.load_plugin('opt', 'RCSID')
    cmd = rcs_utils.load_plugin(cmd, 'RCSCFG')
    cmd = rcs_utils.load_plugin(cmd, 'libLoomUtils')
    cmd = rcs_utils.load_plugin(cmd, 'LoomAnalysis')
    cmd = rcs_utils.load_plugin(cmd, 'LoomInstrumenter')
    cmd = ' '.join(
        (cmd, '-break-crit-invokes', '-insert-checks', '-clone-bbs'))
    cmd = ' '.join((cmd, '-o', instrumented_bc))
    cmd = ' '.join((cmd, '<', args.prog + '.bc'))
    rcs_utils.invoke(cmd)

    cmd = ' '.join(('clang++', instrumented_bc,
                    rcs_utils.get_libdir() + '/libLoomUpdateEngine.a',
                    rcs_utils.get_libdir() + '/libLoomUtils.a', '-o',
                    instrumented_exe, '-g', '-O3'))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    cmd = ' '.join((cmd, ' '.join(linking_flags), '-pthread'))
    rcs_utils.invoke(cmd)
コード例 #7
0
                        help = 'instrument for test case reduction and ' + \
                               'trace slicing (False by default)',
                        action = 'store_true',
                        default = False)
    args = parser.parse_args()

    instrumented_bc = args.prog + '.inst.bc'
    instrumented_exe = args.prog + '.inst'

    cmd = ng_utils.load_all_plugins('opt')
    # Preparer doesn't preserve IDAssigner, so we put it after
    # -instrument-memory.
    cmd = ' '.join((cmd, '-instrument-memory', '-prepare'))
    if args.hook_all:
        cmd = ' '.join((cmd, '-hook-all-pointers'))
    if args.diagnose:
        cmd = ' '.join((cmd, '-diagnose'))
    cmd = ' '.join((cmd, '-o', instrumented_bc))
    cmd = ' '.join((cmd, '<', args.prog + '.bc'))
    rcs_utils.invoke(cmd)

    cmd = ' '.join(('clang++', instrumented_bc,
                    rcs_utils.get_libdir() + '/libDynAAMemoryHooks.a', '-o',
                    instrumented_exe))
    linking_flags = rcs_utils.get_linking_flags(args.prog)
    # Memory hooks use pthread functions.
    if '-pthread' not in linking_flags:
        linking_flags.append('-pthread')
    cmd = ' '.join((cmd, ' '.join(linking_flags)))
    rcs_utils.invoke(cmd)