示例#1
0
def detect_model_from_host_platform():
    mach = None
    try:
        import platform
        mach = platform.machine()
    except ImportError:
        pass
    if not mach:
        platform = sys.platform.lower()
        if platform.startswith('win'):   # assume an Intel Windows
            return MODEL_X86
        # assume we have 'uname'
        mach = os.popen('uname -m', 'r').read().strip()
        if not mach:
            raise ProcessorAutodetectError, "cannot run 'uname -m'"
    #
    result ={'i386': MODEL_X86,
            'i486': MODEL_X86,
            'i586': MODEL_X86,
            'i686': MODEL_X86,
            'i86pc': MODEL_X86,    # Solaris/Intel
            'x86': MODEL_X86,      # Apple
            'Power Macintosh': MODEL_PPC_64,
            'ppc64': MODEL_PPC_64,
            'ppc64le': MODEL_PPC_64,
            'x86_64': MODEL_X86,
            'amd64': MODEL_X86,    # freebsd
            'AMD64': MODEL_X86,    # win64
            'armv7l': MODEL_ARM,
            'armv6l': MODEL_ARM,
            'arm': MODEL_ARM,      # freebsd
            's390x': MODEL_S390_64
            }.get(mach)

    if result is None:
        raise ProcessorAutodetectError, "unknown machine name %s" % mach
    #
    if result.startswith('x86'):
        from rpython.jit.backend.x86 import detect_feature as feature
        if sys.maxint == 2**63-1:
            result = MODEL_X86_64
            # has sse 2 at least
            if feature.detect_sse4_1():
                result = MODEL_X86_64_SSE4
        else:
            assert sys.maxint == 2**31-1
            if feature.detect_sse2():
                result = MODEL_X86
            else:
                result = MODEL_X86_NO_SSE2
            if feature.detect_x32_mode():
                raise ProcessorAutodetectError(
                    'JITting in x32 mode is not implemented')
    #
    if result.startswith('arm'):
        from rpython.jit.backend.arm.detect import detect_float
        if not detect_float():
            raise ProcessorAutodetectError(
                'the JIT-compiler requires a vfp unit')
    #
    return result
示例#2
0
def detect_model_from_host_platform():
    mach = None
    try:
        import platform
        mach = platform.machine()
    except ImportError:
        pass
    if not mach:
        platform = sys.platform.lower()
        if platform.startswith('win'):  # assume an Intel Windows
            return MODEL_X86
        # assume we have 'uname'
        mach = os.popen('uname -m', 'r').read().strip()
        if not mach:
            raise ProcessorAutodetectError, "cannot run 'uname -m'"
    #
    result = {
        'i386': MODEL_X86,
        'i486': MODEL_X86,
        'i586': MODEL_X86,
        'i686': MODEL_X86,
        'i86pc': MODEL_X86,  # Solaris/Intel
        'x86': MODEL_X86,  # Apple
        'Power Macintosh': MODEL_PPC_64,
        'ppc64': MODEL_PPC_64,
        'ppc64le': MODEL_PPC_64,
        'x86_64': MODEL_X86,
        'amd64': MODEL_X86,  # freebsd
        'AMD64': MODEL_X86,  # win64
        'armv8l': MODEL_ARM,  # 32-bit ARMv8
        'armv7l': MODEL_ARM,
        'armv6l': MODEL_ARM,
        'arm': MODEL_ARM,  # freebsd
        's390x': MODEL_S390_64
    }.get(mach)

    if result is None:
        raise ProcessorAutodetectError, "unknown machine name %s" % mach
    #
    if result.startswith('x86'):
        from rpython.jit.backend.x86 import detect_feature as feature
        if sys.maxint == 2**63 - 1:
            result = MODEL_X86_64
            # has sse 2 at least
            if feature.detect_sse4_1():
                result = MODEL_X86_64_SSE4
        else:
            assert sys.maxint == 2**31 - 1
            if feature.detect_sse2():
                result = MODEL_X86
            else:
                result = MODEL_X86_NO_SSE2
            if feature.detect_x32_mode():
                raise ProcessorAutodetectError(
                    'JITting in x32 mode is not implemented')
    #
    if result.startswith('arm'):
        from rpython.jit.backend.arm.detect import detect_float
        if not detect_float():
            raise ProcessorAutodetectError(
                'the JIT-compiler requires a vfp unit')
    #
    return result
示例#3
0
 def setup_once(self, asm):
     if detect_feature.detect_sse4_1():
         self.enable(16, accum=True)
         asm.setup_once_vector()
     self._setup = True
示例#4
0
 def setup_once(self, asm):
     if detect_feature.detect_sse4_1():
         self.enable(16, accum=True)
         asm.setup_once_vector()
     self._setup = True