def run(self, cwd, args):
        # save current Directory
        self.currentDir = os.getcwd()
        os.chdir(_benchmarksDirectory())

        f = open(os.devnull, 'w')

        mx_sulong.ensureLLVMBinariesExist()
        benchmarkDir = args[0]

        # enter benchmark dir
        os.chdir(benchmarkDir)

        # create directory for executable of this vm
        if not os.path.exists(self.name()):
            os.makedirs(self.name())
        os.chdir(self.name())

        if os.path.exists('bench'):
            os.remove('bench')

        env = os.environ.copy()
        env['CFLAGS'] = ' '.join(_env_flags + ['-lm', '-lgmp'])
        env['LLVM_COMPILER'] = 'clang'
        env['CC'] = 'wllvm'
        env['VPATH'] = '..'

        cmdline = ['make', '-f', '../Makefile']

        mx.run(cmdline, out=f, err=f, env=env)
        mx.run(['extract-bc', 'bench'], out=f, err=f)
        mx_sulong.opt(['-o', 'bench.bc', 'bench.bc'] + [
            '-mem2reg', '-globalopt', '-simplifycfg', '-constprop',
            '-instcombine', '-dse', '-loop-simplify', '-reassociate', '-licm',
            '-gvn'
        ],
                      out=f,
                      err=f)

        suTruffleOptions = [
            '-Dgraal.TruffleBackgroundCompilation=false',
            '-Dgraal.TruffleTimeThreshold=1000000',
            '-Dgraal.TruffleInliningMaxCallerSize=10000',
            '-Dgraal.TruffleCompilationExceptionsAreFatal=true',
            mx_subst.path_substitutions.substitute(
                '-Dpolyglot.llvm.libraryPath=<path:SULONG_LIBS>'),
            '-Dpolyglot.llvm.libraries=libgmp.so.10'
        ]
        sulongCmdLine = suTruffleOptions + mx_sulong.getClasspathOptions() + [
            '-XX:-UseJVMCIClassLoader',
            "com.oracle.truffle.llvm.launcher.LLVMLauncher"
        ] + ['bench.bc']
        result = self.host_vm().run(cwd, sulongCmdLine + args)

        # reset current Directory
        os.chdir(self.currentDir)

        return result
Beispiel #2
0
 def run(self, cwd, args):
     launcher_args = self.launcher_args(args)
     if hasattr(self.host_vm(), 'run_lang'):
         result = self.host_vm().run_lang('lli', launcher_args, cwd)
     else:
         sulongCmdLine = mx_sulong.getClasspathOptions() + [
             "com.oracle.truffle.llvm.launcher.LLVMLauncher"
         ]
         result = self.host_vm().run(cwd, sulongCmdLine + launcher_args)
     return result
Beispiel #3
0
 def run(self, cwd, args):
     bench_file = args[-1]
     launcher_args = self.launcher_args(args[:-1]) + [bench_file]
     if hasattr(self.host_vm(), 'run_lang'):
         result = self.host_vm().run_lang('lli', launcher_args, cwd)
     else:
         sulongCmdLine = mx_sulong.getClasspathOptions() + \
                         ['-XX:-UseJVMCIClassLoader', "com.oracle.truffle.llvm.launcher.LLVMLauncher"]
         result = self.host_vm().run(cwd, sulongCmdLine + launcher_args)
     return result
    def run(self, cwd, args):
        # save current Directory
        self.currentDir = os.getcwd()
        os.chdir(_benchmarksDirectory())

        f = open(os.devnull, 'w')

        mx_sulong.ensureLLVMBinariesExist()
        benchmarkDir = args[0]

        # enter benchmark dir
        os.chdir(benchmarkDir)

        # create directory for executable of this vm
        if not os.path.exists(self.name()):
            os.makedirs(self.name())
        os.chdir(self.name())

        if os.path.exists('bench'):
            os.remove('bench')

        env = os.environ.copy()
        env['CFLAGS'] = ' '.join(_env_flags + ['-lm', '-lgmp'])
        env['LLVM_COMPILER'] = 'clang'
        env['CC'] = 'wllvm'
        env['VPATH'] = '..'

        cmdline = ['make', '-f', '../Makefile']

        mx.run(cmdline, out=f, err=f, env=env)
        mx.run(['extract-bc', 'bench'], out=f, err=f)
        mx_sulong.opt(['-o', 'bench.bc', 'bench.bc'] +
                      mx_sulong.getStandardLLVMOptFlags(),
                      out=f,
                      err=f)

        suTruffleOptions = [
            '-Dgraal.TruffleBackgroundCompilation=false',
            '-Dgraal.TruffleTimeThreshold=1000000',
            '-Dgraal.TruffleInliningMaxCallerSize=10000',
            '-Dgraal.TruffleCompilationExceptionsAreFatal=true',
        ]
        sulongCmdLine = suTruffleOptions + [
            mx_sulong.getSearchPathOption()
        ] + mx_sulong.getBitcodeLibrariesOption(
        ) + mx_sulong.getClasspathOptions() + [
            '-XX:-UseJVMCIClassLoader', "com.oracle.truffle.llvm.Sulong"
        ] + ['bench.bc']
        result = self.host_vm().run(cwd, sulongCmdLine + args)

        # reset current Directory
        os.chdir(self.currentDir)

        return result
Beispiel #5
0
    def run(self, cwd, args):
        # save current Directory
        self.currentDir = os.getcwd()
        os.chdir(_benchmarksDirectory())

        f = open(os.devnull, 'w')

        mx_sulong.ensureLLVMBinariesExist()
        benchmarkDir = args[0]

        # enter benchmark dir
        os.chdir(benchmarkDir)

        # create directory for executable of this vm
        if not os.path.exists(self.name()):
            os.makedirs(self.name())
        os.chdir(self.name())

        if os.path.exists('bench'):
            os.remove('bench')

        env = os.environ.copy()
        env['CFLAGS'] = ' '.join(_env_flags + ['-lm', '-lgmp'])
        env['LLVM_COMPILER'] = 'clang'
        env['CC'] = 'wllvm'
        env['VPATH'] = '..'

        cmdline = ['make', '-f', '../Makefile']

        mx.run(cmdline, out=f, err=f, env=env)
        mx.run(['extract-bc', 'bench'], out=f, err=f)
        mx_sulong.opt(['-o', 'bench.bc', 'bench.bc'] + ['-mem2reg', '-globalopt', '-simplifycfg', '-constprop', '-instcombine', '-dse', '-loop-simplify', '-reassociate', '-licm', '-gvn'], out=f, err=f)

        suTruffleOptions = [
            '-Dgraal.TruffleBackgroundCompilation=false',
            '-Dgraal.TruffleTimeThreshold=1000000',
            '-Dgraal.TruffleInliningMaxCallerSize=10000',
            '-Dgraal.TruffleCompilationExceptionsAreFatal=true',
            mx_subst.path_substitutions.substitute('-Dpolyglot.llvm.libraryPath=<path:SULONG_LIBS>'),
            '-Dpolyglot.llvm.libraries=libgmp.so.10']
        sulongCmdLine = suTruffleOptions + mx_sulong.getClasspathOptions() + ['-XX:-UseJVMCIClassLoader', "com.oracle.truffle.llvm.launcher.LLVMLauncher"] + ['bench.bc']
        result = self.host_vm().run(cwd, sulongCmdLine + args)

        # reset current Directory
        os.chdir(self.currentDir)

        return result
Beispiel #6
0
    def run(self, cwd, args):
        bench_file = args[-1]
        launcher_args = self.launcher_args(args[:-1]) + [bench_file]
        if hasattr(self.host_vm(), 'run_lang'):
            result = self.host_vm().run_lang('lli', launcher_args, cwd)
        else:

            def _filter_properties(args):
                props = []
                remaining_args = []
                jvm_prefix = "--jvm.D"
                for arg in args:
                    if arg.startswith(jvm_prefix):
                        props.append('-D' + arg[len(jvm_prefix):])
                    else:
                        remaining_args.append(arg)
                return props, remaining_args

            props, launcher_args = _filter_properties(launcher_args)
            sulongCmdLine = mx_sulong.getClasspathOptions() + \
                            props + \
                            ['-XX:-UseJVMCIClassLoader', "com.oracle.truffle.llvm.launcher.LLVMLauncher"]
            result = self.host_vm().run(cwd, sulongCmdLine + launcher_args)
        return result
    def run(self, cwd, args):
        f = open(os.devnull, 'w')

        mx_sulong.ensureLLVMBinariesExist()
        inputFile = args[0]
        outputFile = 'test.bc'
        mx_sulong.compileWithClangOpt(inputFile,
                                      outputFile, ['3.2', '3.3'],
                                      out=f,
                                      err=f)

        suTruffleOptions = [
            '-Dgraal.TruffleBackgroundCompilation=false',
            '-Dgraal.TruffleTimeThreshold=1000000',
            '-Dgraal.TruffleInliningMaxCallerSize=10000',
            '-Dgraal.TruffleCompilationExceptionsAreFatal=true',
        ]
        sulongCmdLine = suTruffleOptions + [
            mx_sulong.getSearchPathOption()
        ] + mx_sulong.getBitcodeLibrariesOption(
        ) + mx_sulong.getClasspathOptions() + [
            '-XX:-UseJVMCIClassLoader', "com.oracle.truffle.llvm.LLVM"
        ] + [outputFile]
        return self.host_vm().run(cwd, sulongCmdLine + args)
Beispiel #8
0
 def launcher_vm_args(self):
     return mx_sulong.getClasspathOptions(['POLYBENCH'])
Beispiel #9
0
 def launcher_vm_args(self):
     return mx_sulong.getClasspathOptions() + \
            [mx_subst.path_substitutions.substitute('-Dpolyglot.llvm.libraryPath=<path:SULONG_LIBS>')]