Author: Armin Rigo <[email protected]>
Branch:
Changeset: r67890:552cf038d95c
Date: 2013-11-09 10:34 +0100
http://bitbucket.org/pypy/pypy/changeset/552cf038d95c/
Log: merge heads
diff --git a/pypy/module/array/interp_array.py
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -410,7 +410,6 @@
def descr_getslice(self, space, w_i, w_j):
return space.getitem(self, space.newslice(w_i, w_j, space.w_None))
-
def descr_setitem(self, space, w_idx, w_item):
"x.__setitem__(i, y) <==> x[i]=y"
if space.isinstance_w(w_idx, space.w_slice):
@@ -913,10 +912,18 @@
return space.w_NotImplemented
a = mytype.w_class(space)
a.setlen(self.len + w_other.len, overallocate=False)
- for i in range(self.len):
- a.buffer[i] = self.buffer[i]
- for i in range(w_other.len):
- a.buffer[i + self.len] = w_other.buffer[i]
+ if self.len:
+ rffi.c_memcpy(
+ rffi.cast(rffi.VOIDP, a.buffer),
+ rffi.cast(rffi.VOIDP, self.buffer),
+ self.len * mytype.bytes
+ )
+ if w_other.len:
+ rffi.c_memcpy(
+ rffi.cast(rffi.VOIDP, rffi.ptradd(a.buffer, self.len)),
+ rffi.cast(rffi.VOIDP, w_other.buffer),
+ w_other.len * mytype.bytes
+ )
return a
def descr_inplace_add(self, space, w_other):
@@ -925,8 +932,12 @@
oldlen = self.len
otherlen = w_other.len
self.setlen(oldlen + otherlen)
- for i in range(otherlen):
- self.buffer[oldlen + i] = w_other.buffer[i]
+ if otherlen:
+ rffi.c_memcpy(
+ rffi.cast(rffi.VOIDP, rffi.ptradd(self.buffer, oldlen)),
+ rffi.cast(rffi.VOIDP, w_other.buffer),
+ otherlen * mytype.bytes
+ )
return self
def descr_mul(self, space, w_repeat):
diff --git a/rpython/jit/metainterp/heapcache.py
b/rpython/jit/metainterp/heapcache.py
--- a/rpython/jit/metainterp/heapcache.py
+++ b/rpython/jit/metainterp/heapcache.py
@@ -96,8 +96,13 @@
idx += 1
def _escape(self, box):
- if box in self.new_boxes:
- self.new_boxes[box] = False
+ try:
+ unescaped = self.new_boxes[box]
+ except KeyError:
+ pass
+ else:
+ if unescaped:
+ self.new_boxes[box] = False
try:
deps = self.dependencies.pop(box)
except KeyError:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit