[pypy-commit] pypy ppc-vsx-support: merge default
plan_rich
pypy.commits at gmail.com
Tue Jul 5 08:49:25 EDT 2016
Author: Richard Plangger <planrichi at gmail.com>
Branch: ppc-vsx-support
Changeset: r85559:ac89a39486d5
Date: 2016-07-05 13:16 +0200
http://bitbucket.org/pypy/pypy/changeset/ac89a39486d5/
Log: merge default
diff --git a/dotviewer/graphparse.py b/dotviewer/graphparse.py
--- a/dotviewer/graphparse.py
+++ b/dotviewer/graphparse.py
@@ -85,10 +85,11 @@
pass
def splitline(line, re_word = re.compile(r'[^\s"]\S*|["]["]|["].*?[^\\]["]')):
+ import ast
result = []
for word in re_word.findall(line):
if word.startswith('"'):
- word = eval(word)
+ word = ast.literal_eval(word)
result.append(word)
return result
diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py
--- a/lib_pypy/datetime.py
+++ b/lib_pypy/datetime.py
@@ -839,7 +839,7 @@
month = self._month
if day is None:
day = self._day
- return date(year, month, day)
+ return date.__new__(type(self), year, month, day)
# Comparisons of date objects with other.
@@ -1356,7 +1356,8 @@
microsecond = self.microsecond
if tzinfo is True:
tzinfo = self.tzinfo
- return time(hour, minute, second, microsecond, tzinfo)
+ return time.__new__(type(self),
+ hour, minute, second, microsecond, tzinfo)
def __nonzero__(self):
if self.second or self.microsecond:
@@ -1566,8 +1567,9 @@
microsecond = self.microsecond
if tzinfo is True:
tzinfo = self.tzinfo
- return datetime(year, month, day, hour, minute, second, microsecond,
- tzinfo)
+ return datetime.__new__(type(self),
+ year, month, day, hour, minute, second,
+ microsecond, tzinfo)
def astimezone(self, tz):
if not isinstance(tz, tzinfo):
diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -78,7 +78,7 @@
else:
libraries = []
if sys.platform.startswith('linux'):
- compile_extra = ["-Werror", "-g", "-O0", "-fPIC"]
+ compile_extra = ["-Werror", "-g", "-O0", "-Wp,-U_FORTIFY_SOURCE", "-fPIC"]
link_extra = ["-g"]
else:
compile_extra = link_extra = None
diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py
--- a/pypy/module/test_lib_pypy/test_datetime.py
+++ b/pypy/module/test_lib_pypy/test_datetime.py
@@ -315,6 +315,51 @@
class sub(datetime.timedelta): pass
assert type(+sub()) is datetime.timedelta
+ def test_subclass_date(self):
+ # replace() should return a subclass but not call __new__ or __init__.
+ class MyDate(datetime.date):
+ forbidden = False
+ def __new__(cls):
+ if cls.forbidden: FAIL
+ return datetime.date.__new__(cls, 2016, 2, 3)
+ def __init__(self, *args):
+ if self.forbidden: FAIL
+ d = MyDate()
+ d.forbidden = True
+ d2 = d.replace(day=5)
+ assert type(d2) is MyDate
+ assert d2 == datetime.date(2016, 2, 5)
+
+ def test_subclass_time(self):
+ # replace() should return a subclass but not call __new__ or __init__.
+ class MyTime(datetime.time):
+ forbidden = False
+ def __new__(cls):
+ if cls.forbidden: FAIL
+ return datetime.time.__new__(cls, 1, 2, 3)
+ def __init__(self, *args):
+ if self.forbidden: FAIL
+ d = MyTime()
+ d.forbidden = True
+ d2 = d.replace(hour=5)
+ assert type(d2) is MyTime
+ assert d2 == datetime.time(5, 2, 3)
+
+ def test_subclass_datetime(self):
+ # replace() should return a subclass but not call __new__ or __init__.
+ class MyDatetime(datetime.datetime):
+ forbidden = False
+ def __new__(cls):
+ if cls.forbidden: FAIL
+ return datetime.datetime.__new__(cls, 2016, 4, 5, 1, 2, 3)
+ def __init__(self, *args):
+ if self.forbidden: FAIL
+ d = MyDatetime()
+ d.forbidden = True
+ d2 = d.replace(hour=7)
+ assert type(d2) is MyDatetime
+ assert d2 == datetime.datetime(2016, 4, 5, 7, 2, 3)
+
class TestDatetimeHost(BaseTestDatetime):
def setup_class(cls):
diff --git a/rpython/jit/backend/llsupport/test/test_gc_integration.py b/rpython/jit/backend/llsupport/test/test_gc_integration.py
--- a/rpython/jit/backend/llsupport/test/test_gc_integration.py
+++ b/rpython/jit/backend/llsupport/test/test_gc_integration.py
@@ -330,6 +330,13 @@
expected_size = 2
idx = 1
fixed_size -= 32
+ if self.cpu.backend_name.startswith('zarch') or \
+ self.cpu.backend_name.startswith('ppc'):
+ # the allocation always allocates the register
+ # into the return register. (e.g. r3 on ppc)
+ # the next malloc_nursery will move r3 to the
+ # frame manager, thus the two bits will be on the frame
+ fixed_size += 4
assert len(frame.jf_gcmap) == expected_size
# check that we have two bits set, and that they are in two
# registers (p0 and p1 are moved away when doing p2, but not
diff --git a/rpython/jit/backend/zarch/arch.py b/rpython/jit/backend/zarch/arch.py
--- a/rpython/jit/backend/zarch/arch.py
+++ b/rpython/jit/backend/zarch/arch.py
@@ -45,10 +45,7 @@
# +------------------------------+ <- assembler begin
# | SAVE CONTEXT |
# +------------------------------+
-# +--+| BRANCH (saves addr of pool |
-# | | in r13) |
-# | +------------------------------+
-# | | ... |
+#start| ... |
# | | LITERAL POOL | <---+
# | | ... | <-+ |
# +-->+------------------------------+ | |
diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py
--- a/rpython/jit/backend/zarch/assembler.py
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -309,11 +309,9 @@
# signature of this _frame_realloc_slowpath function:
# * on entry, r0 is the new size
- # * on entry, r1 is the gcmap
# * no managed register must be modified
- ofs2 = self.cpu.get_ofs_of_frame_field('jf_gcmap')
- mc.STG(r.SCRATCH, l.addr(ofs2, r.SPP))
+ # caller already did push_gcmap(store=True)
self._push_core_regs_to_jitframe(mc, r.MANAGED_REGS)
self._push_fp_regs_to_jitframe(mc)
@@ -347,6 +345,7 @@
mc.load(r.r5, r.r5, 0)
mc.store(r.r2, r.r5, -WORD)
+ self.pop_gcmap(mc) # cancel the push_gcmap(store=True) in the caller
self._pop_core_regs_from_jitframe(mc, r.MANAGED_REGS)
self._pop_fp_regs_from_jitframe(mc)
@@ -411,6 +410,7 @@
reg is not r.r4 and
reg is not r.r5 and
reg is not r.r11]
+ # the caller already did push_gcmap(store=True)
self._push_core_regs_to_jitframe(mc, regs)
if supports_floats:
self._push_fp_regs_to_jitframe(mc)
@@ -420,6 +420,7 @@
# Finish
self._reload_frame_if_necessary(mc)
+ self.pop_gcmap(mc) # cancel the push_gcmap(store=True) in the caller
self._pop_core_regs_from_jitframe(mc, saved_regs)
if supports_floats:
self._pop_fp_regs_from_jitframe(mc)
@@ -449,12 +450,11 @@
mc.store_link()
mc.push_std_frame()
#
- ofs2 = self.cpu.get_ofs_of_frame_field('jf_gcmap')
- mc.STG(r.r1, l.addr(ofs2, r.SPP))
saved_regs = [reg for reg in r.MANAGED_REGS
if reg is not r.RES and reg is not r.RSZ]
self._push_core_regs_to_jitframe(mc, saved_regs)
self._push_fp_regs_to_jitframe(mc)
+ # the caller already did push_gcmap(store=True)
#
if kind == 'fixed':
addr = self.cpu.gc_ll_descr.get_malloc_slowpath_addr()
@@ -502,6 +502,7 @@
# r.RSZ is loaded from [r1], to make the caller's store a no-op here
mc.load(r.RSZ, r.r1, 0)
#
+ self.pop_gcmap(mc) # push_gcmap(store=True) done by the caller
mc.restore_link()
mc.BCR(c.ANY, r.r14)
self.mc = None
@@ -588,7 +589,7 @@
# sum -> (14 bytes)
mc.write('\x00'*14)
mc.load_imm(r.RETURN, self._frame_realloc_slowpath)
- self.load_gcmap(mc, r.r1, gcmap)
+ self.push_gcmap(mc, gcmap, store=True)
mc.raw_call()
self.frame_depth_to_patch.append((patch_pos, mc.currpos()))
@@ -685,6 +686,8 @@
# name = "Loop # %s: %s" % (looptoken.number, loopname)
# self.cpu.profile_agent.native_code_written(name,
# rawstart, full_size)
+ #print(hex(rawstart+looppos))
+ #import pdb; pdb.set_trace()
return AsmInfo(ops_offset, rawstart + looppos,
size_excluding_failure_stuff - looppos, rawstart)
@@ -867,6 +870,10 @@
ofs = self.cpu.get_ofs_of_frame_field('jf_gcmap')
mc.STG(r.SCRATCH, l.addr(ofs, r.SPP))
+ def pop_gcmap(self, mc):
+ ofs = self.cpu.get_ofs_of_frame_field('jf_gcmap')
+ mc.LG(r.SCRATCH, l.addr(ofs, r.SPP))
+
def break_long_loop(self):
# If the loop is too long, the guards in it will jump forward
# more than 32 KB. We use an approximate hack to know if we
@@ -1339,7 +1346,7 @@
# new value of nursery_free_adr in RSZ and the adr of the new object
# in RES.
- self.load_gcmap(mc, r.r1, gcmap)
+ self.push_gcmap(mc, gcmap, store=True)
mc.branch_absolute(self.malloc_slowpath)
# here r1 holds nursery_free_addr
@@ -1375,7 +1382,7 @@
# new value of nursery_free_adr in RSZ and the adr of the new object
# in RES.
- self.load_gcmap(mc, r.r1, gcmap)
+ self.push_gcmap(mc, gcmap, store=True)
mc.branch_absolute(self.malloc_slowpath)
offset = mc.currpos() - fast_jmp_pos
@@ -1468,7 +1475,7 @@
pmc.overwrite()
#
# save the gcmap
- self.load_gcmap(mc, r.r1, gcmap)
+ self.push_gcmap(mc, gcmap, store=True)
#
# load the function into r14 and jump
if kind == rewrite.FLAG_ARRAY:
diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py
--- a/rpython/rlib/ropenssl.py
+++ b/rpython/rlib/ropenssl.py
@@ -586,11 +586,6 @@
HASH_MALLOC_SIZE = EVP_MD_SIZE + EVP_MD_CTX_SIZE \
+ rffi.sizeof(EVP_MD) * 2 + 208
-OBJ_NAME_CALLBACK = lltype.Ptr(lltype.FuncType(
- [OBJ_NAME, rffi.VOIDP], lltype.Void))
-OBJ_NAME_do_all = external(
- 'OBJ_NAME_do_all', [rffi.INT, OBJ_NAME_CALLBACK, rffi.VOIDP], lltype.Void)
-
def init_ssl():
libssl_SSL_load_error_strings()
libssl_SSL_library_init()
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -220,7 +220,7 @@
pass
if _WIN32:
- includes = ['io.h', 'sys/utime.h', 'sys/types.h']
+ includes = ['io.h', 'sys/utime.h', 'sys/types.h', 'process.h']
libraries = []
else:
if sys.platform.startswith(('darwin', 'netbsd', 'openbsd')):
@@ -704,10 +704,10 @@
c_execve = external('execve',
[rffi.CCHARP, rffi.CCHARPP, rffi.CCHARPP], rffi.INT,
save_err=rffi.RFFI_SAVE_ERRNO)
-c_spawnv = external('spawnv',
+c_spawnv = external(UNDERSCORE_ON_WIN32 + 'spawnv',
[rffi.INT, rffi.CCHARP, rffi.CCHARPP], rffi.INT,
save_err=rffi.RFFI_SAVE_ERRNO)
-c_spawnve = external('spawnve',
+c_spawnve = external(UNDERSCORE_ON_WIN32 + 'spawnve',
[rffi.INT, rffi.CCHARP, rffi.CCHARPP, rffi.CCHARPP],
rffi.INT,
save_err=rffi.RFFI_SAVE_ERRNO)
More information about the pypy-commit
mailing list