[pypy-commit] pypy default: merge
fijal
noreply at buildbot.pypy.org
Mon Mar 19 10:21:04 CET 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r53799:886c48057ff1
Date: 2012-03-19 11:20 +0200
http://bitbucket.org/pypy/pypy/changeset/886c48057ff1/
Log: merge
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
@@ -1496,13 +1496,30 @@
c_nest, c_nest], 'void')
def test_read_timestamp(self):
+ if sys.platform == 'win32':
+ # windows quite often is very inexact (like the old Intel 8259 PIC),
+ # so we stretch the time a little bit.
+ # On my virtual Parallels machine in a 2GHz Core i7 Mac Mini,
+ # the test starts working at delay == 21670 and stops at 20600000.
+ # We take the geometric mean value.
+ from math import log, exp
+ delay_min = 21670
+ delay_max = 20600000
+ delay = int(exp((log(delay_min)+log(delay_max))/2))
+ def wait_a_bit():
+ for i in xrange(delay): pass
+ else:
+ def wait_a_bit():
+ pass
if longlong.is_64_bit:
got1 = self.execute_operation(rop.READ_TIMESTAMP, [], 'int')
+ wait_a_bit()
got2 = self.execute_operation(rop.READ_TIMESTAMP, [], 'int')
res1 = got1.getint()
res2 = got2.getint()
else:
got1 = self.execute_operation(rop.READ_TIMESTAMP, [], 'float')
+ wait_a_bit()
got2 = self.execute_operation(rop.READ_TIMESTAMP, [], 'float')
res1 = got1.getlonglong()
res2 = got2.getlonglong()
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
@@ -836,8 +836,8 @@
self.mc.MOVSD_sx(0, loc.value)
elif WORD == 4 and isinstance(loc, StackLoc) and loc.get_width() == 8:
# XXX evil trick
- self.mc.PUSH_b(get_ebp_ofs(loc.position))
- self.mc.PUSH_b(get_ebp_ofs(loc.position + 1))
+ self.mc.PUSH_b(loc.value + 4)
+ self.mc.PUSH_b(loc.value)
else:
self.mc.PUSH(loc)
@@ -847,8 +847,8 @@
self.mc.ADD_ri(esp.value, 8) # = size of doubles
elif WORD == 4 and isinstance(loc, StackLoc) and loc.get_width() == 8:
# XXX evil trick
- self.mc.POP_b(get_ebp_ofs(loc.position + 1))
- self.mc.POP_b(get_ebp_ofs(loc.position))
+ self.mc.POP_b(loc.value)
+ self.mc.POP_b(loc.value + 4)
else:
self.mc.POP(loc)
@@ -1954,8 +1954,6 @@
mc.PUSH_r(ebx.value)
elif IS_X86_64:
mc.MOV_rr(edi.value, ebx.value)
- # XXX: Correct to only align the stack on 64-bit?
- mc.AND_ri(esp.value, -16)
else:
raise AssertionError("Shouldn't happen")
@@ -2117,9 +2115,12 @@
# First, we need to save away the registers listed in
# 'save_registers' that are not callee-save. XXX We assume that
# the XMM registers won't be modified. We store them in
- # [ESP+4], [ESP+8], etc., leaving enough room in [ESP] for the
- # single argument to closestack_addr below.
- p = WORD
+ # [ESP+4], [ESP+8], etc.; on x86-32 we leave enough room in [ESP]
+ # for the single argument to closestack_addr below.
+ if IS_X86_32:
+ p = WORD
+ elif IS_X86_64:
+ p = 0
for reg in self._regalloc.rm.save_around_call_regs:
if reg in save_registers:
self.mc.MOV_sr(p, reg.value)
@@ -2174,7 +2175,10 @@
#
self._emit_call(-1, imm(self.releasegil_addr), args)
# Finally, restore the registers saved above.
- p = WORD
+ if IS_X86_32:
+ p = WORD
+ elif IS_X86_64:
+ p = 0
for reg in self._regalloc.rm.save_around_call_regs:
if reg in save_registers:
self.mc.MOV_rs(reg.value, p)
diff --git a/pypy/objspace/std/iterobject.py b/pypy/objspace/std/iterobject.py
--- a/pypy/objspace/std/iterobject.py
+++ b/pypy/objspace/std/iterobject.py
@@ -22,7 +22,7 @@
index = self.index
w_length = space.len(self.w_seq)
w_len = space.sub(w_length, space.wrap(index))
- if space.is_true(space.lt(w_len,space.wrap(0))):
+ if space.is_true(space.lt(w_len, space.wrap(0))):
w_len = space.wrap(0)
return w_len
@@ -30,21 +30,21 @@
"""Sequence iterator implementation for general sequences."""
class W_FastListIterObject(W_AbstractSeqIterObject):
- """Sequence iterator specialized for lists, accessing
- directly their RPython-level list of wrapped objects.
+ """Sequence iterator specialized for lists, accessing directly their
+ RPython-level list of wrapped objects.
"""
class W_FastTupleIterObject(W_AbstractSeqIterObject):
- """Sequence iterator specialized for tuples, accessing
- directly their RPython-level list of wrapped objects.
- """
- def __init__(w_self, w_seq, wrappeditems):
+ """Sequence iterator specialized for tuples, accessing directly
+ their RPython-level list of wrapped objects.
+ """
+ def __init__(w_self, w_seq, wrappeditems):
W_AbstractSeqIterObject.__init__(w_self, w_seq)
w_self.tupleitems = wrappeditems
class W_ReverseSeqIterObject(W_Object):
from pypy.objspace.std.itertype import reverse_iter_typedef as typedef
-
+
def __init__(w_self, space, w_seq, index=-1):
w_self.w_seq = w_seq
w_self.w_len = space.len(w_seq)
@@ -61,15 +61,15 @@
def next__SeqIter(space, w_seqiter):
if w_seqiter.w_seq is None:
- raise OperationError(space.w_StopIteration, space.w_None)
+ raise OperationError(space.w_StopIteration, space.w_None)
try:
w_item = space.getitem(w_seqiter.w_seq, space.wrap(w_seqiter.index))
except OperationError, e:
w_seqiter.w_seq = None
if not e.match(space, space.w_IndexError):
raise
- raise OperationError(space.w_StopIteration, space.w_None)
- w_seqiter.index += 1
+ raise OperationError(space.w_StopIteration, space.w_None)
+ w_seqiter.index += 1
return w_item
# XXX __length_hint__()
@@ -89,7 +89,7 @@
except IndexError:
w_seqiter.tupleitems = None
w_seqiter.w_seq = None
- raise OperationError(space.w_StopIteration, space.w_None)
+ raise OperationError(space.w_StopIteration, space.w_None)
w_seqiter.index = index + 1
return w_item
@@ -112,7 +112,7 @@
w_item = w_seq.getitem(index)
except IndexError:
w_seqiter.w_seq = None
- raise OperationError(space.w_StopIteration, space.w_None)
+ raise OperationError(space.w_StopIteration, space.w_None)
w_seqiter.index = index + 1
return w_item
@@ -126,15 +126,15 @@
def next__ReverseSeqIter(space, w_seqiter):
if w_seqiter.w_seq is None or w_seqiter.index < 0:
- raise OperationError(space.w_StopIteration, space.w_None)
+ raise OperationError(space.w_StopIteration, space.w_None)
try:
w_item = space.getitem(w_seqiter.w_seq, space.wrap(w_seqiter.index))
- w_seqiter.index -= 1
+ w_seqiter.index -= 1
except OperationError, e:
w_seqiter.w_seq = None
if not e.match(space, space.w_IndexError):
raise
- raise OperationError(space.w_StopIteration, space.w_None)
+ raise OperationError(space.w_StopIteration, space.w_None)
return w_item
# XXX __length_hint__()
More information about the pypy-commit
mailing list