targetsomstandalone.py 854 Bytes
Newer Older
1 2 3 4 5 6 7
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

from som.vm.universe import main, Exit

8
import os
9 10 11 12 13 14 15 16

# __________  Entry points  __________

def entry_point(argv):
    try:
        main(argv)
    except Exit, e:
        return e.code
17
    except Exception, e:
John Zhang's avatar
John Zhang committed
18
        os.write(2, "ERROR: %s thrown during execution.\n" % e)
19
        return 1
20
    return 1
21 22 23 24 25 26


# _____ Define and setup target ___


def target(driver, args):
27 28 29 30
    if driver.config.translation.jit:
        driver.exe_name = 'RPySOM-jit'
    else:
        driver.exe_name = 'RPySOM-no-jit'
31 32 33 34 35 36 37 38 39 40 41 42
    return entry_point, None


def jitpolicy(driver):
    from rpython.jit.codewriter.policy import JitPolicy
    return JitPolicy()


if __name__ == '__main__':
    from rpython.translator.driver import TranslationDriver
    f, _ = target(TranslationDriver(), sys.argv)
    sys.exit(f(sys.argv))