[pypy-svn] pypy 32ptr-on-64bit: Merge default.

arigo commits-noreply at bitbucket.org
Thu Mar 17 19:45:28 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 32ptr-on-64bit
Changeset: r42770:f456809fb7bd
Date: 2011-03-17 14:44 -0400
http://bitbucket.org/pypy/pypy/changeset/f456809fb7bd/

Log:	Merge default.

diff --git a/pypy/module/readline/test/test_c_readline.py b/pypy/module/readline/test/test_c_readline.py
deleted file mode 100644
--- a/pypy/module/readline/test/test_c_readline.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-Directly test the basic ctypes wrappers.
-"""
-
-import py
-from pypy import conftest; conftest.translation_test_so_skip_if_appdirect()
-from pypy.rpython.tool import rffi_platform as platform
-
-try:
-    from pypy.module.readline import c_readline
-except platform.CompilationError, e:
-    py.test.skip(e)
-
-
-def test_basic_import():
-    c_readline.c_rl_initialize()

diff --git a/pypy/rpython/llinterp.py b/pypy/rpython/llinterp.py
--- a/pypy/rpython/llinterp.py
+++ b/pypy/rpython/llinterp.py
@@ -840,9 +840,18 @@
     def op_gc_thread_run(self):
         self.heap.thread_run()
 
+    def op_gc_thread_start(self):
+        self.heap.thread_start()
+
     def op_gc_thread_die(self):
         self.heap.thread_die()
 
+    def op_gc_thread_before_fork(self):
+        raise NotImplementedError
+
+    def op_gc_thread_after_fork(self):
+        raise NotImplementedError
+
     def op_gc_free(self, addr):
         # what can you do?
         pass
@@ -1065,20 +1074,6 @@
         except OverflowError:
             self.make_llexception()
 
-    def op_llong_neg_ovf(self, x):
-        assert type(x) is r_longlong
-        try:
-            return ovfcheck(-x)
-        except OverflowError:
-            self.make_llexception()
-
-    def op_llong_abs_ovf(self, x):
-        assert type(x) is r_longlong
-        try:
-            return ovfcheck(abs(x))
-        except OverflowError:
-            self.make_llexception()
-
     def op_int_lshift_ovf(self, x, y):
         assert isinstance(x, int)
         assert isinstance(y, int)

diff --git a/pypy/module/__builtin__/app_file_stub.py b/pypy/module/__builtin__/app_file_stub.py
deleted file mode 100644
--- a/pypy/module/__builtin__/app_file_stub.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# NOT_RPYTHON
-
-class file(object): 
-    """file(name[, mode[, buffering]]) -> file object
-
-Open a file.  The mode can be 'r', 'w' or 'a' for reading (default),
-writing or appending.  The file will be created if it doesn't exist
-when opened for writing or appending; it will be truncated when
-opened for writing.  Add a 'b' to the mode for binary files.
-Add a '+' to the mode to allow simultaneous reading and writing.
-If the buffering argument is given, 0 means unbuffered, 1 means line
-buffered, and larger numbers specify the buffer size.
-Add a 'U' to mode to open the file for input with universal newline
-support.  Any line ending in the input file will be seen as a '\n'
-in Python.  Also, a file so opened gains the attribute 'newlines';
-the value for this attribute is one of None (no newline read yet),
-'\r', '\n', '\r\n' or a tuple containing all the newline types seen.
-
-Note:  open() is an alias for file().
-"""


diff --git a/pypy/translator/c/src/stack.h b/pypy/translator/c/src/stack.h
--- a/pypy/translator/c/src/stack.h
+++ b/pypy/translator/c/src/stack.h
@@ -21,7 +21,6 @@
 char LL_stack_too_big_slowpath(long);    /* returns 0 (ok) or 1 (too big) */
 
 /* some macros referenced from pypy.rlib.rstack */
-#define OP_STACK_CURRENT(r)  r = (long)&r
 #define LL_stack_get_start() ((long)_LLstacktoobig_stack_start)
 #define LL_stack_get_length() MAX_STACK_SIZE
 #define LL_stack_get_start_adr() ((long)&_LLstacktoobig_stack_start)  /* JIT */

diff --git a/pypy/module/readline/c_readline.py b/pypy/module/readline/c_readline.py
deleted file mode 100644
--- a/pypy/module/readline/c_readline.py
+++ /dev/null
@@ -1,77 +0,0 @@
-from pypy.rpython.tool import rffi_platform as platform
-from pypy.rpython.lltypesystem import lltype, rffi
-from pypy.interpreter.error import OperationError
-from pypy.interpreter.gateway import ObjSpace, interp2app
-from pypy.translator.tool.cbuild import ExternalCompilationInfo
-
-# On various platforms, linking only with libreadline is not enough;
-# we also need to link with some variant of curses or libtermcap.
-# We follow the logic of CPython below.
-def try_with_lib(extralibs, **kwds):
-    global most_recent_error
-    # at least on Gentoo Linux, readline.h doesn't compile if stdio.h is not
-    # included before
-    eci = ExternalCompilationInfo(
-        includes = ["stdio.h", "readline/readline.h", "readline/history.h"],
-        libraries = extralibs + ['readline'],
-        )
-    try:
-        platform.verify_eci(eci)
-        return eci
-    except platform.CompilationError, e:
-        most_recent_error = e
-        return None
-
-eci = (try_with_lib([]) or
-       try_with_lib(['ncursesw']) or
-       try_with_lib(['ncurses']) or
-       try_with_lib(['curses']) or
-       try_with_lib(['termcap'], library_dirs=['/usr/lib/termcap']))
-if eci is None:
-    raise most_recent_error
-
-# ____________________________________________________________
-
-def external(name, args, result):
-    return rffi.llexternal(name, args, result, compilation_info=eci)
-
-# get a binding to  c library functions and define their args and return types
-# char *readline(char *)
-c_readline = external('readline', [rffi.CCHARP], rffi.CCHARP)
-
-# void rl_initiliaze(void)
-c_rl_initialize = external('rl_initialize', [], lltype.Void)
-
-# void using_history(void)
-c_using_history = external('using_history', [], lltype.Void)
-
-# void add_history(const char *)
-c_add_history = external('add_history', [rffi.CCHARP], lltype.Void)
-
-#------------------------------------------------------------
-# special initialization of readline 
-
-class ReadlineState(object):
-    lastline = ""        # XXX possibly temporary hack
-readlinestate = ReadlineState()
-
-def setup_readline(space, w_module):
-    c_using_history()
-    # XXX CPython initializes more stuff here
-    c_rl_initialize()
-    # install sys.__raw_input__, a hook that will be used by raw_input()
-    space.setitem(space.sys.w_dict, space.wrap('__raw_input__'),
-                  space.wrap(app_readline_func))
-
-def readline_func(space, prompt):
-    ll_res = c_readline(prompt)
-    if not ll_res:
-        raise OperationError(space.w_EOFError, space.w_None)
-    res = rffi.charp2str(ll_res)
-    if res and res != readlinestate.lastline:
-        readlinestate.lastline = res
-        c_add_history(res)
-    return space.wrap(res)
-
-readline_func.unwrap_spec = [ObjSpace, str]
-app_readline_func = interp2app(readline_func)

diff --git a/pypy/module/readline/app_stub.py b/pypy/module/readline/app_stub.py
deleted file mode 100644
--- a/pypy/module/readline/app_stub.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# NOT_RPYTHON
-
-def stub(*args, **kwds):
-    import warnings
-    warnings.warn("the 'readline' module is only a stub so far")
-
-def stub_str(*args, **kwds):
-    stub()
-    return ''
-
-def stub_int(*args, **kwds):
-    stub()
-    return 0

diff --git a/pypy/rpython/memory/gctransform/framework.py b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -963,11 +963,32 @@
         if hasattr(self.root_walker, 'thread_run_ptr'):
             hop.genop("direct_call", [self.root_walker.thread_run_ptr])
 
+    def gct_gc_thread_start(self, hop):
+        assert self.translator.config.translation.thread
+        if hasattr(self.root_walker, 'thread_start_ptr'):
+            hop.genop("direct_call", [self.root_walker.thread_start_ptr])
+
     def gct_gc_thread_die(self, hop):
         assert self.translator.config.translation.thread
         if hasattr(self.root_walker, 'thread_die_ptr'):
             hop.genop("direct_call", [self.root_walker.thread_die_ptr])
 
+    def gct_gc_thread_before_fork(self, hop):
+        if (self.translator.config.translation.thread
+            and hasattr(self.root_walker, 'thread_before_fork_ptr')):
+            hop.genop("direct_call", [self.root_walker.thread_before_fork_ptr],
+                      resultvar=hop.spaceop.result)
+        else:
+            c_null = rmodel.inputconst(llmemory.Address, llmemory.NULL)
+            hop.genop("same_as", [c_null],
+                      resultvar=hop.spaceop.result)
+
+    def gct_gc_thread_after_fork(self, hop):
+        if (self.translator.config.translation.thread
+            and hasattr(self.root_walker, 'thread_after_fork_ptr')):
+            hop.genop("direct_call", [self.root_walker.thread_after_fork_ptr]
+                                     + hop.spaceop.args)
+
     def gct_gc_get_type_info_group(self, hop):
         return hop.cast_result(self.c_type_info_group)
 
@@ -1278,6 +1299,7 @@
 
 class BaseRootWalker(object):
     need_root_stack = False
+    thread_setup = None
 
     def __init__(self, gctransformer):
         self.gcdata = gctransformer.gcdata
@@ -1287,7 +1309,8 @@
         return True
 
     def setup_root_walker(self):
-        pass
+        if self.thread_setup is not None:
+            self.thread_setup()
 
     def walk_roots(self, collect_stack_root,
                    collect_static_in_prebuilt_nongc,
@@ -1320,7 +1343,6 @@
 
 class ShadowStackRootWalker(BaseRootWalker):
     need_root_stack = True
-    thread_setup = None
     collect_stacks_from_other_threads = None
 
     def __init__(self, gctransformer):
@@ -1360,8 +1382,7 @@
         ll_assert(bool(stackbase), "could not allocate root stack")
         self.gcdata.root_stack_top  = stackbase
         self.gcdata.root_stack_base = stackbase
-        if self.thread_setup is not None:
-            self.thread_setup()
+        BaseRootWalker.setup_root_walker(self)
 
     def walk_stack_roots(self, collect_stack_root):
         gcdata = self.gcdata
@@ -1426,6 +1447,9 @@
             occur in this thread.
             """
             aid = get_aid()
+            if aid == gcdata.main_thread:
+                return   # ignore calls to thread_die() in the main thread
+                         # (which can occur after a fork()).
             gcdata.thread_stacks.setitem(aid, llmemory.NULL)
             old = gcdata.root_stack_base
             if gcdata._fresh_rootstack == llmemory.NULL:
@@ -1471,7 +1495,7 @@
             gcdata.active_thread = new_aid
 
         def collect_stack(aid, stacktop, callback):
-            if stacktop != llmemory.NULL and aid != get_aid():
+            if stacktop != llmemory.NULL and aid != gcdata.active_thread:
                 # collect all valid stacks from the dict (the entry
                 # corresponding to the current thread is not valid)
                 gc = self.gc
@@ -1483,11 +1507,45 @@
                     addr += sizeofaddr
 
         def collect_more_stacks(callback):
+            ll_assert(get_aid() == gcdata.active_thread,
+                      "collect_more_stacks(): invalid active_thread")
             gcdata.thread_stacks.foreach(collect_stack, callback)
 
+        def _free_if_not_current(aid, stacktop, _):
+            if stacktop != llmemory.NULL and aid != gcdata.active_thread:
+                end = stacktop - sizeofaddr
+                base = end.address[0]
+                llmemory.raw_free(base)
+
+        def thread_after_fork(result_of_fork, opaqueaddr):
+            # we don't need a thread_before_fork in this case, so
+            # opaqueaddr == NULL.  This is called after fork().
+            if result_of_fork == 0:
+                # We are in the child process.  Assumes that only the
+                # current thread survived, so frees the shadow stacks
+                # of all the other ones.
+                gcdata.thread_stacks.foreach(_free_if_not_current, None)
+                # Clears the dict (including the current thread, which
+                # was an invalid entry anyway and will be recreated by
+                # the next call to save_away_current_stack()).
+                gcdata.thread_stacks.clear()
+                # Finally, reset the stored thread IDs, in case it
+                # changed because of fork().  Also change the main
+                # thread to the current one (because there is not any
+                # other left).
+                aid = get_aid()
+                gcdata.main_thread = aid
+                gcdata.active_thread = aid
+
         self.thread_setup = thread_setup
         self.thread_prepare_ptr = getfn(thread_prepare, [], annmodel.s_None)
         self.thread_run_ptr = getfn(thread_run, [], annmodel.s_None,
                                     inline=True)
+        # no thread_start_ptr here
         self.thread_die_ptr = getfn(thread_die, [], annmodel.s_None)
+        # no thread_before_fork_ptr here
+        self.thread_after_fork_ptr = getfn(thread_after_fork,
+                                           [annmodel.SomeInteger(),
+                                            annmodel.SomeAddress()],
+                                           annmodel.s_None)
         self.collect_stacks_from_other_threads = collect_more_stacks

diff --git a/pypy/jit/metainterp/simple_optimize.py b/pypy/jit/metainterp/simple_optimize.py
--- a/pypy/jit/metainterp/simple_optimize.py
+++ b/pypy/jit/metainterp/simple_optimize.py
@@ -47,7 +47,8 @@
             jumpop.setdescr(loop.token)
         return None
 
-def optimize_bridge(metainterp_sd, old_loops, loop, inline_short_preamble):
+def optimize_bridge(metainterp_sd, old_loops, loop, inline_short_preamble,
+                    retraced):
     optimize_loop(metainterp_sd, [], loop)
     jumpop = loop.operations[-1]
     if jumpop.getopnum() == rop.JUMP:

diff --git a/pypy/module/pyexpat/interp_pyexpat.py b/pypy/module/pyexpat/interp_pyexpat.py
--- a/pypy/module/pyexpat/interp_pyexpat.py
+++ b/pypy/module/pyexpat/interp_pyexpat.py
@@ -20,10 +20,6 @@
 eci = ExternalCompilationInfo(
     libraries=[libname],
     includes=['expat.h'],
-    pre_include_bits=[
-    '#define XML_COMBINED_VERSION' +
-    ' (10000*XML_MAJOR_VERSION+100*XML_MINOR_VERSION+XML_MICRO_VERSION)',
-    ],
     )
 
 eci = rffi_platform.configure_external_library(
@@ -54,13 +50,17 @@
                  'XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE',
                  'XML_PARAM_ENTITY_PARSING_ALWAYS']:
         locals()[name] = rffi_platform.ConstantInteger(name)
-    XML_COMBINED_VERSION = rffi_platform.ConstantInteger('XML_COMBINED_VERSION')
+    XML_MAJOR_VERSION = rffi_platform.ConstantInteger('XML_MAJOR_VERSION')
+    XML_MINOR_VERSION = rffi_platform.ConstantInteger('XML_MINOR_VERSION')
+    XML_MICRO_VERSION = rffi_platform.ConstantInteger('XML_MICRO_VERSION')
     XML_FALSE = rffi_platform.ConstantInteger('XML_FALSE')
     XML_TRUE = rffi_platform.ConstantInteger('XML_TRUE')
 
 for k, v in rffi_platform.configure(CConfigure).items():
     globals()[k] = v
 
+XML_COMBINED_VERSION = 10000*XML_MAJOR_VERSION+100*XML_MINOR_VERSION+XML_MICRO_VERSION
+
 XML_Content_Ptr.TO.become(rffi.CArray(XML_Content))
 XML_Encoding_Ptr = lltype.Ptr(XML_Encoding)
 
@@ -181,8 +181,8 @@
     if name in ['ExternalEntityRefHandler',
                 'NotStandaloneHandler']:
         result_type = rffi.INT
-        result_converter = "space.int_w(w_result)"
-        result_error = "0"
+        result_converter = "rffi.cast(rffi.INT, space.int_w(w_result))"
+        result_error = "rffi.cast(rffi.INT, 0)"
     else:
         result_type = lltype.Void
         result_converter = "None"
@@ -313,6 +313,18 @@
     'XML_ExternalEntityParserCreate', [XML_Parser, rffi.CCHARP, rffi.CCHARP],
     XML_Parser)
 
+XML_ExpatVersion = expat_external(
+    'XML_ExpatVersion', [], rffi.CCHARP)
+
+def get_expat_version(space):
+    return space.wrap(rffi.charp2str(XML_ExpatVersion()))
+
+def get_expat_version_info(space):
+    return space.newtuple([
+        space.wrap(XML_MAJOR_VERSION),
+        space.wrap(XML_MINOR_VERSION),
+        space.wrap(XML_MICRO_VERSION)])
+
 class W_XMLParserType(Wrappable):
 
     def __init__(self, space, parser, w_intern):
@@ -583,10 +595,11 @@
         msg = "%s: line %d, column %d" % (err, lineno, colno)
         w_module = space.getbuiltinmodule('pyexpat')
         w_errorcls = space.getattr(w_module, space.wrap('error'))
-        w_error = space.call_function(
-            w_errorcls,
-            space.wrap(msg), space.wrap(code),
-            space.wrap(colno), space.wrap(lineno))
+        w_error = space.call_function(w_errorcls, space.wrap(msg))
+        space.setattr(w_error, space.wrap("code"), space.wrap(code))
+        space.setattr(w_error, space.wrap("offset"), space.wrap(colno))
+        space.setattr(w_error, space.wrap("lineno"), space.wrap(lineno))
+
         self.w_error = w_error
         return OperationError(w_errorcls, w_error)
 

diff --git a/pypy/module/readline/test/test_with_pypy.py b/pypy/module/readline/test/test_with_pypy.py
deleted file mode 100644
--- a/pypy/module/readline/test/test_with_pypy.py
+++ /dev/null
@@ -1,27 +0,0 @@
-"""
-Test the readline library on top of PyPy.  The following tests run
-in the PyPy interpreter, itself running on top of CPython
-"""
-
-import py
-from pypy.conftest import gettestobjspace
-from pypy.rpython.tool import rffi_platform as platform
-
-try:
-    from pypy.module.readline import c_readline
-except platform.CompilationError, e:
-    py.test.skip(e)
-
-
-class AppTestReadline:
-
-    def setup_class(cls):
-        # enable usage of the readline mixedmodule
-        space = gettestobjspace(usemodules=('readline',))
-        cls.space = space
-
-    def test_basic_import(self):
-        # this is interpreted by PyPy
-        import readline 
-        readline.readline
-        # XXX test more

diff --git a/pypy/rlib/rmmap.py b/pypy/rlib/rmmap.py
--- a/pypy/rlib/rmmap.py
+++ b/pypy/rlib/rmmap.py
@@ -21,7 +21,11 @@
 
 class RTypeError(Exception):
     def __init__(self, message):
-        self.message = message    
+        self.message = message
+
+class ROverflowError(Exception):
+    def __init__(self, message):
+        self.message = message
 
 includes = ["sys/types.h"]
 if _POSIX:
@@ -39,8 +43,6 @@
     )
     size_t = rffi_platform.SimpleType("size_t", rffi.LONG)
     off_t = rffi_platform.SimpleType("off_t", rffi.LONG)
-    if _MS_WINDOWS:
-        LPSECURITY_ATTRIBUTES = rffi_platform.SimpleType("LPSECURITY_ATTRIBUTES", rffi.CCHARP)
 
 constants = {}
 if _POSIX:
@@ -71,6 +73,8 @@
     for name in constant_names:
         setattr(CConfig, name, rffi_platform.ConstantInteger(name))
 
+    from pypy.rlib import rwin32
+
     from pypy.rlib.rwin32 import HANDLE, LPHANDLE
     from pypy.rlib.rwin32 import NULL_HANDLE, INVALID_HANDLE_VALUE
     from pypy.rlib.rwin32 import DWORD, WORD, DWORD_PTR, LPDWORD
@@ -128,9 +132,6 @@
     _, _get_page_size = external('getpagesize', [], rffi.INT)
     _get_allocation_granularity = _get_page_size
 
-    def _get_error_no():
-        return rposix.get_errno()
-
 elif _MS_WINDOWS:
 
     class ComplexCConfig:
@@ -167,13 +168,6 @@
                 ("wProcessorRevision", WORD),
             ])
 
-        SECURITY_ATTRIBUTES = rffi_platform.Struct(
-            'SECURITY_ATTRIBUTES', [
-                ("nLength", DWORD),
-                ("lpSecurityDescriptor", LPVOID),
-                ("bInheritHandle", BOOL),
-            ])
-
     config = rffi_platform.configure(ComplexCConfig)
     SYSTEM_INFO = config['SYSTEM_INFO']
     SYSTEM_INFO_P = lltype.Ptr(SYSTEM_INFO)
@@ -182,18 +176,12 @@
     GetFileSize = winexternal('GetFileSize', [HANDLE, LPDWORD], DWORD)
     GetCurrentProcess = winexternal('GetCurrentProcess', [], HANDLE)
     DuplicateHandle = winexternal('DuplicateHandle', [HANDLE, HANDLE, HANDLE, LPHANDLE, DWORD, BOOL, DWORD], BOOL)
-    CreateFileMapping = winexternal('CreateFileMappingA', [HANDLE, LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCSTR], HANDLE)
+    CreateFileMapping = winexternal('CreateFileMappingA', [HANDLE, rwin32.LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCSTR], HANDLE)
     MapViewOfFile = winexternal('MapViewOfFile', [HANDLE, DWORD, DWORD, DWORD, SIZE_T], LPCSTR)##!!LPVOID)
-    CloseHandle = winexternal('CloseHandle', [HANDLE], BOOL)
     UnmapViewOfFile = winexternal('UnmapViewOfFile', [LPCVOID], BOOL)
     FlushViewOfFile = winexternal('FlushViewOfFile', [LPCVOID, SIZE_T], BOOL)
     SetFilePointer = winexternal('SetFilePointer', [HANDLE, LONG, PLONG, DWORD], DWORD)
     SetEndOfFile = winexternal('SetEndOfFile', [HANDLE], BOOL)
-    ##_get_osfhandle = winexternal('_get_osfhandle', [INT], LONG)
-    # casting from int to handle did not work, so I changed this
-    # but it should not be so!
-    _get_osfhandle = winexternal('_get_osfhandle', [INT], rffi.INTPTR_T)
-    GetLastError = winexternal('GetLastError', [], DWORD)
     VirtualAlloc = winexternal('VirtualAlloc',
                                [rffi.VOIDP, rffi.SIZE_T, DWORD, DWORD],
                                rffi.VOIDP)
@@ -240,19 +228,14 @@
             # low might just happen to have the value INVALID_FILE_SIZE
             # so we need to check the last error also
             INVALID_FILE_SIZE = -1
-            NO_ERROR = 0
-            dwErr = GetLastError()
-            err = rffi.cast(lltype.Signed, dwErr)
-            if low == INVALID_FILE_SIZE and err != NO_ERROR:
-                msg = os.strerror(err)
-                raise OSError(err, msg)
+            if low == INVALID_FILE_SIZE:
+                err = rwin32.GetLastError()
+                if err:
+                    raise WindowsError(err, "mmap")
             return low, high
         finally:
             lltype.free(high_ref, flavor='raw')
 
-    def _get_error_no():
-        return rffi.cast(lltype.Signed, GetLastError())
-
     INVALID_HANDLE = INVALID_HANDLE_VALUE
 
 PAGESIZE = _get_page_size()
@@ -261,10 +244,11 @@
 NODATA = lltype.nullptr(PTR.TO)
 
 class MMap(object):
-    def __init__(self, access):
+    def __init__(self, access, offset):
         self.size = 0
         self.pos = 0
         self.access = access
+        self.offset = offset
 
         if _MS_WINDOWS:
             self.map_handle = NULL_HANDLE
@@ -303,10 +287,10 @@
                 self.unmapview()
                 self.setdata(NODATA, 0)
             if self.map_handle != INVALID_HANDLE:
-                CloseHandle(self.map_handle)
+                rwin32.CloseHandle(self.map_handle)
                 self.map_handle = INVALID_HANDLE
             if self.file_handle != INVALID_HANDLE:
-                CloseHandle(self.file_handle)
+                rwin32.CloseHandle(self.file_handle)
                 self.file_handle = INVALID_HANDLE
         elif _POSIX:
             self.closed = True
@@ -365,7 +349,7 @@
         self.pos += len(res)
         return res
 
-    def find(self, tofind, start=0):
+    def find(self, tofind, start, end, reverse=False):
         self.check_valid()
 
         # XXX naive! how can we reuse the rstr algorithm?
@@ -373,16 +357,39 @@
             start += self.size
             if start < 0:
                 start = 0
+        if end < 0:
+            end += self.size
+            if end < 0:
+                end = 0
+        elif end > self.size:
+            end = self.size
+        #
+        upto = end - len(tofind)
+        if not reverse:
+            step = 1
+            p = start
+            if p > upto:
+                return -1      # failure (empty range to search)
+        else:
+            step = -1
+            p = upto
+            upto = start
+            if p < upto:
+                return -1      # failure (empty range to search)
+        #
         data = self.data
-        for p in xrange(start, self.size - len(tofind) + 1):
+        while True:
+            assert p >= 0
             for q in range(len(tofind)):
                 if data[p+q] != tofind[q]:
                     break     # position 'p' is not a match
             else:
                 # full match
                 return p
-        # failure
-        return -1
+            #
+            if p == upto:
+                return -1   # failure
+            p += step
 
     def seek(self, pos, whence=0):
         self.check_valid()
@@ -482,7 +489,7 @@
 ##                    new_size = size + value & (PAGESIZE - 1)
                 res = c_msync(start, size, MS_SYNC)
                 if res == -1:
-                    errno = _get_error_no()
+                    errno = rposix.get_errno()
                     raise OSError(errno, os.strerror(errno))
         
         return 0
@@ -511,7 +518,7 @@
                 raise OSError(-11111, "No mremap available")
             
             # resize the underlying file first
-            os.ftruncate(self.fd, newsize)
+            os.ftruncate(self.fd, self.offset + newsize)
                 
             # now resize the mmap
             newdata = c_mremap(self.getptr(0), self.size, newsize,
@@ -520,15 +527,19 @@
         elif _MS_WINDOWS:
             # disconnect the mapping
             self.unmapview()
-            CloseHandle(self.map_handle)
+            rwin32.CloseHandle(self.map_handle)
 
             # move to the desired EOF position
             if _64BIT:
-                newsize_high = newsize >> 32
-                newsize_low = newsize & 0xFFFFFFFF
+                newsize_high = (self.offset + newsize) >> 32
+                newsize_low = (self.offset + newsize) & 0xFFFFFFFF
+                offset_high = self.offset >> 32
+                offset_low = self.offset & 0xFFFFFFFF
             else:
                 newsize_high = 0
-                newsize_low = newsize
+                newsize_low = self.offset + newsize
+                offset_high = 0
+                offset_low = self.offset
 
             FILE_BEGIN = 0
             high_ref = lltype.malloc(PLONG.TO, 1, flavor='raw')
@@ -548,19 +559,14 @@
             dwErrCode = 0
             if self.map_handle:
                 data = MapViewOfFile(self.map_handle, FILE_MAP_WRITE,
-                                     0, 0, 0)
+                                     offset_high, offset_low, newsize)
                 if data:
                     # XXX we should have a real LPVOID which must always be casted
                     charp = rffi.cast(LPCSTR, data)
                     self.setdata(charp, newsize)
                     return
-                else:
-                    dwErrCode = GetLastError()
-            else:
-                dwErrCode = GetLastError()
-            err = rffi.cast(lltype.Signed, dwErrCode)
-            raise OSError(err, os.strerror(err))
-    
+            raise rwin32.lastWindowsError()
+
     def len(self):
         self.check_valid()
         
@@ -588,23 +594,25 @@
     if size < 0:
         raise RTypeError("memory mapped size must be positive")
     if rffi.cast(size_t, size) != size:
-        raise OverflowError("memory mapped size is too large (limited by C int)")
+        raise ROverflowError("memory mapped size is too large (limited by C int)")
 
 if _POSIX:
     def mmap(fileno, length, flags=MAP_SHARED,
-        prot=PROT_WRITE | PROT_READ, access=_ACCESS_DEFAULT):
+        prot=PROT_WRITE | PROT_READ, access=_ACCESS_DEFAULT, offset=0):
 
         fd = fileno
 
-        # check size boundaries
-        _check_map_size(length)
-        map_size = length
-
         # check access is not there when flags and prot are there
         if access != _ACCESS_DEFAULT and ((flags != MAP_SHARED) or\
                                           (prot != (PROT_WRITE | PROT_READ))):
             raise RValueError("mmap can't specify both access and flags, prot.")
 
+        # check size boundaries
+        _check_map_size(length)
+        map_size = length
+        if offset < 0:
+            raise RValueError("negative offset")
+
         if access == ACCESS_READ:
             flags = MAP_SHARED
             prot = PROT_READ
@@ -630,6 +638,7 @@
         else:
             mode = st[stat.ST_MODE]
             size = st[stat.ST_SIZE]
+            size -= offset
             if size > sys.maxint:
                 size = sys.maxint
             else:
@@ -640,7 +649,7 @@
                 elif map_size > size:
                     raise RValueError("mmap length is greater than file size")
 
-        m = MMap(access)
+        m = MMap(access, offset)
         if fd == -1:
             # Assume the caller wants to map anonymous memory.
             # This is the same behaviour as Windows.  mmap.mmap(-1, size)
@@ -655,9 +664,9 @@
         # XXX if we use hintp below in alloc, the NonConstant
         #     is necessary since we want a general version of c_mmap
         #     to be annotated with a non-constant pointer.
-        res = c_mmap(NonConstant(NULL), map_size, prot, flags, fd, 0)
+        res = c_mmap(NonConstant(NULL), map_size, prot, flags, fd, offset)
         if res == rffi.cast(PTR, -1):
-            errno = _get_error_no()
+            errno = rposix.get_errno()
             raise OSError(errno, os.strerror(errno))
         
         m.setdata(res, map_size)
@@ -692,10 +701,12 @@
     free = c_munmap_safe
     
 elif _MS_WINDOWS:
-    def mmap(fileno, length, tagname="", access=_ACCESS_DEFAULT):
+    def mmap(fileno, length, tagname="", access=_ACCESS_DEFAULT, offset=0):
         # check size boundaries
         _check_map_size(length)
         map_size = length
+        if offset < 0:
+            raise RValueError("negative offset")
         
         flProtect = 0
         dwDesiredAccess = 0
@@ -716,16 +727,15 @@
         # assume -1 and 0 both mean invalid file descriptor
         # to 'anonymously' map memory.
         if fileno != -1 and fileno != 0:
-            res = _get_osfhandle(fileno)
-            if res == rffi.cast(rffi.SSIZE_T, INVALID_HANDLE):
-                errno = _get_error_no()
+            fh = rwin32._get_osfhandle(fileno)
+            if fh == INVALID_HANDLE:
+                errno = rposix.get_errno()
                 raise OSError(errno, os.strerror(errno))
-            fh = rffi.cast(HANDLE, res)
             # Win9x appears to need us seeked to zero
             # SEEK_SET = 0
             # libc._lseek(fileno, 0, SEEK_SET)
         
-        m = MMap(access)
+        m = MMap(access, offset)
         m.file_handle = INVALID_HANDLE
         m.map_handle = INVALID_HANDLE
         if fh:
@@ -742,8 +752,7 @@
                                       False, # inherited by child procs?
                                       DUPLICATE_SAME_ACCESS) # options
                 if not res:
-                    errno = _get_error_no()
-                    raise OSError(errno, os.strerror(errno))
+                    raise rwin32.lastWindowsError()
                 m.file_handle = handle_ref[0]
             finally:
                 lltype.free(handle_ref, flavor='raw')
@@ -764,31 +773,29 @@
         
         # DWORD is a 4-byte int. If int > 4-byte it must be divided
         if _64BIT:
-            size_hi = map_size >> 32
-            size_lo = map_size & 0xFFFFFFFF
+            size_hi = (map_size + offset) >> 32
+            size_lo = (map_size + offset) & 0xFFFFFFFF
+            offset_hi = offset >> 32
+            offset_lo = offset & 0xFFFFFFFF
         else:
             size_hi = 0
-            size_lo = map_size
+            size_lo = map_size + offset
+            offset_hi = 0
+            offset_lo = offset
 
         m.map_handle = CreateFileMapping(m.file_handle, NULL, flProtect,
                                          size_hi, size_lo, m.tagname)
 
         if m.map_handle:
-            res = MapViewOfFile(m.map_handle, dwDesiredAccess,
-                                0, 0, 0)
-            if res:
+            data = MapViewOfFile(m.map_handle, dwDesiredAccess,
+                                 offset_hi, offset_lo, 0)
+            if data:
                 # XXX we should have a real LPVOID which must always be casted
-                charp = rffi.cast(LPCSTR, res)
+                charp = rffi.cast(LPCSTR, data)
                 m.setdata(charp, map_size)
                 return m
-            else:
-                dwErr = GetLastError()
-        else:
-            dwErr = GetLastError()
-        err = rffi.cast(lltype.Signed, dwErr)
-        raise OSError(err, os.strerror(err))
+        raise rwin32.lastWindowsError()
 
-    
     def alloc(map_size):
         """Allocate memory.  This is intended to be used by the JIT,
         so the memory has the executable bit set.  

diff --git a/pypy/rpython/lltypesystem/opimpl.py b/pypy/rpython/lltypesystem/opimpl.py
--- a/pypy/rpython/lltypesystem/opimpl.py
+++ b/pypy/rpython/lltypesystem/opimpl.py
@@ -271,6 +271,36 @@
         r -= y
     return r
 
+def op_uint_lshift(x, y):
+    assert isinstance(x, r_uint)
+    assert isinstance(y, int)
+    return r_uint(x << y)
+
+def op_uint_rshift(x, y):
+    assert isinstance(x, r_uint)
+    assert isinstance(y, int)
+    return r_uint(x >> y)
+
+def op_llong_lshift(x, y):
+    assert isinstance(x, r_longlong_arg)
+    assert isinstance(y, int)
+    return r_longlong_result(x << y)
+
+def op_llong_rshift(x, y):
+    assert isinstance(x, r_longlong_arg)
+    assert isinstance(y, int)
+    return r_longlong_result(x >> y)
+
+def op_ullong_lshift(x, y):
+    assert isinstance(x, r_ulonglong)
+    assert isinstance(y, int)
+    return r_ulonglong(x << y)
+
+def op_ullong_rshift(x, y):
+    assert isinstance(x, r_ulonglong)
+    assert isinstance(y, int)
+    return r_ulonglong(x >> y)
+
 def op_same_as(x):
     return x
 

diff --git a/pypy/rpython/lltypesystem/lloperation.py b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -265,8 +265,8 @@
     'uint_ge':              LLOp(canfold=True),
     'uint_and':             LLOp(canfold=True),
     'uint_or':              LLOp(canfold=True),
-    'uint_lshift':          LLOp(canfold=True),
-    'uint_rshift':          LLOp(canfold=True),
+    'uint_lshift':          LLOp(canfold=True),  # args (r_uint, int)
+    'uint_rshift':          LLOp(canfold=True),  # args (r_uint, int)
     'uint_xor':             LLOp(canfold=True),
 
     'float_is_true':        LLOp(canfold=True),  # it really means "x != 0.0"
@@ -288,9 +288,7 @@
 
     'llong_is_true':        LLOp(canfold=True),
     'llong_neg':            LLOp(canfold=True),
-    'llong_neg_ovf':        LLOp(canraise=(OverflowError,), tryfold=True),
     'llong_abs':            LLOp(canfold=True),
-    'llong_abs_ovf':        LLOp(canraise=(OverflowError,), tryfold=True),
     'llong_invert':         LLOp(canfold=True),
 
     'llong_add':            LLOp(canfold=True),
@@ -308,8 +306,8 @@
     'llong_ge':             LLOp(canfold=True),
     'llong_and':            LLOp(canfold=True),
     'llong_or':             LLOp(canfold=True),
-    'llong_lshift':         LLOp(canfold=True),
-    'llong_rshift':         LLOp(canfold=True),
+    'llong_lshift':         LLOp(canfold=True),  # args (r_longlong, int)
+    'llong_rshift':         LLOp(canfold=True),  # args (r_longlong, int)
     'llong_xor':            LLOp(canfold=True),
 
     'ullong_is_true':       LLOp(canfold=True),
@@ -330,8 +328,8 @@
     'ullong_ge':            LLOp(canfold=True),
     'ullong_and':           LLOp(canfold=True),
     'ullong_or':            LLOp(canfold=True),
-    'ullong_lshift':        LLOp(canfold=True),
-    'ullong_rshift':        LLOp(canfold=True),
+    'ullong_lshift':        LLOp(canfold=True),  # args (r_ulonglong, int)
+    'ullong_rshift':        LLOp(canfold=True),  # args (r_ulonglong, int)
     'ullong_xor':           LLOp(canfold=True),
 
     'cast_primitive':       LLOp(canfold=True),
@@ -470,7 +468,10 @@
                                  # ^^^ but canunwindgc=False, as it is
                                  # allocating non-GC structures only
     'gc_thread_run'       : LLOp(),
+    'gc_thread_start'     : LLOp(),
     'gc_thread_die'       : LLOp(),
+    'gc_thread_before_fork':LLOp(),   # returns an opaque address
+    'gc_thread_after_fork': LLOp(),   # arguments: (result_of_fork, opaqueaddr)
     'gc_assume_young_pointers': LLOp(canrun=True),
     'gc_writebarrier_before_copy': LLOp(canrun=True),
     'gc_heap_stats'       : LLOp(canunwindgc=True),

diff --git a/pypy/module/readline/test/__init__.py b/pypy/module/readline/test/__init__.py
deleted file mode 100644
--- a/pypy/module/readline/test/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-#

diff --git a/pypy/objspace/std/test/helper.py b/pypy/objspace/std/test/helper.py
deleted file mode 100644
--- a/pypy/objspace/std/test/helper.py
+++ /dev/null
@@ -1,69 +0,0 @@
-def raises(excp, func, *args):
-    try:
-        func(*args)
-        assert 1 == 0
-    except excp:pass
-
-def assertEqual(a, b):
-    assert a == b
-
-def assertNotEqual(a, b):
-    assert a != b
-
-def assertIs(a, b):
-    assert a is b
-
-# complex specific tests
-
-EPS = 1e-9
-
-def assertAlmostEqual(a, b):
-    if isinstance(a, complex):
-        if isinstance(b, complex):
-            assert a.real - b.real < EPS
-            assert a.imag - b.imag < EPS
-        else:
-            assert a.real - b < EPS
-            assert a.imag < EPS
-    else:
-        if isinstance(b, complex):
-            assert a - b.real < EPS
-            assert b.imag < EPS
-        else:
-            assert a - b < EPS
-
-def assertCloseAbs(x, y, eps=1e-9):
-    """Return true iff floats x and y "are close\""""
-    # put the one with larger magnitude second
-    if abs(x) > abs(y):
-        x, y = y, x
-    if y == 0:
-        return abs(x) < eps
-    if x == 0:
-        return abs(y) < eps
-    # check that relative difference < eps
-    assert abs((x-y)/y) < eps
-
-def assertClose(x, y, eps=1e-9):
-    """Return true iff complexes x and y "are close\""""
-    assertCloseAbs(x.real, y.real, eps)
-    assertCloseAbs(x.imag, y.imag, eps)
-
-
-def check_div(x, y):
-    """Compute complex z=x*y, and check that z/x==y and z/y==x."""
-    z = x * y
-    if x != 0:
-        q = z / x
-        assertClose(q, y)
-        q = z.__div__(x)
-        assertClose(q, y)
-        q = z.__truediv__(x)
-        assertClose(q, y)
-    if y != 0:
-        q = z / y
-        assertClose(q, x)
-        q = z.__div__(y)
-        assertClose(q, x)
-        q = z.__truediv__(y)
-        assertClose(q, x)

diff --git a/pypy/module/readline/__init__.py b/pypy/module/readline/__init__.py
deleted file mode 100644
--- a/pypy/module/readline/__init__.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# this is a sketch of how one might one day be able to define a pretty simple
-# ctypes-using module, suitable for feeding to the ext-compiler
-
-from pypy.interpreter.mixedmodule import MixedModule
-
-# XXX raw_input needs to check for space.readline_func and use
-# it if its there 
-
-class Module(MixedModule):
-    """Importing this module enables command line editing using GNU readline."""
-    # the above line is the doc string of the translated module  
-
-    def setup_after_space_initialization(self):
-        from pypy.module.readline import c_readline 
-        c_readline.setup_readline(self.space, self)
-
-    interpleveldefs = {
-        'readline'    : 'interp_readline.readline',
-    }
-
-    appleveldefs = {
-        'parse_and_bind':     'app_stub.stub',
-        'get_line_buffer':    'app_stub.stub_str',
-        'insert_text':        'app_stub.stub',
-        'read_init_file':     'app_stub.stub',
-        'read_history_file':  'app_stub.stub',
-        'write_history_file': 'app_stub.stub',
-        'clear_history':      'app_stub.stub',
-        'get_history_length': 'app_stub.stub_int',
-        'set_history_length': 'app_stub.stub',
-        'get_current_history_length': 'app_stub.stub_int',
-        'get_history_item':           'app_stub.stub_str',
-        'remove_history_item':        'app_stub.stub',
-        'replace_history_item':       'app_stub.stub',
-        'redisplay':                  'app_stub.stub',
-        'set_startup_hook':           'app_stub.stub',
-        'set_pre_input_hook':         'app_stub.stub',
-        'set_completer':      'app_stub.stub',
-        'get_completer':      'app_stub.stub',
-        'get_begidx':         'app_stub.stub_int',
-        'get_endidx':         'app_stub.stub_int',
-        'set_completer_delims':       'app_stub.stub',
-        'get_completer_delims':       'app_stub.stub_str',
-        'add_history':        'app_stub.stub',
-    }

diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -22,7 +22,7 @@
 from pypy.objspace.std.floatobject import W_FloatObject
 from pypy.objspace.std.intobject import W_IntObject
 from pypy.objspace.std.listobject import W_ListObject
-from pypy.objspace.std.longobject import W_LongObject
+from pypy.objspace.std.longobject import W_LongObject, newlong
 from pypy.objspace.std.noneobject import W_NoneObject
 from pypy.objspace.std.objectobject import W_ObjectObject
 from pypy.objspace.std.ropeobject import W_RopeObject
@@ -177,6 +177,13 @@
             #print 'wrapping', x, '->', w_result
             return w_result
         if isinstance(x, base_int):
+            if self.config.objspace.std.withsmalllong:
+                from pypy.objspace.std.smalllongobject import W_SmallLongObject
+                from pypy.rlib.rarithmetic import r_longlong, r_ulonglong
+                from pypy.rlib.rarithmetic import longlongmax
+                if (not isinstance(x, r_ulonglong)
+                    or x <= r_ulonglong(longlongmax)):
+                    return W_SmallLongObject(r_longlong(x))
             x = widen(x)
             if isinstance(x, int):
                 return self.newint(x)
@@ -207,6 +214,16 @@
         # The following cases are even stranger.
         # Really really only for tests.
         if type(x) is long:
+            if self.config.objspace.std.withsmalllong:
+                from pypy.rlib.rarithmetic import r_longlong
+                try:
+                    rx = r_longlong(x)
+                except OverflowError:
+                    pass
+                else:
+                    from pypy.objspace.std.smalllongobject import \
+                                                   W_SmallLongObject
+                    return W_SmallLongObject(rx)
             return W_LongObject.fromlong(x)
         if isinstance(x, slice):
             return W_SliceObject(self.wrap(x.start),
@@ -269,10 +286,13 @@
         return unpackcomplex(self, w_complex)
 
     def newlong(self, val): # val is an int
+        if self.config.objspace.std.withsmalllong:
+            from pypy.objspace.std.smalllongobject import W_SmallLongObject
+            return W_SmallLongObject.fromint(val)
         return W_LongObject.fromint(self, val)
 
     def newlong_from_rbigint(self, val):
-        return W_LongObject(val)
+        return newlong(self, val)
 
     def newtuple(self, list_w):
         assert isinstance(list_w, list)

diff --git a/pypy/doc/config/objspace.usemodules.readline.txt b/pypy/doc/config/objspace.usemodules.readline.txt
deleted file mode 100644
--- a/pypy/doc/config/objspace.usemodules.readline.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-Use the 'readline' module. 

diff --git a/pypy/jit/metainterp/resume.py b/pypy/jit/metainterp/resume.py
--- a/pypy/jit/metainterp/resume.py
+++ b/pypy/jit/metainterp/resume.py
@@ -1007,17 +1007,16 @@
             return len(numb.nums)
         index = len(numb.nums) - 1
         virtualizable = self.decode_ref(numb.nums[index])
-        virtualizable = vinfo.cast_gcref_to_vtype(virtualizable)
         if self.resume_after_guard_not_forced == 1:
             # in the middle of handle_async_forcing()
-            assert virtualizable.vable_token
-            virtualizable.vable_token = vinfo.TOKEN_NONE
+            assert vinfo.gettoken(virtualizable)
+            vinfo.settoken(virtualizable, vinfo.TOKEN_NONE)
         else:
             # just jumped away from assembler (case 4 in the comment in
             # virtualizable.py) into tracing (case 2); check that vable_token
             # is and stays 0.  Note the call to reset_vable_token() in
             # warmstate.py.
-            assert not virtualizable.vable_token
+            assert not vinfo.gettoken(virtualizable)
         return vinfo.write_from_resume_data_partial(virtualizable, self, numb)
 
     def load_value_of_type(self, TYPE, tagged):
@@ -1158,7 +1157,7 @@
     def decode_float(self, tagged):
         num, tag = untag(tagged)
         if tag == TAGCONST:
-            return self.consts[num].getfloat()
+            return self.consts[num].getfloatstorage()
         else:
             assert tag == TAGBOX
             if num < 0:

diff --git a/pypy/module/readline/interp_readline.py b/pypy/module/readline/interp_readline.py
deleted file mode 100644
--- a/pypy/module/readline/interp_readline.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# this is a sketch of how one might one day be able to define a pretty simple
-# ctypes-using module, suitable for feeding to the ext-compiler
-
-from pypy.interpreter.baseobjspace import ObjSpace
-
-from pypy.module.readline import c_readline
-from pypy.rpython.lltypesystem import rffi
-
-#------------------------------------------------------------
-# exported API  (see interpleveldefs in __init__.py) 
-#
-def readline(space, prompt):
-    return space.wrap(rffi.charp2str(c_readline.c_readline(prompt)))
-readline.unwrap_spec = [ObjSpace, str]
-
-def setcompleter(space, w_callback):
-    """Set or remove the completer function.
-    The function is called as function(text, state),
-    for state in 0, 1, 2, ..., until it returns a non-string.
-    It should return the next possible completion starting with 'text'.
-    """ 
-    # XXX set internal completion function 
-    

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -4,6 +4,7 @@
 from pypy.config.config import OptionDescription, BoolOption, IntOption, ArbitraryOption
 from pypy.config.config import ChoiceOption, StrOption, to_optparse, Config
 from pypy.config.config import ConflictConfigError
+from pypy.config.translationoption import IS_64_BITS
 
 modulepath = py.path.local(__file__).dirpath().dirpath().join("module")
 all_modules = [p.basename for p in modulepath.listdir()
@@ -26,7 +27,7 @@
 # --allworkingmodules
 working_modules = default_modules.copy()
 working_modules.update(dict.fromkeys(
-    ["_socket", "unicodedata", "mmap", "fcntl",
+    ["_socket", "unicodedata", "mmap", "fcntl", "_locale",
      "rctime" , "select", "zipimport", "_lsprof",
      "crypt", "signal", "_rawffi", "termios", "zlib", "bz2",
      "struct", "_hashlib", "_md5", "_sha", "_minimal_curses", "cStringIO",
@@ -91,6 +92,7 @@
     "bz2"       : ["pypy.module.bz2.interp_bz2"],
     "pyexpat"   : ["pypy.module.pyexpat.interp_pyexpat"],
     "_ssl"      : ["pypy.module._ssl.interp_ssl"],
+    "_hashlib"  : ["pypy.module._ssl.interp_ssl"],
     "_minimal_curses": ["pypy.module._minimal_curses.fficurses"],
     }
 
@@ -164,7 +166,7 @@
                suggests=[("objspace.allworkingmodules", False)]),
 
     BoolOption("geninterp", "specify whether geninterp should be used",
-               default=True),
+               default=False),
 
     BoolOption("logbytecodes",
                "keep track of bytecode usage",
@@ -212,6 +214,11 @@
         IntOption("prebuiltintto", "highest integer which is prebuilt",
                   default=100, cmdline="--prebuiltintto"),
 
+        BoolOption("withsmalllong", "use a version of 'long' in a C long long",
+                   default=False,
+                   requires=[("objspace.std.withsmallint", False)]),
+                             #  ^^^ because of missing delegate_xx2yy
+
         BoolOption("withstrjoin", "use strings optimized for addition",
                    default=False),
 
@@ -345,6 +352,8 @@
         config.objspace.std.suggest(optimized_list_getitem=True)
         config.objspace.std.suggest(getattributeshortcut=True)
         config.objspace.std.suggest(newshortcut=True)        
+        if not IS_64_BITS:
+            config.objspace.std.suggest(withsmalllong=True)
 
     # extra costly optimizations only go in level 3
     if level == '3':
@@ -360,6 +369,8 @@
         config.objspace.std.suggest(withmapdict=True)
         config.objspace.std.suggest(withstrslice=True)
         config.objspace.std.suggest(withstrjoin=True)
+        if not IS_64_BITS:
+            config.objspace.std.suggest(withsmalllong=True)
         # xxx other options? ropes maybe?
 
     # completely disable geninterp in a level 0 translation


More information about the Pypy-commit mailing list