[pypy-svn] pypy arm-backend-2: merge default

bivab commits-noreply at bitbucket.org
Wed Feb 16 11:27:11 CET 2011


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r42031:0aaf135fc111
Date: 2011-02-15 19:00 +0100
http://bitbucket.org/pypy/pypy/changeset/0aaf135fc111/

Log:	merge default

diff --git a/pypy/jit/backend/x86/test/test_runner.py b/pypy/jit/backend/x86/test/test_runner.py
--- a/pypy/jit/backend/x86/test/test_runner.py
+++ b/pypy/jit/backend/x86/test/test_runner.py
@@ -390,18 +390,6 @@
         res = self.cpu.get_latest_value_int(0)
         assert res == 20
 
-    def test_call_with_const_floats(self):
-        def func(f1, f2):
-            return f1 + f2
-
-        FUNC = self.FuncType([lltype.Float, lltype.Float], lltype.Float)
-        FPTR = self.Ptr(FUNC)
-        calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
-        func_ptr = llhelper(FPTR, func)
-        funcbox = self.get_funcbox(self.cpu, func_ptr)
-        res = self.execute_operation(rop.CALL, [funcbox, ConstFloat(1.5), ConstFloat(2.5)], 'float', descr=calldescr)
-        assert res.value == 4.0
-
 
 class TestDebuggingAssembler(object):
     def setup_method(self, meth):

diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -1,3 +1,4 @@
+import weakref
 from pypy.rlib import jit, objectmodel, debug
 from pypy.rlib.rarithmetic import intmask, r_uint
 
@@ -672,7 +673,6 @@
 # Magic caching
 
 class CacheEntry(object):
-    map = None
     version_tag = None
     index = 0
     w_method = None # for callmethod
@@ -683,8 +683,10 @@
         map = w_obj._get_mapdict_map()
         return self.is_valid_for_map(map)
 
+    @jit.dont_look_inside
     def is_valid_for_map(self, map):
-        if map is self.map:
+        mymap = self.map_wref()
+        if mymap is map:     # also handles the case self.map_wref()->None
             version_tag = map.terminator.w_cls.version_tag()
             if version_tag is self.version_tag:
                 # everything matches, it's incredibly fast
@@ -693,22 +695,23 @@
                 return True
         return False
 
+_invalid_cache_entry_map = objectmodel.instantiate(AbstractAttribute)
+_invalid_cache_entry_map.terminator = None
 INVALID_CACHE_ENTRY = CacheEntry()
-INVALID_CACHE_ENTRY.map = objectmodel.instantiate(AbstractAttribute)
-                             # different from any real map ^^^
-INVALID_CACHE_ENTRY.map.terminator = None
-
+INVALID_CACHE_ENTRY.map_wref = weakref.ref(_invalid_cache_entry_map)
+                                 # different from any real map ^^^
 
 def init_mapdict_cache(pycode):
     num_entries = len(pycode.co_names_w)
     pycode._mapdict_caches = [INVALID_CACHE_ENTRY] * num_entries
 
+ at jit.dont_look_inside
 def _fill_cache(pycode, nameindex, map, version_tag, index, w_method=None):
     entry = pycode._mapdict_caches[nameindex]
     if entry is INVALID_CACHE_ENTRY:
         entry = CacheEntry()
         pycode._mapdict_caches[nameindex] = entry
-    entry.map = map
+    entry.map_wref = weakref.ref(map)
     entry.version_tag = version_tag
     entry.index = index
     entry.w_method = w_method

diff --git a/pypy/translator/goal/app_main.py b/pypy/translator/goal/app_main.py
--- a/pypy/translator/goal/app_main.py
+++ b/pypy/translator/goal/app_main.py
@@ -404,6 +404,9 @@
     # (relevant in case of "reload(sys)")
     sys.argv[:] = argv
 
+    if (PYTHON26 and not options["ignore_environment"] and os.getenv('PYTHONNOUSERSITE')):
+        options["no_user_site"] = True
+
     if (options["interactive"] or
         (not options["ignore_environment"] and os.getenv('PYTHONINSPECT'))):
         options["inspect"] = True
@@ -504,10 +507,8 @@
             success = run_toplevel(run_it)
         elif run_module:
             # handle the "-m" command
-            def run_it():
-                import runpy
-                runpy._run_module_as_main(sys.argv[0])
-            success = run_toplevel(run_it)
+            import runpy
+            success = run_toplevel(runpy._run_module_as_main, sys.argv[0])
         elif run_stdin:
             # handle the case where no command/filename/module is specified
             # on the command-line.
@@ -550,10 +551,32 @@
         else:
             # handle the common case where a filename is specified
             # on the command-line.
-            mainmodule.__file__ = sys.argv[0]
-            scriptdir = resolvedirof(sys.argv[0])
-            sys.path.insert(0, scriptdir)
-            success = run_toplevel(execfile, sys.argv[0], mainmodule.__dict__)
+            filename = sys.argv[0]
+            mainmodule.__file__ = filename
+            sys.path.insert(0, resolvedirof(filename))
+            # assume it's a pyc file only if its name says so.
+            # CPython goes to great lengths to detect other cases
+            # of pyc file format, but I think it's ok not to care.
+            import imp
+            if IS_WINDOWS:
+                filename = filename.lower()
+            if filename.endswith('.pyc') or filename.endswith('.pyo'):
+                args = (imp._run_compiled_module, '__main__',
+                        sys.argv[0], None, mainmodule)
+            else:
+                # maybe it's the name of a directory or a zip file
+                filename = sys.argv[0]
+                importer = imp._getimporter(filename)
+                if not isinstance(importer, imp.NullImporter):
+                    # yes.  put the filename in sys.path[0] and import
+                    # the module __main__
+                    import runpy
+                    sys.path.insert(0, filename)
+                    args = (runpy._run_module_as_main, '__main__')
+                else:
+                    # no.  That's the normal path, "pypy stuff.py".
+                    args = (execfile, filename, mainmodule.__dict__)
+            success = run_toplevel(*args)
 
     except SystemExit, e:
         status = e.code
@@ -623,6 +646,27 @@
         except OSError:
             return None
 
+    # add an emulator for these pypy-only or 2.7-only functions
+    # (for test_pyc_commandline_argument)
+    import imp, runpy
+    def _run_compiled_module(modulename, filename, file, module):
+        import os
+        assert modulename == '__main__'
+        assert os.path.isfile(filename)
+        assert filename.endswith('.pyc')
+        assert file is None
+        assert module.__name__ == '__main__'
+        print 'in _run_compiled_module'
+    def _getimporter(path):
+        import os, imp
+        if os.path.isdir(path):
+            return None
+        else:
+            return imp.NullImporter(path)
+
+    imp._run_compiled_module = _run_compiled_module
+    imp._getimporter = _getimporter
+
     # stick the current sys.path into $PYTHONPATH, so that CPython still
     # finds its own extension modules :-/
     import os

diff --git a/pypy/translator/goal/test2/test_app_main.py b/pypy/translator/goal/test2/test_app_main.py
--- a/pypy/translator/goal/test2/test_app_main.py
+++ b/pypy/translator/goal/test2/test_app_main.py
@@ -3,7 +3,7 @@
 """
 from __future__ import with_statement
 import py
-import sys, os, re
+import sys, os, re, runpy
 import autopath
 from pypy.tool.udir import udir
 from contextlib import contextmanager
@@ -14,14 +14,43 @@
 app_main = os.path.abspath(app_main)
 
 _counter = 0
+def _get_next_path(ext='.py'):
+    global _counter
+    p = udir.join('demo_test_app_main_%d%s' % (_counter, ext))
+    _counter += 1
+    return p
+
 def getscript(source):
-    global _counter
-    p = udir.join('demo_test_app_main_%d.py' % (_counter,))
-    _counter += 1
+    p = _get_next_path()
     p.write(str(py.code.Source(source)))
     # return relative path for testing purposes 
     return py.path.local().bestrelpath(p) 
 
+def getscript_pyc(space, source):
+    p = _get_next_path()
+    p.write(str(py.code.Source(source)))
+    w_dir = space.wrap(str(p.dirpath()))
+    w_modname = space.wrap(p.purebasename)
+    space.appexec([w_dir, w_modname], """(dir, modname):
+        import sys
+        d = sys.modules.copy()
+        sys.path.insert(0, dir)
+        __import__(modname)
+        sys.path.pop(0)
+        for key in sys.modules.keys():
+            if key not in d:
+                del sys.modules[key]
+    """)
+    p = str(p) + 'c'
+    assert os.path.isfile(p)   # the .pyc file should have been created above
+    return p
+
+def getscript_in_dir(source):
+    pdir = _get_next_path(ext='')
+    p = pdir.ensure(dir=1).join('__main__.py')
+    p.write(str(py.code.Source(source)))
+    # return relative path for testing purposes 
+    return py.path.local().bestrelpath(pdir)
 
 demo_script = getscript("""
     print 'hello'
@@ -159,6 +188,11 @@
             self.check([opt, '-c', 'pass'], sys_argv=['-c'],
                        run_command='pass', **expected)
 
+    def test_sysflags_envvar(self, monkeypatch):
+        monkeypatch.setenv('PYTHONNOUSERSITE', '1')
+        expected = {"no_user_site": True}
+        self.check(['-c', 'pass'], sys_argv=['-c'], run_command='pass', **expected)
+        
 
 class TestInteraction:
     """
@@ -381,6 +415,8 @@
     def test_options_i_m(self):
         if sys.platform == "win32":
             skip("close_fds is not supported on Windows platforms")
+        if not hasattr(runpy, '_run_module_as_main'):
+            skip("requires CPython >= 2.6")
         p = os.path.join(autopath.this_dir, 'mymodule.py')
         p = os.path.abspath(p)
         child = self.spawn(['-i',
@@ -481,6 +517,8 @@
         child.expect('A five ounce bird could not carry a one pound coconut.')
 
     def test_no_space_before_argument(self):
+        if not hasattr(runpy, '_run_module_as_main'):
+            skip("requires CPython >= 2.6")
         child = self.spawn(['-cprint "hel" + "lo"'])
         child.expect('hello')
 
@@ -578,6 +616,8 @@
             os.environ['PYTHONWARNINGS'] = old
 
     def test_option_m(self):
+        if not hasattr(runpy, '_run_module_as_main'):
+            skip("requires CPython >= 2.6")
         p = os.path.join(autopath.this_dir, 'mymodule.py')
         p = os.path.abspath(p)
         data = self.run('-m pypy.translator.goal.test2.mymodule extra')
@@ -671,6 +711,21 @@
         data = self.run('-c "import sys; print sys.path"')
         assert data.startswith("[''")
 
+    def test_pyc_commandline_argument(self):
+        p = getscript_pyc(self.space, "print 6*7\n")
+        assert os.path.isfile(p) and p.endswith('.pyc')
+        data = self.run(p)
+        assert data == 'in _run_compiled_module\n'
+
+    def test_main_in_dir_commandline_argument(self):
+        if not hasattr(runpy, '_run_module_as_main'):
+            skip("requires CPython >= 2.6")
+        p = getscript_in_dir('print 6*7\n')
+        data = self.run(p)
+        assert data == '42\n'
+        data = self.run(p + os.sep)
+        assert data == '42\n'
+
 
 class AppTestAppMain:
 

diff --git a/pypy/objspace/std/test/test_mapdict.py b/pypy/objspace/std/test/test_mapdict.py
--- a/pypy/objspace/std/test/test_mapdict.py
+++ b/pypy/objspace/std/test/test_mapdict.py
@@ -866,6 +866,38 @@
         res = self.check(f, 'm')
         assert res == (0, 2, 1)
 
+    def test_dont_keep_class_alive(self):
+        import weakref
+        import gc
+        def f():
+            class C(object):
+                def m(self):
+                    pass
+            r = weakref.ref(C)
+            # Trigger cache.
+            C().m()
+            del C
+            gc.collect(); gc.collect(); gc.collect()
+            assert r() is None
+            return 42
+        f()
+
+    def test_instance_keeps_class_alive(self):
+        import weakref
+        import gc
+        def f():
+            class C(object):
+                def m(self):
+                    return 42
+            r = weakref.ref(C)
+            c = C()
+            del C
+            gc.collect(); gc.collect(); gc.collect()
+            return c.m()
+        val = f()
+        assert val == 42
+        f() 
+
 class AppTestGlobalCaching(AppTestWithMapDict):
     def setup_class(cls):
         cls.space = gettestobjspace(

diff --git a/pypy/jit/codewriter/jtransform.py b/pypy/jit/codewriter/jtransform.py
--- a/pypy/jit/codewriter/jtransform.py
+++ b/pypy/jit/codewriter/jtransform.py
@@ -5,7 +5,7 @@
 from pypy.objspace.flow.model import SpaceOperation, Variable, Constant
 from pypy.objspace.flow.model import Block, Link, c_last_exception
 from pypy.jit.codewriter.flatten import ListOfKind, IndirectCallTargets
-from pypy.jit.codewriter import support, heaptracker
+from pypy.jit.codewriter import support, heaptracker, longlong
 from pypy.jit.codewriter.effectinfo import EffectInfo
 from pypy.jit.codewriter.policy import log
 from pypy.jit.metainterp.typesystem import deref, arrayItem
@@ -39,7 +39,6 @@
     def optimize_block(self, block):
         if block.operations == ():
             return
-        self.remove_longlong_constants(block)
         self.vable_array_vars = {}
         self.vable_flags = {}
         renamings = {}
@@ -135,55 +134,6 @@
         block.exits = block.exits[:1]
         block.exitswitch = None
 
-    def remove_longlong_constants(self, block):
-        # remove all Constant({Un}signedLongLong), and replace them with
-        # cast_int_to_longlong(Constant(Signed)) or
-        # two_ints_to_longlong(Constant(Signed), Constant(Signed)).
-        operations = []
-        all_constants = {}
-        #
-        def _get_const_as_var(c):
-            v = all_constants.get(c)
-            if v is None:
-                from pypy.rlib.rarithmetic import intmask
-                v = varoftype(c.concretetype)
-                value = int(c.value)
-                c_hi = Constant(intmask(value >> 32), lltype.Signed)
-                c_lo = Constant(intmask(value), lltype.Signed)
-                if c_lo.value == value:
-                    # a long long constant, but it fits in 32 bits
-                    op1 = SpaceOperation('cast_int_to_longlong', [c_lo], v)
-                else:
-                    # a 64-bit long long constant, requires two ints
-                    op1 = SpaceOperation('two_ints_to_longlong', [c_lo, c_hi],
-                                         v)
-                operations.append(op1)
-                all_constants[c] = v
-            return v
-        #
-        for op in block.operations:
-            for i, v in enumerate(op.args):
-                if (isinstance(v, Constant) and
-                        self._is_longlong(v.concretetype)):
-                    args = op.args[:]
-                    args[i] = _get_const_as_var(v)
-                    op = SpaceOperation(op.opname, args, op.result)
-            operations.append(op)
-        #
-        last_op = None
-        if block.exitswitch == c_last_exception:
-            last_op = operations.pop()
-        for link in block.exits:
-            for i, v in enumerate(link.args):
-                if (isinstance(v, Constant) and
-                        self._is_longlong(v.concretetype)):
-                    args = link.args[:]
-                    args[i] = _get_const_as_var(v)
-                    link.args = args
-        if last_op is not None:
-            operations.append(last_op)
-        block.operations = operations
-
     # ----------
 
     def follow_constant_exit(self, block):
@@ -841,17 +791,6 @@
     # and unsupported ones are turned into a call to a function from
     # jit.codewriter.support.
 
-    if lltype.SignedLongLong != lltype.Signed:
-        @staticmethod
-        def _is_longlong(TYPE):
-            return (TYPE == lltype.SignedLongLong or
-                    TYPE == lltype.UnsignedLongLong)
-    else:
-        # on 64-bit, _is_longlong() returns always False
-        @staticmethod
-        def _is_longlong(TYPE):
-            return False
-
     for _op, _oopspec in [('llong_invert',  'INVERT'),
                           ('ullong_invert', 'INVERT'),
                           ('llong_lt',      'LT'),
@@ -886,8 +825,7 @@
                           ('truncate_longlong_to_int', 'TO_INT'),
                           ('cast_float_to_longlong',   'FROM_FLOAT'),
                           ('cast_longlong_to_float',   'TO_FLOAT'),
-                          # internal pseuso-operation:
-                          ('two_ints_to_longlong',     'FROM_TWO_INTS'),
+                          ('cast_uint_to_longlong',    'FROM_UINT'),
                           ]:
         exec py.code.Source('''
             def rewrite_op_%s(self, op):
@@ -929,8 +867,8 @@
     rewrite_op_ullong_is_true = rewrite_op_llong_is_true
 
     def rewrite_op_cast_primitive(self, op):
-        fromll = self._is_longlong(op.args[0].concretetype)
-        toll   = self._is_longlong(op.result.concretetype)
+        fromll = longlong.is_longlong(op.args[0].concretetype)
+        toll   = longlong.is_longlong(op.result.concretetype)
         if fromll != toll:
             args = op.args
             if fromll:
@@ -940,9 +878,7 @@
                 if rffi.cast(op.args[0].concretetype, -1) < 0:
                     opname = 'cast_int_to_longlong'
                 else:
-                    opname = 'two_ints_to_longlong'
-                    c_hi = Constant(0, lltype.Signed)
-                    args = [args[0], c_hi]
+                    opname = 'cast_uint_to_longlong'
             op1 = SpaceOperation(opname, args, op.result)
             return self.rewrite_operation(op1)
 

diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py b/pypy/jit/metainterp/optimizeopt/optimizer.py
--- a/pypy/jit/metainterp/optimizeopt/optimizer.py
+++ b/pypy/jit/metainterp/optimizeopt/optimizer.py
@@ -162,7 +162,7 @@
 CONST_0      = ConstInt(0)
 CONST_1      = ConstInt(1)
 CVAL_ZERO    = ConstantValue(CONST_0)
-CVAL_ZERO_FLOAT = ConstantValue(ConstFloat(0.0))
+CVAL_ZERO_FLOAT = ConstantValue(Const._new(0.0))
 CVAL_UNINITIALIZED_ZERO = ConstantValue(CONST_0)
 llhelper.CVAL_NULLREF = ConstantValue(llhelper.CONST_NULL)
 oohelper.CVAL_NULLREF = ConstantValue(oohelper.CONST_NULL)

diff --git a/pypy/jit/metainterp/test/test_basic.py b/pypy/jit/metainterp/test/test_basic.py
--- a/pypy/jit/metainterp/test/test_basic.py
+++ b/pypy/jit/metainterp/test/test_basic.py
@@ -9,6 +9,7 @@
 from pypy.jit.metainterp import pyjitpl, history
 from pypy.jit.metainterp.warmstate import set_future_value
 from pypy.jit.codewriter.policy import JitPolicy, StopAtXPolicy
+from pypy.jit.codewriter import longlong
 from pypy import conftest
 from pypy.rlib.rarithmetic import ovfcheck
 from pypy.jit.metainterp.typesystem import LLTypeHelper, OOTypeHelper
@@ -86,6 +87,7 @@
             blackholeinterp.setarg_r(count_r, value)
             count_r += 1
         elif T == lltype.Float:
+            value = longlong.getfloatstorage(value)
             blackholeinterp.setarg_f(count_f, value)
             count_f += 1
         else:
@@ -192,6 +194,10 @@
         # try to run it by running the code compiled just before
         result3 = _run_with_machine_code(self, args)
         assert result1 == result3 or result3 == NotImplemented
+        #
+        if (longlong.supports_longlong and
+            isinstance(result1, longlong.r_float_storage)):
+            result1 = longlong.getrealfloat(result1)
         return result1
 
     def check_history(self, expected=None, **isns):

diff --git a/pypy/jit/backend/llgraph/runner.py b/pypy/jit/backend/llgraph/runner.py
--- a/pypy/jit/backend/llgraph/runner.py
+++ b/pypy/jit/backend/llgraph/runner.py
@@ -15,7 +15,7 @@
 from pypy.jit.backend import model
 from pypy.jit.backend.llgraph import llimpl, symbolic
 from pypy.jit.metainterp.typesystem import llhelper, oohelper
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 from pypy.rlib import rgc
 
 class MiniStats:
@@ -86,7 +86,7 @@
 
 class BaseCPU(model.AbstractCPU):
     supports_floats = True
-    supports_longlong = True
+    supports_longlong = llimpl.IS_32_BIT
 
     def __init__(self, rtyper, stats=None, opts=None,
                  translate_support_code=False,
@@ -305,8 +305,12 @@
         for ARG in ARGS:
             token = history.getkind(ARG)
             if token != 'void':
+                if token == 'float' and longlong.is_longlong(ARG):
+                    token = 'L'
                 arg_types.append(token[0])
         token = history.getkind(RESULT)
+        if token == 'float' and longlong.is_longlong(RESULT):
+            token = 'L'
         return self.getdescr(0, token[0], extrainfo=extrainfo,
                              arg_types=''.join(arg_types))
 
@@ -464,7 +468,7 @@
         self._prepare_call(REF, calldescr, args_i, args_r, args_f)
         return llimpl.do_call_ptr(func)
     def bh_call_f(self, func, calldescr, args_i, args_r, args_f):
-        self._prepare_call(FLOAT, calldescr, args_i, args_r, args_f)
+        self._prepare_call(FLOAT + 'L', calldescr, args_i, args_r, args_f)
         return llimpl.do_call_float(func)
     def bh_call_v(self, func, calldescr, args_i, args_r, args_f):
         self._prepare_call('v', calldescr, args_i, args_r, args_f)
@@ -472,7 +476,7 @@
 
     def _prepare_call(self, resulttypeinfo, calldescr, args_i, args_r, args_f):
         assert isinstance(calldescr, Descr)
-        assert calldescr.typeinfo == resulttypeinfo
+        assert calldescr.typeinfo in resulttypeinfo
         if args_i is not None:
             for x in args_i:
                 llimpl.do_call_pushint(x)

diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
--- a/pypy/jit/backend/x86/regalloc.py
+++ b/pypy/jit/backend/x86/regalloc.py
@@ -12,7 +12,7 @@
 from pypy.rlib import rgc
 from pypy.jit.backend.llsupport import symbolic
 from pypy.jit.backend.x86.jump import remap_frame_layout
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 from pypy.jit.codewriter.effectinfo import EffectInfo
 from pypy.jit.metainterp.resoperation import rop
 from pypy.jit.backend.llsupport.descr import BaseFieldDescr, BaseArrayDescr
@@ -71,13 +71,16 @@
 
     def convert_to_imm(self, c):
         adr = self.assembler.datablockwrapper.malloc_aligned(8, 8)
-        rffi.cast(rffi.CArrayPtr(rffi.DOUBLE), adr)[0] = c.getfloat()
+        x = c.getfloatstorage()
+        rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), adr)[0] = x
         return ConstFloatLoc(adr)
 
     def convert_to_imm_16bytes_align(self, c):
         adr = self.assembler.datablockwrapper.malloc_aligned(16, 16)
-        rffi.cast(rffi.CArrayPtr(rffi.DOUBLE), adr)[0] = c.getfloat()
-        rffi.cast(rffi.CArrayPtr(rffi.DOUBLE), adr)[1] = 0.0
+        x = c.getfloatstorage()
+        y = longlong.ZEROF
+        rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), adr)[0] = x
+        rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), adr)[1] = y
         return ConstFloatLoc(adr)
 
     def after_call(self, v):
@@ -221,7 +224,7 @@
                              selected_reg=None, need_lower_byte=False):
         if var.type == FLOAT:
             if isinstance(var, ConstFloat):
-                return FloatImmedLoc(var.getfloat())
+                return FloatImmedLoc(var.getfloatstorage())
             return self.xrm.make_sure_var_in_reg(var, forbidden_vars,
                                                  selected_reg, need_lower_byte)
         else:
@@ -630,11 +633,10 @@
 
     def _maybe_consider_llong_lt(self, op):
         # XXX just a special case for now
-        from pypy.rlib.longlong2float import longlong2float
         box = op.getarg(2)
         if not isinstance(box, ConstFloat):
             return False
-        if not (box.value == longlong2float(r_longlong(0))):
+        if box.getlonglong() != 0:
             return False
         # "x < 0"
         box = op.getarg(1)
@@ -653,8 +655,7 @@
         self.xrm.possibly_free_var(op.getarg(1))
 
     def _loc_of_const_longlong(self, value64):
-        from pypy.rlib.longlong2float import longlong2float
-        c = ConstFloat(longlong2float(value64))
+        c = ConstFloat(value64)
         return self.xrm.convert_to_imm(c)
 
     def _consider_llong_from_int(self, op):
@@ -676,36 +677,11 @@
         self.PerformLLong(op, [loc1, loc2], loc0)
         self.rm.possibly_free_var(box)
 
-    def _consider_llong_from_two_ints(self, op):
+    def _consider_llong_from_uint(self, op):
         assert IS_X86_32
-        box1 = op.getarg(1)
-        box2 = op.getarg(2)
         loc0 = self.xrm.force_allocate_reg(op.result)
-        #
-        if isinstance(box1, ConstInt) and isinstance(box2, ConstInt):
-            # all-constant arguments: load the result value in a single step
-            value64 = r_longlong(box2.value) << 32
-            value64 |= r_longlong(r_uint(box1.value))
-            loc1 = self._loc_of_const_longlong(value64)
-            loc2 = None    # unused
-            loc3 = None    # unused
-        #
-        else:
-            tmpxvar = TempBox()
-            loc3 = self.xrm.force_allocate_reg(tmpxvar, [op.result])
-            self.xrm.possibly_free_var(tmpxvar)
-            #
-            if isinstance(box1, ConstInt):
-                loc1 = self._loc_of_const_longlong(r_longlong(box1.value))
-            else:
-                loc1 = self.rm.make_sure_var_in_reg(box1)
-            #
-            if isinstance(box2, ConstInt):
-                loc2 = self._loc_of_const_longlong(r_longlong(box2.value))
-            else:
-                loc2 = self.rm.make_sure_var_in_reg(box2, [box1])
-        #
-        self.PerformLLong(op, [loc1, loc2, loc3], loc0)
+        loc1 = self.rm.make_sure_var_in_reg(op.getarg(1))
+        self.PerformLLong(op, [loc1], loc0)
         self.rm.possibly_free_vars_for_op(op)
 
     def _call(self, op, arglocs, force_store=[], guard_not_forced_op=None):
@@ -755,8 +731,8 @@
                     return self._consider_llong_to_int(op)
                 if oopspecindex == EffectInfo.OS_LLONG_FROM_INT:
                     return self._consider_llong_from_int(op)
-                if oopspecindex == EffectInfo.OS_LLONG_FROM_TWO_INTS:
-                    return self._consider_llong_from_two_ints(op)
+                if oopspecindex == EffectInfo.OS_LLONG_FROM_UINT:
+                    return self._consider_llong_from_uint(op)
                 if (oopspecindex == EffectInfo.OS_LLONG_EQ or
                     oopspecindex == EffectInfo.OS_LLONG_NE):
                     return self._consider_llong_eq_ne_xx(op)

diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -975,6 +975,50 @@
             sys.meta_path.pop()
             sys.path_hooks.pop()
 
+
+class AppTestPyPyExtension(object):
+    def setup_class(cls):
+        cls.space = gettestobjspace(usemodules=['imp', 'zipimport'])
+        cls.w_udir = cls.space.wrap(str(udir))
+
+    def test_run_compiled_module(self):
+        # XXX minimal test only
+        import imp, new
+        module = new.module('foobar')
+        raises(IOError, imp._run_compiled_module,
+               'foobar', 'this_file_does_not_exist', None, module)
+
+    def test_getimporter(self):
+        import imp, os
+        # an existing directory
+        importer = imp._getimporter(self.udir)
+        assert importer is None
+        # an existing file
+        path = os.path.join(self.udir, 'test_getimporter')
+        open(path, 'w').close()
+        importer = imp._getimporter(path)
+        assert isinstance(importer, imp.NullImporter)
+        # a non-existing path
+        path = os.path.join(self.udir, 'does_not_exist_at_all')
+        importer = imp._getimporter(path)
+        assert isinstance(importer, imp.NullImporter)
+        # a mostly-empty zip file
+        path = os.path.join(self.udir, 'test_getimporter.zip')
+        f = open(path, 'wb')
+        f.write('PK\x03\x04\n\x00\x00\x00\x00\x00P\x9eN>\x00\x00\x00\x00\x00'
+                '\x00\x00\x00\x00\x00\x00\x00\x05\x00\x15\x00emptyUT\t\x00'
+                '\x03wyYMwyYMUx\x04\x00\xf4\x01d\x00PK\x01\x02\x17\x03\n\x00'
+                '\x00\x00\x00\x00P\x9eN>\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+                '\x00\x00\x00\x05\x00\r\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+                '\xa4\x81\x00\x00\x00\x00emptyUT\x05\x00\x03wyYMUx\x00\x00PK'
+                '\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00@\x00\x00\x008\x00'
+                '\x00\x00\x00\x00')
+        f.close()
+        importer = imp._getimporter(path)
+        import zipimport
+        assert isinstance(importer, zipimport.zipimporter)
+
+
 class AppTestNoPycFile(object):
     spaceconfig = {
         "objspace.usepycfiles": False,

diff --git a/pypy/translator/c/src/signals.h b/pypy/translator/c/src/signals.h
--- a/pypy/translator/c/src/signals.h
+++ b/pypy/translator/c/src/signals.h
@@ -143,6 +143,21 @@
 #endif
 }
 
+void pypysig_reinstall(int signum)
+{
+#ifdef SA_RESTART
+    /* Assume sigaction was used.  We did not pass SA_RESETHAND to
+       sa_flags, so there is nothing to do here. */
+#else
+# ifdef SIGCHLD
+    /* To avoid infinite recursion, this signal remains
+       reset until explicitly re-instated.  (Copied from CPython) */
+    if (signum != SIGCHLD)
+# endif
+    pypysig_setflag(signum);
+#endif
+}
+
 int pypysig_poll(void)
 {
   if (pypysig_occurred)

diff --git a/pypy/jit/backend/llgraph/llimpl.py b/pypy/jit/backend/llgraph/llimpl.py
--- a/pypy/jit/backend/llgraph/llimpl.py
+++ b/pypy/jit/backend/llgraph/llimpl.py
@@ -20,11 +20,11 @@
 from pypy.jit.metainterp import resoperation, executor
 from pypy.jit.metainterp.resoperation import rop
 from pypy.jit.backend.llgraph import symbolic
+from pypy.jit.codewriter import longlong
 
 from pypy.rlib.objectmodel import ComputedIntSymbolic, we_are_translated
 from pypy.rlib.rarithmetic import ovfcheck
 from pypy.rlib.rarithmetic import r_longlong, r_ulonglong, r_uint
-from pypy.rlib.longlong2float import longlong2float, float2longlong
 
 import py
 from pypy.tool.ansi_print import ansi_log
@@ -301,7 +301,7 @@
     return compile_start_ref_var(loop, lltype.Signed)
 
 def compile_start_float_var(loop):
-    return compile_start_ref_var(loop, lltype.Float)
+    return compile_start_ref_var(loop, longlong.FLOATSTORAGE)
 
 def compile_start_ref_var(loop, TYPE):
     loop = _from_opaque(loop)
@@ -340,7 +340,7 @@
     compile_add_ref_const(loop, value, lltype.Signed)
 
 def compile_add_float_const(loop, value):
-    compile_add_ref_const(loop, value, lltype.Float)
+    compile_add_ref_const(loop, value, longlong.FLOATSTORAGE)
 
 def compile_add_ref_const(loop, value, TYPE):
     loop = _from_opaque(loop)
@@ -353,7 +353,7 @@
     return compile_add_ref_result(loop, lltype.Signed)
 
 def compile_add_float_result(loop):
-    return compile_add_ref_result(loop, lltype.Float)
+    return compile_add_ref_result(loop, longlong.FLOATSTORAGE)
 
 def compile_add_ref_result(loop, TYPE):
     loop = _from_opaque(loop)
@@ -486,8 +486,8 @@
                         x = self.as_ptr(result)
                     elif RESTYPE is ootype.Object:
                         x = self.as_object(result)
-                    elif RESTYPE is lltype.Float:
-                        x = self.as_float(result)
+                    elif RESTYPE is longlong.FLOATSTORAGE:
+                        x = self.as_floatstorage(result)
                     else:
                         raise Exception("op.result.concretetype is %r"
                                         % (RESTYPE,))
@@ -550,8 +550,8 @@
     def as_object(self, x):
         return ootype.cast_to_object(x)
 
-    def as_float(self, x):
-        return cast_to_float(x)
+    def as_floatstorage(self, x):
+        return cast_to_floatstorage(x)
 
     def log_progress(self):
         count = sum(_stats.exec_counters.values())
@@ -823,7 +823,7 @@
             elif T == llmemory.GCREF:
                 args_in_order.append('r')
                 _call_args_r.append(x)
-            elif T is lltype.Float:
+            elif T is longlong.FLOATSTORAGE:
                 args_in_order.append('f')
                 _call_args_f.append(x)
             else:
@@ -886,7 +886,7 @@
                     set_future_value_int(i, args[i])
                 elif isinstance(TYPE, lltype.Ptr):
                     set_future_value_ref(i, args[i])
-                elif TYPE is lltype.Float:
+                elif TYPE is longlong.FLOATSTORAGE:
                     set_future_value_float(i, args[i])
                 else:
                     raise Exception("Nonsense type %s" % TYPE)
@@ -1072,25 +1072,23 @@
 def cast_from_ptr(TYPE, x):
     return lltype.cast_opaque_ptr(TYPE, x)
 
-def cast_to_float(x):
+def cast_to_floatstorage(x):
     if isinstance(x, float):
-        return x      # common case
+        return longlong.getfloatstorage(x)      # common case
     if IS_32_BIT:
+        assert longlong.supports_longlong
         if isinstance(x, r_longlong):
-            return longlong2float(x)
+            return x
         if isinstance(x, r_ulonglong):
-            return longlong2float(rffi.cast(lltype.SignedLongLong, x))
+            return rffi.cast(lltype.SignedLongLong, x)
     raise TypeError(type(x))
 
-def cast_from_float(TYPE, x):
-    assert isinstance(x, float)
+def cast_from_floatstorage(TYPE, x):
+    assert isinstance(x, longlong.r_float_storage)
     if TYPE is lltype.Float:
-        return x
-    if IS_32_BIT:
-        if TYPE is lltype.SignedLongLong:
-            return float2longlong(x)
-        if TYPE is lltype.UnsignedLongLong:
-            return r_ulonglong(float2longlong(x))
+        return longlong.getrealfloat(x)
+    if longlong.is_longlong(TYPE):
+        return rffi.cast(TYPE, x)
     raise TypeError(TYPE)
 
 
@@ -1119,6 +1117,7 @@
     set_future_value_ref(index, value)
 
 def set_future_value_float(index, value):
+    assert isinstance(value, longlong.r_float_storage)
     set_future_value_ref(index, value)
 
 def set_future_value_ref(index, value):
@@ -1157,7 +1156,7 @@
     frame = _from_opaque(frame)
     assert num >= 0
     x = frame.fail_args[num]
-    assert lltype.typeOf(x) is lltype.Float
+    assert lltype.typeOf(x) is longlong.FLOATSTORAGE
     return x
 
 def frame_ptr_getvalue(frame, num):
@@ -1295,11 +1294,11 @@
 
 def do_getarrayitem_gc_float(array, index):
     array = array._obj.container
-    return cast_to_float(array.getitem(index))
+    return cast_to_floatstorage(array.getitem(index))
 
 def do_getarrayitem_raw_float(array, index):
     array = array.adr.ptr._obj
-    return cast_to_float(array.getitem(index))
+    return cast_to_floatstorage(array.getitem(index))
 
 def do_getarrayitem_gc_ptr(array, index):
     array = array._obj.container
@@ -1314,7 +1313,7 @@
     return cast_to_int(_getfield_gc(struct, fieldnum))
 
 def do_getfield_gc_float(struct, fieldnum):
-    return cast_to_float(_getfield_gc(struct, fieldnum))
+    return cast_to_floatstorage(_getfield_gc(struct, fieldnum))
 
 def do_getfield_gc_ptr(struct, fieldnum):
     return cast_to_ptr(_getfield_gc(struct, fieldnum))
@@ -1328,7 +1327,7 @@
     return cast_to_int(_getfield_raw(struct, fieldnum))
 
 def do_getfield_raw_float(struct, fieldnum):
-    return cast_to_float(_getfield_raw(struct, fieldnum))
+    return cast_to_floatstorage(_getfield_raw(struct, fieldnum))
 
 def do_getfield_raw_ptr(struct, fieldnum):
     return cast_to_ptr(_getfield_raw(struct, fieldnum))
@@ -1358,13 +1357,13 @@
 def do_setarrayitem_gc_float(array, index, newvalue):
     array = array._obj.container
     ITEMTYPE = lltype.typeOf(array).OF
-    newvalue = cast_from_float(ITEMTYPE, newvalue)
+    newvalue = cast_from_floatstorage(ITEMTYPE, newvalue)
     array.setitem(index, newvalue)
 
 def do_setarrayitem_raw_float(array, index, newvalue):
     array = array.adr.ptr
     ITEMTYPE = lltype.typeOf(array).TO.OF
-    newvalue = cast_from_int(ITEMTYPE, newvalue)
+    newvalue = cast_from_floatstorage(ITEMTYPE, newvalue)
     array._obj.setitem(index, newvalue)
 
 def do_setarrayitem_gc_ptr(array, index, newvalue):
@@ -1384,7 +1383,7 @@
     STRUCT, fieldname = symbolic.TokenToField[fieldnum]
     ptr = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), struct)
     FIELDTYPE = getattr(STRUCT, fieldname)
-    newvalue = cast_from_float(FIELDTYPE, newvalue)
+    newvalue = cast_from_floatstorage(FIELDTYPE, newvalue)
     setattr(ptr, fieldname, newvalue)
 
 def do_setfield_gc_ptr(struct, fieldnum, newvalue):
@@ -1405,7 +1404,7 @@
     STRUCT, fieldname = symbolic.TokenToField[fieldnum]
     ptr = cast_from_int(lltype.Ptr(STRUCT), struct)
     FIELDTYPE = getattr(STRUCT, fieldname)
-    newvalue = cast_from_float(FIELDTYPE, newvalue)
+    newvalue = cast_from_floatstorage(FIELDTYPE, newvalue)
     setattr(ptr, fieldname, newvalue)
 
 def do_setfield_raw_ptr(struct, fieldnum, newvalue):
@@ -1462,6 +1461,7 @@
 kind2TYPE = {
     'i': lltype.Signed,
     'f': lltype.Float,
+    'L': lltype.SignedLongLong,
     'v': lltype.Void,
     }
 
@@ -1502,7 +1502,7 @@
 
 def do_call_float(f):
     x = _do_call_common(f)
-    return cast_to_float(x)
+    return cast_to_floatstorage(x)
 
 def do_call_ptr(f):
     x = _do_call_common(f)
@@ -1531,14 +1531,12 @@
                     assert n == 'r'
                 x = argsiter_r.next()
                 x = cast_from_ptr(TYPE, x)
-            elif TYPE is lltype.Float or (
-                    IS_32_BIT and TYPE in (lltype.SignedLongLong,
-                                           lltype.UnsignedLongLong)):
+            elif TYPE is lltype.Float or longlong.is_longlong(TYPE):
                 if args_in_order is not None:
                     n = orderiter.next()
                     assert n == 'f'
                 x = argsiter_f.next()
-                x = cast_from_float(TYPE, x)
+                x = cast_from_floatstorage(TYPE, x)
             else:
                 if args_in_order is not None:
                     n = orderiter.next()
@@ -1642,6 +1640,13 @@
 s_CompiledLoop = annmodel.SomePtr(COMPILEDLOOP)
 s_Frame = annmodel.SomePtr(FRAME)
 
+if longlong.FLOATSTORAGE is lltype.Float:
+    s_FloatStorage = annmodel.SomeFloat()
+elif longlong.FLOATSTORAGE is lltype.SignedLongLong:
+    s_FloatStorage = annmodel.SomeInteger(knowntype=longlong.r_float_storage)
+else:
+    assert 0
+
 setannotation(compile_start, s_CompiledLoop)
 setannotation(compile_start_int_var, annmodel.SomeInteger())
 setannotation(compile_start_ref_var, annmodel.SomeInteger())
@@ -1670,7 +1675,7 @@
 setannotation(frame_execute, annmodel.SomeInteger())
 setannotation(frame_int_getvalue, annmodel.SomeInteger())
 setannotation(frame_ptr_getvalue, annmodel.SomePtr(llmemory.GCREF))
-setannotation(frame_float_getvalue, annmodel.SomeFloat())
+setannotation(frame_float_getvalue, s_FloatStorage)
 setannotation(frame_get_value_count, annmodel.SomeInteger())
 setannotation(frame_clear_latest_values, annmodel.s_None)
 
@@ -1686,15 +1691,15 @@
 setannotation(do_unicodegetitem, annmodel.SomeInteger())
 setannotation(do_getarrayitem_gc_int, annmodel.SomeInteger())
 setannotation(do_getarrayitem_gc_ptr, annmodel.SomePtr(llmemory.GCREF))
-setannotation(do_getarrayitem_gc_float, annmodel.SomeFloat())
+setannotation(do_getarrayitem_gc_float, s_FloatStorage)
 setannotation(do_getarrayitem_raw_int, annmodel.SomeInteger())
-setannotation(do_getarrayitem_raw_float, annmodel.SomeFloat())
+setannotation(do_getarrayitem_raw_float, s_FloatStorage)
 setannotation(do_getfield_gc_int, annmodel.SomeInteger())
 setannotation(do_getfield_gc_ptr, annmodel.SomePtr(llmemory.GCREF))
-setannotation(do_getfield_gc_float, annmodel.SomeFloat())
+setannotation(do_getfield_gc_float, s_FloatStorage)
 setannotation(do_getfield_raw_int, annmodel.SomeInteger())
 setannotation(do_getfield_raw_ptr, annmodel.SomePtr(llmemory.GCREF))
-setannotation(do_getfield_raw_float, annmodel.SomeFloat())
+setannotation(do_getfield_raw_float, s_FloatStorage)
 setannotation(do_new, annmodel.SomePtr(llmemory.GCREF))
 setannotation(do_new_array, annmodel.SomePtr(llmemory.GCREF))
 setannotation(do_setarrayitem_gc_int, annmodel.s_None)
@@ -1716,5 +1721,5 @@
 setannotation(do_call_pushptr, annmodel.s_None)
 setannotation(do_call_int, annmodel.SomeInteger())
 setannotation(do_call_ptr, annmodel.SomePtr(llmemory.GCREF))
-setannotation(do_call_float, annmodel.SomeFloat())
+setannotation(do_call_float, s_FloatStorage)
 setannotation(do_call_void, annmodel.s_None)

diff --git a/pypy/jit/codewriter/effectinfo.py b/pypy/jit/codewriter/effectinfo.py
--- a/pypy/jit/codewriter/effectinfo.py
+++ b/pypy/jit/codewriter/effectinfo.py
@@ -71,7 +71,7 @@
     OS_LLONG_UGT                = 90
     OS_LLONG_UGE                = 91
     OS_LLONG_URSHIFT            = 92
-    OS_LLONG_FROM_TWO_INTS      = 93
+    OS_LLONG_FROM_UINT          = 93
 
     def __new__(cls, readonly_descrs_fields,
                 write_descrs_fields, write_descrs_arrays,

diff --git a/pypy/translator/c/src/g_include.h b/pypy/translator/c/src/g_include.h
--- a/pypy/translator/c/src/g_include.h
+++ b/pypy/translator/c/src/g_include.h
@@ -37,19 +37,7 @@
 #include "src/llgroup.h"
 
 #include "src/instrument.h"
-
-/* optional assembler bits */
-#if defined(__GNUC__) && defined(__i386__)
-#  include "src/asm_gcc_x86.h"
-#endif
-
-#if defined(__GNUC__) && defined(__amd64__)
-#  include "src/asm_gcc_x86_64.h"
-#endif
-
-#if defined(__GNUC__) && defined(__ppc__)
-#  include "src/asm_ppc.h"
-#endif
+#include "src/asm.h"
 
 
 /*** modules ***/

diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -20,7 +20,7 @@
 from pypy.rlib.rarithmetic import intmask
 from pypy.rlib.objectmodel import specialize
 from pypy.jit.codewriter.jitcode import JitCode, SwitchDictDescr, MissingLiveness
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 from pypy.jit.metainterp.optimizeutil import RetraceLoop
 
 # ____________________________________________________________
@@ -1473,7 +1473,7 @@
             elif result_type == history.REF:
                 raise sd.DoneWithThisFrameRef(self.cpu, resultbox.getref_base())
             elif result_type == history.FLOAT:
-                raise sd.DoneWithThisFrameFloat(resultbox.getfloat())
+                raise sd.DoneWithThisFrameFloat(resultbox.getfloatstorage())
             else:
                 assert False
 
@@ -2151,7 +2151,7 @@
             # warmstate.py.
             virtualizable_box = self.virtualizable_boxes[-1]
             virtualizable = vinfo.unwrap_virtualizable_box(virtualizable_box)
-            assert not virtualizable.vable_token
+            assert not vinfo.gettoken(virtualizable)
             # fill the virtualizable with the local boxes
             self.synchronize_virtualizable()
         #

diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -291,7 +291,8 @@
         if space.is_true(w_loader):
             return w_loader
 
-def find_in_path_hooks(space, w_modulename, w_pathitem):
+def _getimporter(space, w_pathitem):
+    # the function 'imp._getimporter' is a pypy-only extension
     w_path_importer_cache = space.sys.get("path_importer_cache")
     w_importer = space.finditem(w_path_importer_cache, w_pathitem)
     if w_importer is None:
@@ -311,11 +312,15 @@
                 )
             except OperationError, e:
                 if e.match(space, space.w_ImportError):
-                    return
+                    return None
                 raise
         if space.is_true(w_importer):
             space.setitem(w_path_importer_cache, w_pathitem, w_importer)
-    if space.is_true(w_importer):
+    return w_importer
+
+def find_in_path_hooks(space, w_modulename, w_pathitem):
+    w_importer = _getimporter(space, w_pathitem)
+    if w_importer is not None and space.is_true(w_importer):
         w_loader = space.call_method(w_importer, "find_module", w_modulename)
         if space.is_true(w_loader):
             return w_loader

diff --git a/pypy/jit/metainterp/warmstate.py b/pypy/jit/metainterp/warmstate.py
--- a/pypy/jit/metainterp/warmstate.py
+++ b/pypy/jit/metainterp/warmstate.py
@@ -12,13 +12,13 @@
 from pypy.rlib.jit import BaseJitCell
 from pypy.rlib.debug import debug_start, debug_stop, debug_print
 from pypy.jit.metainterp import history
-from pypy.jit.codewriter import support, heaptracker
+from pypy.jit.codewriter import support, heaptracker, longlong
 
 # ____________________________________________________________
 
 @specialize.arg(0)
 def specialize_value(TYPE, x):
-    """'x' must be a Signed, a GCREF or a Float.
+    """'x' must be a Signed, a GCREF or a FLOATSTORAGE.
     This function casts it to a more specialized type, like Char or Ptr(..).
     """
     INPUT = lltype.typeOf(x)
@@ -28,15 +28,15 @@
             return rffi.cast(TYPE, x)
         else:
             return lltype.cast_primitive(TYPE, x)
-    elif INPUT is lltype.Float:
+    elif INPUT is longlong.FLOATSTORAGE:
         assert TYPE is lltype.Float
-        return x
+        return longlong.getrealfloat(x)
     else:
         return lltype.cast_opaque_ptr(TYPE, x)
 
 @specialize.ll()
 def unspecialize_value(value):
-    """Casts 'value' to a Signed, a GCREF or a Float."""
+    """Casts 'value' to a Signed, a GCREF or a FLOATSTORAGE."""
     if isinstance(lltype.typeOf(value), lltype.Ptr):
         if lltype.typeOf(value).TO._gckind == 'gc':
             return lltype.cast_opaque_ptr(llmemory.GCREF, value)
@@ -46,7 +46,7 @@
     elif isinstance(lltype.typeOf(value), ootype.OOType):
         return ootype.cast_to_object(value)
     elif isinstance(value, float):
-        return value
+        return longlong.getfloatstorage(value)
     else:
         return intmask(value)
 
@@ -83,6 +83,7 @@
         else:
             return history.BoxObj(value)
     elif isinstance(value, float):
+        value = longlong.getfloatstorage(value)
         if in_const_box:
             return history.ConstFloat(value)
         else:
@@ -138,7 +139,11 @@
         intvalue = lltype.cast_primitive(lltype.Signed, value)
         cpu.set_future_value_int(j, intvalue)
     elif typecode == 'float':
-        assert isinstance(value, float)
+        if lltype.typeOf(value) is lltype.Float:
+            value = longlong.getfloatstorage(value)
+        else:
+            assert longlong.is_longlong(lltype.typeOf(value))
+            value = rffi.cast(lltype.SignedLongLong, value)
         cpu.set_future_value_float(j, value)
     else:
         assert False

diff --git a/pypy/jit/backend/x86/runner.py b/pypy/jit/backend/x86/runner.py
--- a/pypy/jit/backend/x86/runner.py
+++ b/pypy/jit/backend/x86/runner.py
@@ -13,7 +13,6 @@
 class AbstractX86CPU(AbstractLLCPU):
     debug = True
     supports_floats = True
-    supports_longlong = True
 
     BOOTSTRAP_TP = lltype.FuncType([], lltype.Signed)
     dont_keepalive_stuff = False # for tests
@@ -150,12 +149,15 @@
     CALLEE_SAVE_REGISTERS = [regloc.ebx, regloc.esi, regloc.edi]
     FRAME_FIXED_SIZE = len(CALLEE_SAVE_REGISTERS) + 2
 
+    supports_longlong = True
+
     def __init__(self, *args, **kwargs):
         assert sys.maxint == (2**31 - 1)
         super(CPU386, self).__init__(*args, **kwargs)
 
 class CPU386_NO_SSE2(CPU386):
     supports_floats = False
+    supports_longlong = False
 
 class CPU_X86_64(AbstractX86CPU):
     WORD = 8

diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py
--- a/pypy/jit/backend/test/runner_test.py
+++ b/pypy/jit/backend/test/runner_test.py
@@ -14,9 +14,15 @@
 from pypy.rpython.ootypesystem import ootype
 from pypy.rpython.annlowlevel import llhelper
 from pypy.rpython.llinterp import LLException
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 from pypy.rlib.rarithmetic import intmask
 
+def boxfloat(x):
+    return BoxFloat(longlong.getfloatstorage(x))
+
+def constfloat(x):
+    return ConstFloat(longlong.getfloatstorage(x))
+
 
 class Runner(object):
 
@@ -36,7 +42,7 @@
                 self.cpu.set_future_value_ref(j, box.getref_base())
                 j += 1
             elif isinstance(box, BoxFloat):
-                self.cpu.set_future_value_float(j, box.getfloat())
+                self.cpu.set_future_value_float(j, box.getfloatstorage())
                 j += 1
             else:
                 raise NotImplementedError(box)
@@ -344,7 +350,10 @@
         from pypy.jit.metainterp.test.test_executor import get_float_tests
         for opnum, boxargs, rettype, retvalue in get_float_tests(self.cpu):
             res = self.execute_operation(opnum, boxargs, rettype)
-            assert res.value == retvalue
+            if isinstance(res, BoxFloat):
+                assert res.getfloat() == retvalue
+            else:
+                assert res.value == retvalue
 
     def test_ovf_operations(self, reversed=False):
         minint = -sys.maxint-1
@@ -416,6 +425,8 @@
         assert x == ord('B')
         if cpu.supports_floats:
             def func(f, i):
+                assert isinstance(f, float)
+                assert isinstance(i, int)
                 return f - float(i)
             FPTR = self.Ptr(self.FuncType([lltype.Float, lltype.Signed],
                                           lltype.Float))
@@ -424,8 +435,8 @@
             calldescr = cpu.calldescrof(FTP, FTP.ARGS, FTP.RESULT)
             x = cpu.bh_call_f(self.get_funcbox(cpu, func_ptr).value,
                               calldescr,
-                              [42], None, [3.5])
-            assert x == 3.5 - 42
+                              [42], None, [longlong.getfloatstorage(3.5)])
+            assert longlong.getrealfloat(x) == 3.5 - 42
 
     def test_call(self):
         from pypy.rlib.libffi import types
@@ -479,13 +490,13 @@
             func_ptr = llhelper(FPTR, func)
             calldescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
             funcbox = self.get_funcbox(cpu, func_ptr)
-            args = ([BoxFloat(.1) for i in range(7)] +
-                    [BoxInt(1), BoxInt(2), BoxFloat(.2), BoxFloat(.3),
-                     BoxFloat(.4)])
+            args = ([boxfloat(.1) for i in range(7)] +
+                    [BoxInt(1), BoxInt(2), boxfloat(.2), boxfloat(.3),
+                     boxfloat(.4)])
             res = self.execute_operation(rop.CALL,
                                          [funcbox] + args,
                                          'float', descr=calldescr)
-            assert abs(res.value - 4.6) < 0.0001
+            assert abs(res.getfloat() - 4.6) < 0.0001
 
     def test_call_many_arguments(self):
         # Test calling a function with a large number of arguments (more than
@@ -547,6 +558,20 @@
                                      descr=calldescr)
         assert res.value == ord('a')
 
+    def test_call_with_const_floats(self):
+        def func(f1, f2):
+            return f1 + f2
+
+        FUNC = self.FuncType([lltype.Float, lltype.Float], lltype.Float)
+        FPTR = self.Ptr(FUNC)
+        calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
+        func_ptr = llhelper(FPTR, func)
+        funcbox = self.get_funcbox(self.cpu, func_ptr)
+        res = self.execute_operation(rop.CALL, [funcbox, constfloat(1.5),
+                                                constfloat(2.5)], 'float',
+                                     descr=calldescr)
+        assert res.getfloat() == 4.0
+
 
     def test_field_basic(self):
         t_box, T_box = self.alloc_instance(self.T)
@@ -599,17 +624,17 @@
         assert res.value == null_const.value
         if self.cpu.supports_floats:
             floatdescr = self.cpu.fielddescrof(self.S, 'float')
-            self.execute_operation(rop.SETFIELD_GC, [t_box, BoxFloat(3.4)],
+            self.execute_operation(rop.SETFIELD_GC, [t_box, boxfloat(3.4)],
                                    'void', descr=floatdescr)
             res = self.execute_operation(rop.GETFIELD_GC, [t_box],
                                          'float', descr=floatdescr)
-            assert res.value == 3.4
+            assert res.getfloat() == 3.4
             #
-            self.execute_operation(rop.SETFIELD_GC, [t_box, ConstFloat(-3.6)],
+            self.execute_operation(rop.SETFIELD_GC, [t_box, constfloat(-3.6)],
                                    'void', descr=floatdescr)
             res = self.execute_operation(rop.GETFIELD_GC, [t_box],
                                          'float', descr=floatdescr)
-            assert res.value == -3.6
+            assert res.getfloat() == -3.6
 
 
     def test_passing_guards(self):
@@ -625,7 +650,7 @@
                (rop.GUARD_ISNULL, [nullbox])
                ])
         if self.cpu.supports_floats:
-            all.append((rop.GUARD_VALUE, [BoxFloat(3.5), ConstFloat(3.5)]))
+            all.append((rop.GUARD_VALUE, [boxfloat(3.5), constfloat(3.5)]))
         for (opname, args) in all:
             assert self.execute_operation(opname, args, 'void') == None
             assert not self.guard_failed
@@ -651,7 +676,7 @@
                (rop.GUARD_NONNULL, [nullbox]),
                (rop.GUARD_ISNULL, [t_box])])
         if self.cpu.supports_floats:
-            all.append((rop.GUARD_VALUE, [BoxFloat(-1.0), ConstFloat(1.0)]))
+            all.append((rop.GUARD_VALUE, [boxfloat(-1.0), constfloat(1.0)]))
         for opname, args in all:
             assert self.execute_operation(opname, args, 'void') == None
             assert self.guard_failed
@@ -816,17 +841,17 @@
             a_box, A = self.alloc_array_of(lltype.Float, 31)
             arraydescr = self.cpu.arraydescrof(A)
             self.execute_operation(rop.SETARRAYITEM_GC, [a_box, BoxInt(1),
-                                                         BoxFloat(3.5)],
+                                                         boxfloat(3.5)],
                                    'void', descr=arraydescr)
             self.execute_operation(rop.SETARRAYITEM_GC, [a_box, BoxInt(2),
-                                                         ConstFloat(4.5)],
+                                                         constfloat(4.5)],
                                    'void', descr=arraydescr)
             r = self.execute_operation(rop.GETARRAYITEM_GC, [a_box, BoxInt(1)],
                                        'float', descr=arraydescr)
-            assert r.value == 3.5
+            assert r.getfloat() == 3.5
             r = self.execute_operation(rop.GETARRAYITEM_GC, [a_box, BoxInt(2)],
                                        'float', descr=arraydescr)
-            assert r.value == 4.5
+            assert r.getfloat() == 4.5
 
         # For platforms where sizeof(INT) != sizeof(Signed) (ie, x86-64)
         a_box, A = self.alloc_array_of(rffi.INT, 342)
@@ -926,10 +951,10 @@
         assert r.value == u_box.value
 
         if self.cpu.supports_floats:
-            r = self.execute_operation(rop.SAME_AS, [ConstFloat(5.5)], 'float')
-            assert r.value == 5.5
-            r = self.execute_operation(rop.SAME_AS, [BoxFloat(5.5)], 'float')
-            assert r.value == 5.5
+            r = self.execute_operation(rop.SAME_AS, [constfloat(5.5)], 'float')
+            assert r.getfloat() == 5.5
+            r = self.execute_operation(rop.SAME_AS, [boxfloat(5.5)], 'float')
+            assert r.getfloat() == 5.5
 
     def test_virtual_ref(self):
         pass   # VIRTUAL_REF must not reach the backend nowadays
@@ -1000,7 +1025,7 @@
                     p = lltype.malloc(S)
                     values.append(lltype.cast_opaque_ptr(llmemory.GCREF, p))
                 elif isinstance(box, BoxFloat):
-                    values.append(r.random())
+                    values.append(longlong.getfloatstorage(r.random()))
                 else:
                     assert 0
             values[index_counter] = 11
@@ -1048,7 +1073,7 @@
         faildescr1 = BasicFailDescr(1)
         faildescr2 = BasicFailDescr(2)
         operations = [
-            ResOperation(rop.FLOAT_LE, [fboxes[0], ConstFloat(9.2)], i2),
+            ResOperation(rop.FLOAT_LE, [fboxes[0], constfloat(9.2)], i2),
             ResOperation(rop.GUARD_TRUE, [i2], None, descr=faildescr1),
             ResOperation(rop.FINISH, fboxes, None, descr=faildescr2),
             ]
@@ -1059,20 +1084,22 @@
         fboxes2 = [BoxFloat() for i in range(12)]
         f3 = BoxFloat()
         bridge = [
-            ResOperation(rop.FLOAT_SUB, [fboxes2[0], ConstFloat(1.0)], f3),
+            ResOperation(rop.FLOAT_SUB, [fboxes2[0], constfloat(1.0)], f3),
             ResOperation(rop.JUMP, [f3] + fboxes2[1:], None, descr=looptoken),
         ]
 
         self.cpu.compile_bridge(faildescr1, fboxes2, bridge, looptoken)
 
         for i in range(len(fboxes)):
-            self.cpu.set_future_value_float(i, 13.5 + 6.73 * i)
+            x = 13.5 + 6.73 * i
+            self.cpu.set_future_value_float(i, longlong.getfloatstorage(x))
         fail = self.cpu.execute_token(looptoken)
         assert fail.identifier == 2
         res = self.cpu.get_latest_value_float(0)
-        assert res == 8.5
+        assert longlong.getrealfloat(res) == 8.5
         for i in range(1, len(fboxes)):
-            assert self.cpu.get_latest_value_float(i) == 13.5 + 6.73 * i
+            got = longlong.getrealfloat(self.cpu.get_latest_value_float(i))
+            assert got == 13.5 + 6.73 * i
 
     def test_integers_and_guards(self):
         for opname, compare in [
@@ -1149,11 +1176,11 @@
                     if combinaison[0] == 'b':
                         fbox1 = BoxFloat()
                     else:
-                        fbox1 = ConstFloat(-4.5)
+                        fbox1 = constfloat(-4.5)
                     if combinaison[1] == 'b':
                         fbox2 = BoxFloat()
                     else:
-                        fbox2 = ConstFloat(-4.5)
+                        fbox2 = constfloat(-4.5)
                     b1 = BoxInt()
                     faildescr1 = BasicFailDescr(1)
                     faildescr2 = BasicFailDescr(2)
@@ -1177,10 +1204,12 @@
                                 if test2 == -4.5 or combinaison[1] == 'b':
                                     n = 0
                                     if combinaison[0] == 'b':
-                                        cpu.set_future_value_float(n, test1)
+                                        cpu.set_future_value_float(
+                                            n, longlong.getfloatstorage(test1))
                                         n += 1
                                     if combinaison[1] == 'b':
-                                        cpu.set_future_value_float(n, test2)
+                                        cpu.set_future_value_float(
+                                            n, longlong.getfloatstorage(test2))
                                         n += 1
                                     fail = cpu.execute_token(looptoken)
                                     #
@@ -1230,7 +1259,7 @@
             if isinstance(box, BoxInt):
                 self.cpu.set_future_value_int(i, box.getint())
             elif isinstance(box, BoxFloat):
-                self.cpu.set_future_value_float(i, box.getfloat())
+                self.cpu.set_future_value_float(i, box.getfloatstorage())
             else:
                 assert 0
         #
@@ -1244,12 +1273,12 @@
         from pypy.rlib.rarithmetic import INFINITY, NAN, isinf, isnan
         from pypy.jit.metainterp.resoperation import opname
 
-        fzer = BoxFloat(0.0)
-        fone = BoxFloat(1.0)
-        fmqr = BoxFloat(-0.25)
-        finf = BoxFloat(INFINITY)
-        fmnf = BoxFloat(-INFINITY)
-        fnan = BoxFloat(NAN)
+        fzer = boxfloat(0.0)
+        fone = boxfloat(1.0)
+        fmqr = boxfloat(-0.25)
+        finf = boxfloat(INFINITY)
+        fmnf = boxfloat(-INFINITY)
+        fnan = boxfloat(NAN)
 
         all_cases_unary =  [(a,)   for a in [fzer,fone,fmqr,finf,fmnf,fnan]]
         all_cases_binary = [(a, b) for a in [fzer,fone,fmqr,finf,fmnf,fnan]
@@ -1259,7 +1288,7 @@
 
         def nan_and_infinity(opnum, realoperation, testcases):
             for testcase in testcases:
-                realvalues = [b.value for b in testcase]
+                realvalues = [b.getfloat() for b in testcase]
                 expected = realoperation(*realvalues)
                 if isinstance(expected, float):
                     expectedtype = 'float'
@@ -1268,15 +1297,17 @@
                 got = self.execute_operation(opnum, list(testcase),
                                              expectedtype)
                 if isnan(expected):
-                    ok = isnan(got.value)
+                    ok = isnan(got.getfloat())
                 elif isinf(expected):
-                    ok = isinf(got.value)
+                    ok = isinf(got.getfloat())
+                elif isinstance(got, BoxFloat):
+                    ok = (got.getfloat() == expected)
                 else:
-                    ok = (got.value == expected)
+                    ok = got.value == expected
                 if not ok:
                     raise AssertionError("%s(%s): got %r, expected %r" % (
                         opname[opnum], ', '.join(map(repr, realvalues)),
-                        got.value, expected))
+                        got.getfloat(), expected))
                 # if we expect a boolean, also check the combination with
                 # a GUARD_TRUE or GUARD_FALSE
                 if isinstance(expected, bool):
@@ -1296,7 +1327,8 @@
                         self.cpu.compile_loop(unique_testcase_list, operations,
                                               looptoken)
                         for i, box in enumerate(unique_testcase_list):
-                            self.cpu.set_future_value_float(i, box.value)
+                            self.cpu.set_future_value_float(
+                                i, box.getfloatstorage())
                         fail = self.cpu.execute_token(looptoken)
                         if fail.identifier != 5 - (expected_id^expected):
                             if fail.identifier == 4:
@@ -1767,7 +1799,8 @@
         self.cpu.set_future_value_int(1, 0)
         fail = self.cpu.execute_token(looptoken)
         assert fail.identifier == 0
-        assert self.cpu.get_latest_value_float(0) == 42.5
+        x = self.cpu.get_latest_value_float(0)
+        assert longlong.getrealfloat(x) == 42.5
         assert values == []
 
         self.cpu.set_future_value_int(0, 10)
@@ -1775,7 +1808,8 @@
         fail = self.cpu.execute_token(looptoken)
         assert fail.identifier == 1
         assert self.cpu.get_latest_value_int(0) == 1
-        assert self.cpu.get_latest_value_float(1) == 42.5
+        x = self.cpu.get_latest_value_float(1)
+        assert longlong.getrealfloat(x) == 42.5
         assert self.cpu.get_latest_value_int(2) == 10
         assert values == [1, 10]
 
@@ -1810,9 +1844,10 @@
             descr_C = cpu.arraydescrof(C)
             x = cpu.bh_getarrayitem_gc_f(
                 descr_C, lltype.cast_opaque_ptr(llmemory.GCREF, c), 3)
-            assert x == 3.5
+            assert longlong.getrealfloat(x) == 3.5
             cpu.bh_setarrayitem_gc_f(
-                descr_C, lltype.cast_opaque_ptr(llmemory.GCREF, c), 4, 4.5)
+                descr_C, lltype.cast_opaque_ptr(llmemory.GCREF, c), 4,
+                longlong.getfloatstorage(4.5))
             assert c[4] == 4.5
         s = rstr.mallocstr(6)
         x = cpu.bh_strlen(lltype.cast_opaque_ptr(llmemory.GCREF, s))
@@ -1866,13 +1901,13 @@
             descrfld_z = cpu.fielddescrof(S, 'z')
             cpu.bh_setfield_gc_f(
                 lltype.cast_opaque_ptr(llmemory.GCREF, s),
-                descrfld_z, 3.5)
+                descrfld_z, longlong.getfloatstorage(3.5))
             assert s.z == 3.5
             s.z = 3.2
             x = cpu.bh_getfield_gc_f(
                 lltype.cast_opaque_ptr(llmemory.GCREF, s),
                 descrfld_z)
-            assert x == 3.2
+            assert longlong.getrealfloat(x) == 3.2
         ### we don't support in the JIT for now GC pointers
         ### stored inside non-GC structs.
         #descrfld_ry = cpu.fielddescrof(RS, 'y')
@@ -2028,7 +2063,8 @@
             py.test.skip("requires floats")
         called = []
         def assembler_helper(failindex, virtualizable):
-            assert self.cpu.get_latest_value_float(0) == 1.2 + 3.2
+            x = self.cpu.get_latest_value_float(0)
+            assert longlong.getrealfloat(x) == 1.2 + 3.2
             called.append(failindex)
             return 13.5
 
@@ -2054,10 +2090,11 @@
         looptoken = LoopToken()
         looptoken.outermost_jitdriver_sd = FakeJitDriverSD()
         self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken)
-        self.cpu.set_future_value_float(0, 1.2)
-        self.cpu.set_future_value_float(1, 2.3)
+        self.cpu.set_future_value_float(0, longlong.getfloatstorage(1.2))
+        self.cpu.set_future_value_float(1, longlong.getfloatstorage(2.3))
         res = self.cpu.execute_token(looptoken)
-        assert self.cpu.get_latest_value_float(0) == 1.2 + 2.3
+        x = self.cpu.get_latest_value_float(0)
+        assert longlong.getrealfloat(x) == 1.2 + 2.3
         ops = '''
         [f4, f5]
         f3 = call_assembler(f4, f5, descr=looptoken)
@@ -2067,10 +2104,11 @@
         loop = parse(ops, namespace=locals())
         othertoken = LoopToken()
         self.cpu.compile_loop(loop.inputargs, loop.operations, othertoken)
-        self.cpu.set_future_value_float(0, 1.2)
-        self.cpu.set_future_value_float(1, 3.2)
+        self.cpu.set_future_value_float(0, longlong.getfloatstorage(1.2))
+        self.cpu.set_future_value_float(1, longlong.getfloatstorage(3.2))
         res = self.cpu.execute_token(othertoken)
-        assert self.cpu.get_latest_value_float(0) == 13.5
+        x = self.cpu.get_latest_value_float(0)
+        assert longlong.getrealfloat(x) == 13.5
         assert called
 
         # test the fast path, which should not call assembler_helper()
@@ -2079,10 +2117,11 @@
         try:
             othertoken = LoopToken()
             self.cpu.compile_loop(loop.inputargs, loop.operations, othertoken)
-            self.cpu.set_future_value_float(0, 1.2)
-            self.cpu.set_future_value_float(1, 3.2)
+            self.cpu.set_future_value_float(0, longlong.getfloatstorage(1.2))
+            self.cpu.set_future_value_float(1, longlong.getfloatstorage(3.2))
             res = self.cpu.execute_token(othertoken)
-            assert self.cpu.get_latest_value_float(0) == 1.2 + 3.2
+            x = self.cpu.get_latest_value_float(0)
+            assert longlong.getrealfloat(x) == 1.2 + 3.2
             assert not called
         finally:
             del self.cpu.done_with_this_frame_float_v
@@ -2116,7 +2155,8 @@
             py.test.skip("requires floats")
         called = []
         def assembler_helper(failindex, virtualizable):
-            assert self.cpu.get_latest_value_float(0) == 1.25 + 3.25
+            x = self.cpu.get_latest_value_float(0)
+            assert longlong.getrealfloat(x) == 1.25 + 3.25
             called.append(failindex)
             return 13.5
 
@@ -2141,10 +2181,11 @@
         looptoken = LoopToken()
         looptoken.outermost_jitdriver_sd = FakeJitDriverSD()
         self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken)
-        self.cpu.set_future_value_float(0, 1.25)
-        self.cpu.set_future_value_float(1, 2.35)
+        self.cpu.set_future_value_float(0, longlong.getfloatstorage(1.25))
+        self.cpu.set_future_value_float(1, longlong.getfloatstorage(2.35))
         res = self.cpu.execute_token(looptoken)
-        assert self.cpu.get_latest_value_float(0) == 1.25 + 2.35
+        x = self.cpu.get_latest_value_float(0)
+        assert longlong.getrealfloat(x) == 1.25 + 2.35
         assert not called
 
         ops = '''
@@ -2158,10 +2199,11 @@
         self.cpu.compile_loop(loop.inputargs, loop.operations, othertoken)
 
         # normal call_assembler: goes to looptoken
-        self.cpu.set_future_value_float(0, 1.25)
-        self.cpu.set_future_value_float(1, 3.25)
+        self.cpu.set_future_value_float(0, longlong.getfloatstorage(1.25))
+        self.cpu.set_future_value_float(1, longlong.getfloatstorage(3.25))
         res = self.cpu.execute_token(othertoken)
-        assert self.cpu.get_latest_value_float(0) == 13.5
+        x = self.cpu.get_latest_value_float(0)
+        assert longlong.getrealfloat(x) == 13.5
         assert called
         del called[:]
 
@@ -2179,10 +2221,12 @@
         self.cpu.redirect_call_assembler(looptoken, looptoken2)
 
         # now, our call_assembler should go to looptoken2
-        self.cpu.set_future_value_float(0, 6.0)
-        self.cpu.set_future_value_float(1, 1.5)    # 6.0-1.5 == 1.25+3.25
+        self.cpu.set_future_value_float(0, longlong.getfloatstorage(6.0))
+        self.cpu.set_future_value_float(1, longlong.getfloatstorage(1.5))
+                                                       # 6.0-1.5 == 1.25+3.25
         res = self.cpu.execute_token(othertoken)
-        assert self.cpu.get_latest_value_float(0) == 13.5
+        x = self.cpu.get_latest_value_float(0)
+        assert longlong.getrealfloat(x) == 13.5
         assert called
 
     def test_short_result_of_getfield_direct(self):
@@ -2379,6 +2423,66 @@
             assert res.value == expected, (
                 "%r: got %r, expected %r" % (RESTYPE, res.value, expected))
 
+    def test_supports_longlong(self):
+        if sys.maxint > 2147483647:
+            assert not self.cpu.supports_longlong, (
+                "supports_longlong should be False on 64-bit platforms")
+
+    def test_longlong_result_of_call_direct(self):
+        if not self.cpu.supports_longlong:
+            py.test.skip("longlong test")
+        from pypy.translator.tool.cbuild import ExternalCompilationInfo
+        from pypy.rlib.rarithmetic import r_longlong
+        eci = ExternalCompilationInfo(
+            separate_module_sources=["""
+            long long fn_test_result_of_call(long long x)
+            {
+                return x - 100000000000000;
+            }
+            """],
+            export_symbols=['fn_test_result_of_call'])
+        f = rffi.llexternal('fn_test_result_of_call', [lltype.SignedLongLong],
+                            lltype.SignedLongLong,
+                            compilation_info=eci, _nowrapper=True)
+        value = r_longlong(0x7ff05af3307a3fff)
+        expected = r_longlong(0x7ff000001fffffff)
+        assert f(value) == expected
+        #
+        FUNC = self.FuncType([lltype.SignedLongLong], lltype.SignedLongLong)
+        FPTR = self.Ptr(FUNC)
+        calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
+        x = self.cpu.bh_call_f(self.get_funcbox(self.cpu, f).value,
+                               calldescr, None, None, [value])
+        assert x == expected
+
+    def test_longlong_result_of_call_compiled(self):
+        if not self.cpu.supports_longlong:
+            py.test.skip("test of longlong result")
+        from pypy.translator.tool.cbuild import ExternalCompilationInfo
+        from pypy.rlib.rarithmetic import r_longlong
+        eci = ExternalCompilationInfo(
+            separate_module_sources=["""
+            long long fn_test_result_of_call(long long x)
+            {
+                return x - 100000000000000;
+            }
+            """],
+            export_symbols=['fn_test_result_of_call'])
+        f = rffi.llexternal('fn_test_result_of_call', [lltype.SignedLongLong],
+                            lltype.SignedLongLong,
+                            compilation_info=eci, _nowrapper=True)
+        value = r_longlong(0x7ff05af3307a3fff)
+        expected = r_longlong(0x7ff000001fffffff)
+        assert f(value) == expected
+        #
+        FUNC = self.FuncType([lltype.SignedLongLong], lltype.SignedLongLong)
+        FPTR = self.Ptr(FUNC)
+        calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
+        funcbox = self.get_funcbox(self.cpu, f)
+        res = self.execute_operation(rop.CALL, [funcbox, BoxFloat(value)],
+                                     'float', descr=calldescr)
+        assert res.getfloatstorage() == expected
+
     def test_free_loop_and_bridges(self):
         from pypy.jit.backend.llsupport.llmodel import AbstractLLCPU
         if not isinstance(self.cpu, AbstractLLCPU):

diff --git a/pypy/jit/backend/llsupport/test/test_descr.py b/pypy/jit/backend/llsupport/test/test_descr.py
--- a/pypy/jit/backend/llsupport/test/test_descr.py
+++ b/pypy/jit/backend/llsupport/test/test_descr.py
@@ -5,6 +5,7 @@
 from pypy.rpython.annlowlevel import llhelper
 from pypy.jit.metainterp.history import BoxInt, BoxFloat, BoxPtr
 from pypy.jit.metainterp import history
+from pypy.jit.codewriter import longlong
 import sys, struct, py
 
 def test_get_size_descr():
@@ -248,7 +249,7 @@
     #
     descr6 = get_call_descr(c0, [lltype.Signed], lltype.SignedLongLong)
     assert descr6.get_result_size(False) == 8
-    assert descr6.get_return_type() == history.FLOAT
+    assert descr6.get_return_type() == "L"
     assert descr6.arg_classes == "i"
 
 def test_get_call_descr_translated():
@@ -351,5 +352,5 @@
     opaquea = lltype.cast_opaque_ptr(llmemory.GCREF, a)
     a[0] = 1
     res = descr2.call_stub(rffi.cast(lltype.Signed, fnptr),
-                           [], [opaquea], [3.5])
-    assert res == 4.5
+                           [], [opaquea], [longlong.getfloatstorage(3.5)])
+    assert longlong.getrealfloat(res) == 4.5

diff --git a/lib-python/conftest.py b/lib-python/conftest.py
--- a/lib-python/conftest.py
+++ b/lib-python/conftest.py
@@ -696,6 +696,8 @@
                 cmd += ' --pdb'
             if self.config.option.capture == 'no':
                 status = os.system(cmd)
+                stdout.write('')
+                stderr.write('')
             else:
                 status = os.system("%s >>%s 2>>%s" %(cmd, stdout, stderr))
             if os.WIFEXITED(status):

diff --git a/pypy/jit/backend/llsupport/descr.py b/pypy/jit/backend/llsupport/descr.py
--- a/pypy/jit/backend/llsupport/descr.py
+++ b/pypy/jit/backend/llsupport/descr.py
@@ -5,9 +5,8 @@
 from pypy.jit.metainterp.history import BasicFailDescr, LoopToken, BoxFloat
 from pypy.jit.metainterp import history
 from pypy.jit.metainterp.resoperation import ResOperation, rop
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 from pypy.rlib.rarithmetic import r_longlong, r_ulonglong
-from pypy.rlib.longlong2float import longlong2float, float2longlong
 
 # The point of the class organization in this file is to make instances
 # as compact as possible.  This is done by not storing the field size or
@@ -275,7 +274,10 @@
     def create_call_stub(self, rtyper, RESULT):
         def process(c):
             if c == 'L':
-                return 'float2longlong(%s)' % (process('f'),)
+                assert longlong.supports_longlong
+                c = 'f'
+            elif c == 'f' and longlong.supports_longlong:
+                return 'longlong.getrealfloat(%s)' % (process('L'),)
             arg = 'args_%s[%d]' % (c, seen[c])
             seen[c] += 1
             return arg
@@ -302,7 +304,9 @@
         elif self.get_return_type() == history.REF:
             result = 'lltype.cast_opaque_ptr(llmemory.GCREF, res)'
         elif self.get_return_type() == history.FLOAT:
-            result = 'cast_to_float(res)'
+            result = 'longlong.getfloatstorage(res)'
+        elif self.get_return_type() == 'L':
+            result = 'rffi.cast(lltype.SignedLongLong, res)'
         elif self.get_return_type() == history.VOID:
             result = 'None'
         else:
@@ -321,7 +325,7 @@
         self.call_stub = d['call_stub']
 
     def verify_types(self, args_i, args_r, args_f, return_type):
-        assert self._return_type == return_type
+        assert self._return_type in return_type
         assert self.arg_classes.count('i') == len(args_i or ())
         assert self.arg_classes.count('r') == len(args_r or ())
         assert (self.arg_classes.count('f') +
@@ -330,15 +334,6 @@
     def repr_of_descr(self):
         return '<%s>' % self._clsname
 
-def cast_to_float(x):
-    if isinstance(x, r_longlong):
-        return longlong2float(x)
-    if isinstance(x, r_ulonglong):
-        return longlong2float(rffi.cast(lltype.SignedLongLong, x))
-    assert isinstance(x, float)
-    return x
-cast_to_float._annspecialcase_ = 'specialize:argtype(0)'
-
 
 class BaseIntCallDescr(BaseCallDescr):
     # Base class of the various subclasses of descrs corresponding to
@@ -393,12 +388,13 @@
 class FloatCallDescr(BaseCallDescr):
     _clsname = 'FloatCallDescr'
     _return_type = history.FLOAT
-    call_stub = staticmethod(lambda func, args_i, args_r, args_f: 0.0)
+    call_stub = staticmethod(lambda func,args_i,args_r,args_f: longlong.ZEROF)
     def get_result_size(self, translate_support_code):
         return symbolic.get_size(lltype.Float, translate_support_code)
 
 class LongLongCallDescr(FloatCallDescr):
     _clsname = 'LongLongCallDescr'
+    _return_type = 'L'
 
 class VoidCallDescr(BaseCallDescr):
     _clsname = 'VoidCallDescr'

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/jit/metainterp/blackhole.py b/pypy/jit/metainterp/blackhole.py
--- a/pypy/jit/metainterp/blackhole.py
+++ b/pypy/jit/metainterp/blackhole.py
@@ -7,7 +7,7 @@
 from pypy.rpython.lltypesystem.lloperation import llop
 from pypy.rpython.llinterp import LLException
 from pypy.jit.codewriter.jitcode import JitCode, SwitchDictDescr
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 from pypy.jit.metainterp.jitexc import JitException, get_llexception, reraise
 from pypy.jit.metainterp.compile import ResumeAtPositionDescr
 
@@ -204,7 +204,7 @@
                 assert argcodes[next_argcode] == '>'
                 assert argcodes[next_argcode + 1] == 'f'
                 next_argcode = next_argcode + 2
-                assert lltype.typeOf(result) is lltype.Float
+                assert lltype.typeOf(result) is longlong.FLOATSTORAGE
                 self.registers_f[ord(code[position])] = result
                 position += 1
             elif resulttype == 'L':
@@ -252,7 +252,7 @@
         if we_are_translated():
             default_i = 0
             default_r = NULL
-            default_f = 0.0
+            default_f = longlong.ZEROF
         else:
             default_i = MissingValue()
             default_r = MissingValue()
@@ -281,12 +281,15 @@
         self.position = position
 
     def setarg_i(self, index, value):
+        assert lltype.typeOf(value) is lltype.Signed
         self.registers_i[index] = value
 
     def setarg_r(self, index, value):
+        assert lltype.typeOf(value) == llmemory.GCREF
         self.registers_r[index] = value
 
     def setarg_f(self, index, value):
+        assert lltype.typeOf(value) is longlong.FLOATSTORAGE
         self.registers_f[index] = value
 
     def run(self):
@@ -535,52 +538,82 @@
 
     @arguments("f", returns="f")
     def bhimpl_float_neg(a):
-        return -a
+        a = longlong.getrealfloat(a)
+        x = -a
+        return longlong.getfloatstorage(x)
     @arguments("f", returns="f")
     def bhimpl_float_abs(a):
-        return abs(a)
+        a = longlong.getrealfloat(a)
+        x = abs(a)
+        return longlong.getfloatstorage(x)
 
     @arguments("f", "f", returns="f")
     def bhimpl_float_add(a, b):
-        return a + b
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
+        x = a + b
+        return longlong.getfloatstorage(x)
     @arguments("f", "f", returns="f")
     def bhimpl_float_sub(a, b):
-        return a - b
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
+        x = a - b
+        return longlong.getfloatstorage(x)
     @arguments("f", "f", returns="f")
     def bhimpl_float_mul(a, b):
-        return a * b
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
+        x = a * b
+        return longlong.getfloatstorage(x)
     @arguments("f", "f", returns="f")
     def bhimpl_float_truediv(a, b):
-        return a / b
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
+        x = a / b
+        return longlong.getfloatstorage(x)
 
     @arguments("f", "f", returns="i")
     def bhimpl_float_lt(a, b):
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
         return a < b
     @arguments("f", "f", returns="i")
     def bhimpl_float_le(a, b):
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
         return a <= b
     @arguments("f", "f", returns="i")
     def bhimpl_float_eq(a, b):
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
         return a == b
     @arguments("f", "f", returns="i")
     def bhimpl_float_ne(a, b):
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
         return a != b
     @arguments("f", "f", returns="i")
     def bhimpl_float_gt(a, b):
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
         return a > b
     @arguments("f", "f", returns="i")
     def bhimpl_float_ge(a, b):
+        a = longlong.getrealfloat(a)
+        b = longlong.getrealfloat(b)
         return a >= b
 
     @arguments("f", returns="i")
     def bhimpl_cast_float_to_int(a):
+        a = longlong.getrealfloat(a)
         # note: we need to call int() twice to care for the fact that
         # int(-2147483648.0) returns a long :-(
         return int(int(a))
 
     @arguments("i", returns="f")
     def bhimpl_cast_int_to_float(a):
-        return float(a)
+        x = float(a)
+        return longlong.getfloatstorage(x)
 
     # ----------
     # control flow operations
@@ -1262,10 +1295,13 @@
     # connect the return of values from the called frame to the
     # 'xxx_call_yyy' instructions from the caller frame
     def _setup_return_value_i(self, result):
+        assert lltype.typeOf(result) is lltype.Signed
         self.registers_i[ord(self.jitcode.code[self.position-1])] = result
     def _setup_return_value_r(self, result):
+        assert lltype.typeOf(result) == llmemory.GCREF
         self.registers_r[ord(self.jitcode.code[self.position-1])] = result
     def _setup_return_value_f(self, result):
+        assert lltype.typeOf(result) is longlong.FLOATSTORAGE
         self.registers_f[ord(self.jitcode.code[self.position-1])] = result
 
     def _done_with_this_frame(self):
@@ -1329,7 +1365,7 @@
         for i in range(self.jitcode.num_regs_f()):
             box = miframe.registers_f[i]
             if box is not None:
-                self.setarg_f(i, box.getfloat())
+                self.setarg_f(i, box.getfloatstorage())
 
 # ____________________________________________________________
 

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -17,6 +17,7 @@
 ^pypy/doc/.+\.html$
 ^pypy/doc/basicblock\.asc$
 ^pypy/doc/.+\.svninfo$
+^pypy/translator/c/src/dtoa.o$
 ^pypy/translator/c/src/libffi_msvc/.+\.obj$
 ^pypy/translator/c/src/libffi_msvc/.+\.dll$
 ^pypy/translator/c/src/libffi_msvc/.+\.lib$
@@ -60,4 +61,4 @@
 ^pypy/doc/image/lattice3\.png$
 ^pypy/doc/image/stackless_informal\.png$
 ^pypy/doc/image/parsing_example.+\.png$
-^compiled
\ No newline at end of file
+^compiled

diff --git a/pypy/jit/backend/llsupport/llmodel.py b/pypy/jit/backend/llsupport/llmodel.py
--- a/pypy/jit/backend/llsupport/llmodel.py
+++ b/pypy/jit/backend/llsupport/llmodel.py
@@ -7,7 +7,7 @@
 from pypy.jit.metainterp.history import BoxInt, BoxPtr, set_future_values,\
      BoxFloat
 from pypy.jit.metainterp import history
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 from pypy.jit.backend.model import AbstractCPU
 from pypy.jit.backend.llsupport import symbolic
 from pypy.jit.backend.llsupport.symbolic import WORD, unroll_basic_sizes
@@ -315,7 +315,7 @@
         ofs = self.unpack_arraydescr(arraydescr)
         # --- start of GC unsafe code (no GC operation!) ---
         items = rffi.ptradd(rffi.cast(rffi.CCHARP, gcref), ofs)
-        items = rffi.cast(rffi.CArrayPtr(lltype.Float), items)
+        items = rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), items)
         fval = items[itemindex]
         # --- end of GC unsafe code ---
         return fval
@@ -348,7 +348,7 @@
         ofs = self.unpack_arraydescr(arraydescr)
         # --- start of GC unsafe code (no GC operation!) ---
         items = rffi.ptradd(rffi.cast(rffi.CCHARP, gcref), ofs)
-        items = rffi.cast(rffi.CArrayPtr(lltype.Float), items)
+        items = rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), items)
         items[itemindex] = newvalue
         # --- end of GC unsafe code ---
 
@@ -410,7 +410,7 @@
         ofs = self.unpack_fielddescr(fielddescr)
         # --- start of GC unsafe code (no GC operation!) ---
         fieldptr = rffi.ptradd(rffi.cast(rffi.CCHARP, struct), ofs)
-        fval = rffi.cast(rffi.CArrayPtr(lltype.Float), fieldptr)[0]
+        fval = rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), fieldptr)[0]
         # --- end of GC unsafe code ---
         return fval
 
@@ -452,7 +452,7 @@
         ofs = self.unpack_fielddescr(fielddescr)
         # --- start of GC unsafe code (no GC operation!) ---
         fieldptr = rffi.ptradd(rffi.cast(rffi.CCHARP, struct), ofs)
-        fieldptr = rffi.cast(rffi.CArrayPtr(lltype.Float), fieldptr)
+        fieldptr = rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), fieldptr)
         fieldptr[0] = newvalue
         # --- end of GC unsafe code ---
 
@@ -509,9 +509,9 @@
         return calldescr.call_stub(func, args_i, args_r, args_f)
 
     def bh_call_f(self, func, calldescr, args_i, args_r, args_f):
-        assert isinstance(calldescr, FloatCallDescr)
+        assert isinstance(calldescr, FloatCallDescr)  # or LongLongCallDescr
         if not we_are_translated():
-            calldescr.verify_types(args_i, args_r, args_f, history.FLOAT)
+            calldescr.verify_types(args_i, args_r, args_f, history.FLOAT + 'L')
         return calldescr.call_stub(func, args_i, args_r, args_f)
 
     def bh_call_v(self, func, calldescr, args_i, args_r, args_f):

diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py
--- a/pypy/jit/metainterp/compile.py
+++ b/pypy/jit/metainterp/compile.py
@@ -15,7 +15,7 @@
 from pypy.jit.metainterp.typesystem import llhelper, oohelper
 from pypy.jit.metainterp.optimizeutil import InvalidLoop
 from pypy.jit.metainterp.resume import NUMBERING
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 
 def giveup():
     from pypy.jit.metainterp.pyjitpl import SwitchToBlackhole
@@ -528,7 +528,7 @@
 class ResumeGuardCountersFloat(AbstractResumeGuardCounters):
     def __init__(self):
         self.counters = [0] * 5
-        self.values = [0.0] * 5
+        self.values = [longlong.ZEROF] * 5
     see_float = func_with_new_name(_see, 'see_float')
 
 

diff --git a/pypy/jit/metainterp/test/test_resume.py b/pypy/jit/metainterp/test/test_resume.py
--- a/pypy/jit/metainterp/test/test_resume.py
+++ b/pypy/jit/metainterp/test/test_resume.py
@@ -8,7 +8,7 @@
 from pypy.jit.metainterp.history import ConstPtr, ConstFloat
 from pypy.jit.metainterp.test.test_optimizeutil import LLtypeMixin
 from pypy.jit.metainterp import executor
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 
 class Storage:
     rd_frame_info_list = None
@@ -114,7 +114,7 @@
                         callback_i(index, count_i); count_i += 1
                     elif ARG == llmemory.GCREF:
                         callback_r(index, count_r); count_r += 1
-                    elif ARG == lltype.Float:
+                    elif ARG == longlong.FLOATSTORAGE:
                         callback_f(index, count_f); count_f += 1
                     else:
                         assert 0
@@ -137,7 +137,8 @@
     reader.consume_one_section(bh)
     expected_i = [x for x in expected if lltype.typeOf(x) == lltype.Signed]
     expected_r = [x for x in expected if lltype.typeOf(x) == llmemory.GCREF]
-    expected_f = [x for x in expected if lltype.typeOf(x) == lltype.Float]
+    expected_f = [x for x in expected if lltype.typeOf(x) ==
+                                                      longlong.FLOATSTORAGE]
     assert bh.written_i == expected_i
     assert bh.written_r == expected_r
     assert bh.written_f == expected_f
@@ -749,7 +750,7 @@
 
 def test_ResumeDataLoopMemo_other():
     memo = ResumeDataLoopMemo(FakeMetaInterpStaticData())
-    const = ConstFloat(-1.0)
+    const = ConstFloat(longlong.getfloatstorage(-1.0))
     tagged = memo.getconst(const)
     index, tagbits = untag(tagged)
     assert tagbits == TAGCONST

diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py
--- a/pypy/jit/metainterp/warmspot.py
+++ b/pypy/jit/metainterp/warmspot.py
@@ -23,7 +23,7 @@
 from pypy.jit.metainterp.jitprof import Profiler, EmptyProfiler
 from pypy.jit.metainterp.jitexc import JitException
 from pypy.jit.metainterp.jitdriver import JitDriverStaticData
-from pypy.jit.codewriter import support, codewriter
+from pypy.jit.codewriter import support, codewriter, longlong
 from pypy.jit.codewriter.policy import JitPolicy
 
 # ____________________________________________________________
@@ -344,7 +344,7 @@
 
         class DoneWithThisFrameFloat(JitException):
             def __init__(self, result):
-                assert lltype.typeOf(result) is lltype.Float
+                assert lltype.typeOf(result) is longlong.FLOATSTORAGE
                 self.result = result
             def __str__(self):
                 return 'DoneWithThisFrameFloat(%s)' % (self.result,)

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/jit/backend/model.py b/pypy/jit/backend/model.py
--- a/pypy/jit/backend/model.py
+++ b/pypy/jit/backend/model.py
@@ -189,12 +189,6 @@
     def typedescrof(TYPE):
         raise NotImplementedError
 
-    #def cast_adr_to_int(self, adr):
-    #    raise NotImplementedError
-
-    #def cast_int_to_adr(self, int):
-    #    raise NotImplementedError
-
     # ---------- the backend-dependent operations ----------
 
     # lltype specific operations

diff --git a/pypy/module/signal/interp_signal.py b/pypy/module/signal/interp_signal.py
--- a/pypy/module/signal/interp_signal.py
+++ b/pypy/module/signal/interp_signal.py
@@ -1,5 +1,5 @@
 from __future__ import with_statement
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import OperationError, exception_from_errno
 from pypy.interpreter.baseobjspace import W_Root, ObjSpace
 from pypy.interpreter.executioncontext import AsyncAction, AbstractActionFlag
 from pypy.interpreter.executioncontext import PeriodicAsyncAction
@@ -35,6 +35,7 @@
     include_dirs = [str(py.path.local(autopath.pypydir).join('translator', 'c'))],
     export_symbols = ['pypysig_poll', 'pypysig_default',
                       'pypysig_ignore', 'pypysig_setflag',
+                      'pypysig_reinstall',
                       'pypysig_set_wakeup_fd',
                       'pypysig_getaddr_occurred'],
 )
@@ -65,6 +66,7 @@
 pypysig_ignore = external('pypysig_ignore', [rffi.INT], lltype.Void)
 pypysig_default = external('pypysig_default', [rffi.INT], lltype.Void)
 pypysig_setflag = external('pypysig_setflag', [rffi.INT], lltype.Void)
+pypysig_reinstall = external('pypysig_reinstall', [rffi.INT], lltype.Void)
 pypysig_set_wakeup_fd = external('pypysig_set_wakeup_fd', [rffi.INT], rffi.INT)
 pypysig_poll = external('pypysig_poll', [], rffi.INT, threadsafe=False)
 # don't bother releasing the GIL around a call to pypysig_poll: it's
@@ -150,7 +152,7 @@
         except KeyError:
             return    # no handler, ignore signal
         # re-install signal handler, for OSes that clear it
-        pypysig_setflag(n)
+        pypysig_reinstall(n)
         # invoke the app-level handler
         space = self.space
         ec = space.getexecutioncontext()
@@ -303,6 +305,10 @@
     w_interval = space.wrap(double_from_timeval(val.c_it_interval))
     return space.newtuple([w_value, w_interval])
 
+def get_itimer_error(space):
+    mod = space.getbuiltinmodule("signal")
+    return space.getattr(mod, space.wrap("ItimerError"))
+
 @jit.dont_look_inside
 @unwrap_spec(ObjSpace, int, float, float)
 def setitimer(space, which, first, interval=0):
@@ -313,7 +319,10 @@
 
         with lltype.scoped_alloc(itimervalP.TO, 1) as old:
 
-            c_setitimer(which, new, old)
+            ret = c_setitimer(which, new, old)
+            if ret != 0:
+                raise exception_from_errno(space, get_itimer_error(space))
+
 
             return itimer_retval(space, old[0])
 

diff --git a/pypy/jit/tool/oparser.py b/pypy/jit/tool/oparser.py
--- a/pypy/jit/tool/oparser.py
+++ b/pypy/jit/tool/oparser.py
@@ -9,6 +9,7 @@
 from pypy.jit.metainterp.resoperation import rop, ResOperation, ResOpWithDescr, N_aryOp
 from pypy.jit.metainterp.typesystem import llhelper
 from pypy.jit.codewriter.heaptracker import adr2int
+from pypy.jit.codewriter import longlong
 from pypy.rpython.lltypesystem import lltype, llmemory
 from pypy.rpython.ootypesystem import ootype
 
@@ -160,7 +161,7 @@
             return ConstInt(int(arg))
         except ValueError:
             if self.is_float(arg):
-                return ConstFloat(float(arg))
+                return ConstFloat(longlong.getfloatstorage(float(arg)))
             if (arg.startswith('"') or arg.startswith("'") or
                 arg.startswith('s"')):
                 # XXX ootype

diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -38,6 +38,7 @@
 from pypy.jit.backend.x86.jump import remap_frame_layout
 from pypy.jit.metainterp.history import ConstInt, BoxInt
 from pypy.jit.codewriter.effectinfo import EffectInfo
+from pypy.jit.codewriter import longlong
 
 # darwin requires the stack to be 16 bytes aligned on calls. Same for gcc 4.5.0,
 # better safe than sorry
@@ -71,7 +72,8 @@
         self.malloc_unicode_func_addr = 0
         self.fail_boxes_int = values_array(lltype.Signed, failargs_limit)
         self.fail_boxes_ptr = values_array(llmemory.GCREF, failargs_limit)
-        self.fail_boxes_float = values_array(lltype.Float, failargs_limit)
+        self.fail_boxes_float = values_array(longlong.FLOATSTORAGE,
+                                             failargs_limit)
         self.fail_ebp = 0
         self.loop_run_counters = []
         self.float_const_neg_addr = 0
@@ -1151,24 +1153,11 @@
             self.mc.MOVD_xr(loc2.value, edx.value)
             self.mc.PUNPCKLDQ_xx(resloc.value, loc2.value)
 
-    def genop_llong_from_two_ints(self, op, arglocs, resloc):
+    def genop_llong_from_uint(self, op, arglocs, resloc):
+        loc1, = arglocs
         assert isinstance(resloc, RegLoc)
-        loc1, loc2, loc3 = arglocs
-        #
-        if isinstance(loc1, ConstFloatLoc):
-            self.mc.MOVSD(resloc, loc1)
-        else:
-            assert isinstance(loc1, RegLoc)
-            self.mc.MOVD_xr(resloc.value, loc1.value)
-        #
-        if loc2 is not None:
-            assert isinstance(loc3, RegLoc)
-            if isinstance(loc2, ConstFloatLoc):
-                self.mc.MOVSD(loc3, loc2)
-            else:
-                assert isinstance(loc2, RegLoc)
-                self.mc.MOVD_xr(loc3.value, loc2.value)
-            self.mc.PUNPCKLDQ_xx(resloc.value, loc3.value)
+        assert isinstance(loc1, RegLoc)
+        self.mc.MOVD_xr(resloc.value, loc1.value)
 
     def genop_llong_eq(self, op, arglocs, resloc):
         loc1, loc2, locxtmp = arglocs
@@ -1814,11 +1803,13 @@
 
         if IS_X86_32 and isinstance(resloc, StackLoc) and resloc.width == 8:
             # a float or a long long return
-            from pypy.jit.backend.llsupport.descr import LongLongCallDescr
-            if isinstance(op.getdescr(), LongLongCallDescr):
+            if op.getdescr().get_return_type() == 'L':
                 self.mc.MOV_br(resloc.value, eax.value)      # long long
                 self.mc.MOV_br(resloc.value + 4, edx.value)
-                # XXX should ideally not move the result on the stack
+                # XXX should ideally not move the result on the stack,
+                #     but it's a mess to load eax/edx into a xmm register
+                #     and this way is simpler also because the result loc
+                #     can just be always a stack location
             else:
                 self.mc.FSTP_b(resloc.value)   # float return
         elif size == WORD:

diff --git a/pypy/jit/codewriter/support.py b/pypy/jit/codewriter/support.py
--- a/pypy/jit/codewriter/support.py
+++ b/pypy/jit/codewriter/support.py
@@ -300,9 +300,8 @@
 def _ll_1_llong_from_int(x):
     return r_longlong(intmask(x))
 
-def _ll_2_llong_from_two_ints(x_lo, x_hi):
-    z = (r_ulonglong(r_uint(x_hi)) << 32) | r_ulonglong(r_uint(x_lo))
-    return u_to_longlong(z)
+def _ll_1_llong_from_uint(x):
+    return r_longlong(r_uint(x))
 
 def _ll_1_llong_to_int(xll):
     return intmask(xll)

diff --git a/pypy/translator/tool/cbuild.py b/pypy/translator/tool/cbuild.py
--- a/pypy/translator/tool/cbuild.py
+++ b/pypy/translator/tool/cbuild.py
@@ -281,7 +281,8 @@
                 return self
             basepath = udir.join('module_cache')
         else:
-            basepath = py.path.local(self.separate_module_files[0]).dirpath()
+            #basepath = py.path.local(self.separate_module_files[0]).dirpath()
+            basepath = udir.join('shared_cache')
         if outputfilename is None:
             # find more or less unique name there
             pth = basepath.join('externmod').new(ext=host.so_ext)
@@ -290,7 +291,8 @@
                 pth = basepath.join(
                     'externmod_%d' % (num,)).new(ext=host.so_ext)
                 num += 1
-            outputfilename=pth.purebasename
+            basepath.ensure(dir=1)
+            outputfilename = str(pth.dirpath().join(pth.purebasename))
         lib = str(host.compile([], self, outputfilename=outputfilename,
                                standalone=False))
         d = self._copy_attributes()


More information about the Pypy-commit mailing list