Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: kill-ootype
Changeset: r65657:7ab1bd7d7871
Date: 2013-07-25 18:39 +0100
http://bitbucket.org/pypy/pypy/changeset/7ab1bd7d7871/

Log:    Remove ootype support from pypy

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -340,10 +340,6 @@
         if not IS_64_BITS:
             config.objspace.std.suggest(withsmalllong=True)
 
-    # some optimizations have different effects depending on the typesystem
-    if type_system == 'ootype':
-        config.objspace.std.suggest(multimethods="doubledispatch")
-
     # extra optimizations with the JIT
     if level == 'jit':
         config.objspace.std.suggest(withcelldict=True)
@@ -351,10 +347,7 @@
 
 
 def enable_allworkingmodules(config):
-    if config.translation.type_system == 'ootype':
-        modules = working_oo_modules
-    else:
-        modules = working_modules
+    modules = working_modules
     if config.translation.sandbox:
         modules = default_modules
     # ignore names from 'essential_modules', notably 'exceptions', which
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -234,9 +234,6 @@
             from pypy.config.pypyoption import enable_translationmodules
             enable_translationmodules(config)
 
-        ## if config.translation.type_system == 'ootype':
-        ##     config.objspace.usemodules.suggest(rbench=True)
-
         config.translation.suggest(check_str_without_nul=True)
 
         if config.translation.thread:
@@ -271,12 +268,6 @@
         elif config.objspace.usemodules.pypyjit:
             config.translation.jit = True
 
-        if config.translation.backend == "cli":
-            config.objspace.usemodules.clr = True
-        # XXX did it ever work?
-        #elif config.objspace.usemodules.clr:
-        #    config.translation.backend == "cli"
-
         if config.translation.sandbox:
             config.objspace.lonepycfiles = False
             config.objspace.usepycfiles = False
@@ -292,16 +283,6 @@
         wrapstr = 'space.wrap(%r)' % (options)
         pypy.module.sys.Module.interpleveldefs['pypy_translation_info'] = 
wrapstr
 
-        if config.translation.backend in ["cli", "jvm"] and sys.platform == 
"win32":
-            # HACK: The ftruncate implementation in streamio.py which is used 
for the Win32 platform
-            # is specific for the C backend and can't be generated on CLI or 
JVM. Because of that,
-            # we have to patch it out.
-            from rpython.rlib import streamio
-            def ftruncate_win32_dummy(fd, size): pass
-            def _setfd_binary_dummy(fd): pass
-            streamio.ftruncate_win32 = ftruncate_win32_dummy
-            streamio._setfd_binary = _setfd_binary_dummy
-
         return self.get_entry_point(config)
 
     def jitpolicy(self, driver):
diff --git a/pypy/module/_codecs/__init__.py b/pypy/module/_codecs/__init__.py
--- a/pypy/module/_codecs/__init__.py
+++ b/pypy/module/_codecs/__init__.py
@@ -18,10 +18,10 @@
 
    The builtin Unicode codecs use the following interface:
 
-     <encoding>_encode(Unicode_object[,errors='strict']) -> 
+     <encoding>_encode(Unicode_object[,errors='strict']) ->
          (string object, bytes consumed)
 
-     <encoding>_decode(char_buffer_obj[,errors='strict']) -> 
+     <encoding>_decode(char_buffer_obj[,errors='strict']) ->
         (Unicode object, bytes consumed)
 
    <encoding>_encode() interfaces also accept non-Unicode object as
@@ -90,8 +90,7 @@
         "NOT_RPYTHON"
 
         # mbcs codec is Windows specific, and based on rffi.
-        if (hasattr(runicode, 'str_decode_mbcs') and
-            space.config.translation.type_system != 'ootype'):
+        if (hasattr(runicode, 'str_decode_mbcs')):
             self.interpleveldefs['mbcs_encode'] = 'interp_codecs.mbcs_encode'
             self.interpleveldefs['mbcs_decode'] = 'interp_codecs.mbcs_decode'
 
diff --git a/pypy/module/_file/__init__.py b/pypy/module/_file/__init__.py
--- a/pypy/module/_file/__init__.py
+++ b/pypy/module/_file/__init__.py
@@ -12,18 +12,6 @@
         "set_file_encoding": "interp_file.set_file_encoding",
     }
 
-    def __init__(self, space, *args):
-        "NOT_RPYTHON"
-
-        # on windows with oo backends, remove file.truncate,
-        # because the implementation is based on rffi
-        if (sys.platform == 'win32' and
-            space.config.translation.type_system == 'ootype'):
-            from pypy.module._file.interp_file import W_File
-            del W_File.typedef.rawdict['truncate']
-
-        MixedModule.__init__(self, space, *args)
-
     def shutdown(self, space):
         # at shutdown, flush all open streams.  Ignore I/O errors.
         from pypy.module._file.interp_file import getopenstreams, StreamErrors
diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -4,25 +4,6 @@
 import os
 exec 'import %s as posix' % os.name
 
-# this is the list of function which is *not* present in the posix module of
-# IronPython 2.6, and that we want to ignore for now
-lltype_only_defs = [
-    'chown', 'chroot', 'closerange', 'confstr', 'confstr_names', 'ctermid', 
'dup',
-    'dup2', 'execv', 'execve', 'fchdir', 'fchmod', 'fchown', 'fdatasync', 
'fork',
-    'forkpty', 'fpathconf', 'fstatvfs', 'fsync', 'ftruncate', 'getegid', 
'geteuid',
-    'getgid', 'getgroups', 'getloadavg', 'getlogin', 'getpgid', 'getpgrp', 
'getppid',
-    'getsid', 'getuid', 'kill', 'killpg', 'lchown', 'link', 'lseek', 'major',
-    'makedev', 'minor', 'mkfifo', 'mknod', 'nice', 'openpty', 'pathconf', 
'pathconf_names',
-    'pipe', 'readlink', 'setegid', 'seteuid', 'setgid', 'setgroups', 
'setpgid', 'setpgrp',
-    'setregid', 'setreuid', 'setsid', 'setuid', 'stat_float_times', 'statvfs',
-    'statvfs_result', 'symlink', 'sysconf', 'sysconf_names', 'tcgetpgrp', 
'tcsetpgrp',
-    'ttyname', 'uname', 'wait', 'wait3', 'wait4'
-    ]
-
-# the Win32 urandom implementation isn't going to translate on JVM or CLI so
-# we have to remove it
-lltype_only_defs.append('urandom')
-
 class Module(MixedModule):
     """This module provides access to operating system functionality that is
 standardized by the C Standard and the POSIX standard (a thinly
@@ -54,7 +35,7 @@
         appleveldefs['wait3'] = 'app_posix.wait3'
     if hasattr(os, 'wait4'):
         appleveldefs['wait4'] = 'app_posix.wait4'
-        
+
     interpleveldefs = {
     'open'      : 'interp_posix.open',
     'lseek'     : 'interp_posix.lseek',
@@ -168,8 +149,8 @@
         interpleveldefs['getlogin'] = 'interp_posix.getlogin'
 
     for name in ['setsid', 'getuid', 'geteuid', 'getgid', 'getegid', 'setuid',
-                 'seteuid', 'setgid', 'setegid', 'getgroups', 'getpgrp', 
-                 'setpgrp', 'getppid', 'getpgid', 'setpgid', 'setreuid', 
+                 'seteuid', 'setgid', 'setegid', 'getgroups', 'getpgrp',
+                 'setpgrp', 'getppid', 'getpgid', 'setpgid', 'setreuid',
                  'setregid', 'getsid', 'setsid']:
         if hasattr(os, name):
             interpleveldefs[name] = 'interp_posix.%s' % (name,)
@@ -178,24 +159,15 @@
         interpleveldefs['_getfullpathname'] = 'interp_posix._getfullpathname'
     if hasattr(os, 'chroot'):
         interpleveldefs['chroot'] = 'interp_posix.chroot'
-    
+
     for name in RegisterOs.w_star:
         if hasattr(os, name):
             interpleveldefs[name] = 'interp_posix.' + name
 
-    def __init__(self, space, w_name):
-        # if it's an ootype translation, remove all the defs that are lltype
-        # only
-        backend = space.config.translation.backend
-        if backend == 'cli' or backend == 'jvm':
-            for name in lltype_only_defs:
-                self.interpleveldefs.pop(name, None)
-        MixedModule.__init__(self, space, w_name)
-
     def startup(self, space):
         from pypy.module.posix import interp_posix
         interp_posix.get(space).startup(space)
-        
+
 for constant in dir(os):
     value = getattr(os, constant)
     if constant.isupper() and type(value) is int:
diff --git a/pypy/module/posix/interp_posix.py 
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -215,10 +215,7 @@
                                  enumerate(ll_os_stat.PORTABLE_STAT_FIELDS))
 
 def build_stat_result(space, st):
-    if space.config.translation.type_system == 'ootype':
-        FIELDS = PORTABLE_STAT_FIELDS
-    else:
-        FIELDS = STAT_FIELDS    # also when not translating at all
+    FIELDS = STAT_FIELDS    # also when not translating at all
     lst = [None] * ll_os_stat.N_INDEXABLE_FIELDS
     w_keywords = space.newdict()
     stat_float_times = space.fromcache(StatState).stat_float_times
@@ -480,11 +477,7 @@
 def getstatfields(space):
     # for app_posix.py: export the list of 'st_xxx' names that we know
     # about at RPython level
-    if space.config.translation.type_system == 'ootype':
-        FIELDS = PORTABLE_STAT_FIELDS
-    else:
-        FIELDS = STAT_FIELDS    # also when not translating at all
-    return space.newlist([space.wrap(name) for _, (name, _) in FIELDS])
+    return space.newlist([space.wrap(name) for _, (name, _) in STAT_FIELDS])
 
 
 class State:
diff --git a/pypy/module/sys/interp_encoding.py 
b/pypy/module/sys/interp_encoding.py
--- a/pypy/module/sys/interp_encoding.py
+++ b/pypy/module/sys/interp_encoding.py
@@ -3,12 +3,12 @@
 from rpython.rlib.objectmodel import we_are_translated
 
 def getdefaultencoding(space):
-    """Return the current default string encoding used by the Unicode 
+    """Return the current default string encoding used by the Unicode
 implementation."""
     return space.wrap(space.sys.defaultencoding)
 
 def setdefaultencoding(space, w_encoding):
-    """Set the current default string encoding used by the Unicode 
+    """Set the current default string encoding used by the Unicode
 implementation."""
     encoding = space.str_w(w_encoding)
     mod = space.getbuiltinmodule("_codecs")
@@ -37,10 +37,6 @@
     base_encoding = None
 
 def _getfilesystemencoding(space):
-    if (space.config.translation.type_system == 'ootype'):
-        # XXX: fix this for ootype
-        return base_encoding
-    #
     encoding = base_encoding
     if rlocale.HAVE_LANGINFO and rlocale.CODESET:
         try:
diff --git a/pypy/objspace/std/unicodeobject.py 
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -493,9 +493,6 @@
 
 def unicode_startswith__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, 
w_start, w_end):
     self, start, end = _convert_idx_params(space, w_self, w_start, w_end, True)
-    # XXX this stuff can be waaay better for ootypebased backends if
-    #     we re-use more of our rpython machinery (ie implement startswith
-    #     with additional parameters as rpython)
     return space.newbool(startswith(self, w_substr._value, start, end))
 
 def unicode_startswith__Unicode_ANY_ANY_ANY(space, w_unistr, w_prefixes,
diff --git a/pypy/tool/pypyjit.py b/pypy/tool/pypyjit.py
--- a/pypy/tool/pypyjit.py
+++ b/pypy/tool/pypyjit.py
@@ -1,7 +1,7 @@
 """
 A file that invokes translation of PyPy with the JIT enabled.
 
-Run it with py.test -s --pdb pypyjit.py [--ootype]
+Run it with py.test -s --pdb pypyjit.py
 
 """
 
@@ -14,20 +14,9 @@
 from rpython.rtyper.annlowlevel import llhelper, llstr, oostr, hlstr
 from rpython.rtyper.lltypesystem.rstr import STR
 from rpython.rtyper.lltypesystem import lltype
-from rpython.rtyper.ootypesystem import ootype
 from pypy.interpreter.pycode import PyCode
 from rpython.translator.goal import unixcheckpoint
 
-if not hasattr(py.test.config.option, 'ootype'):
-    import sys
-    print >> sys.stderr, __doc__
-    sys.exit(2)
-
-if py.test.config.option.ootype:
-    BACKEND = 'cli'
-else:
-    BACKEND = 'c'
-
 config = get_pypy_config(translating=True)
 config.translation.backendopt.inline_threshold = 0.1
 config.translation.gc = 'boehm'
@@ -45,15 +34,8 @@
 #
 set_pypy_opt_level(config, level='jit')
 
-if BACKEND == 'c':
-    config.objspace.std.multimethods = 'mrd'
-    multimethod.Installer = multimethod.InstallerVersion2
-elif BACKEND == 'cli':
-    config.objspace.std.multimethods = 'doubledispatch'
-    multimethod.Installer = multimethod.InstallerVersion1
-    config.translation.backend = 'cli'
-else:
-    assert False
+config.objspace.std.multimethods = 'mrd'
+multimethod.Installer = multimethod.InstallerVersion2
 print config
 
 import sys, pdb
@@ -82,13 +64,8 @@
     code = ec.compiler.compile(source, filename, 'exec', 0)
     return llstr(space.str_w(dumps(space, code, space.wrap(2))))
 
-if BACKEND == 'c':
-    FPTR = lltype.Ptr(lltype.FuncType([], lltype.Ptr(STR)))
-    read_code_ptr = llhelper(FPTR, read_code)
-else:
-    llstr = oostr
-    FUNC = ootype.StaticMethod([], ootype.String)
-    read_code_ptr = llhelper(FUNC, read_code)
+FPTR = lltype.Ptr(lltype.FuncType([], lltype.Ptr(STR)))
+read_code_ptr = llhelper(FPTR, read_code)
 
 def entry_point():
     from pypy.module.marshal.interp_marshal import loads
@@ -117,13 +94,8 @@
 
     from rpython.jit.codewriter.codewriter import CodeWriter
     CodeWriter.debug = True
-    from rpython.jit.tl.pypyjit_child import run_child, run_child_ootype
-    if BACKEND == 'c':
-        run_child(globals(), locals())
-    elif BACKEND == 'cli':
-        run_child_ootype(globals(), locals())
-    else:
-        assert False
+    from rpython.jit.tl.pypyjit_child import run_child
+    run_child(globals(), locals())
 
 
 if __name__ == '__main__':
diff --git a/pypy/tool/pypyjit_child.py b/pypy/tool/pypyjit_child.py
--- a/pypy/tool/pypyjit_child.py
+++ b/pypy/tool/pypyjit_child.py
@@ -19,14 +19,6 @@
     apply_jit(interp, graph, LLtypeCPU)
 
 
-def run_child_ootype(glob, loc):
-    import sys, pdb
-    interp = loc['interp']
-    graph = loc['graph']
-    from rpython.jit.backend.llgraph.runner import OOtypeCPU
-    apply_jit(interp, graph, OOtypeCPU)
-
-
 def apply_jit(interp, graph, CPUClass):
     print 'warmspot.jittify_and_run() started...'
     policy = PyPyJitPolicy()
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to