Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy-exe/, dev-python/pypy-exe/files/
Date: Mon, 05 Oct 2020 01:15:23
Message-Id: 1601860278.801e1926501d203432401cf01e49a87e5aef119e.gyakovlev@gentoo
1 commit: 801e1926501d203432401cf01e49a87e5aef119e
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Mon Oct 5 00:30:22 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Mon Oct 5 01:11:18 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=801e1926
7
8 dev-python/pypy-exe: backport ppc64 patch to 3.7.2
9
10 Patches already upstream, fixes segfault in bootstrap.
11 https://foss.heptapod.net/pypy/pypy/-/issues/3309
12
13 Package-Manager: Portage-3.0.8, Repoman-3.0.1
14 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
15
16 .../pypy-exe/files/pypy-7.3.2-ppc64-segfault.patch | 64 ++++++++++++++++++++++
17 dev-python/pypy-exe/pypy-exe-7.3.2.ebuild | 4 ++
18 2 files changed, 68 insertions(+)
19
20 diff --git a/dev-python/pypy-exe/files/pypy-7.3.2-ppc64-segfault.patch b/dev-python/pypy-exe/files/pypy-7.3.2-ppc64-segfault.patch
21 new file mode 100644
22 index 00000000000..c143a3765cd
23 --- /dev/null
24 +++ b/dev-python/pypy-exe/files/pypy-7.3.2-ppc64-segfault.patch
25 @@ -0,0 +1,64 @@
26 +From 913e0dae8ac7ce8219a5f31126fee8a794cc314c Mon Sep 17 00:00:00 2001
27 +From: Armin Rigo <arigo@×××××.org>
28 +Date: Sat, 26 Sep 2020 09:26:24 +0200
29 +Subject: [PATCH] oops, fix for test_gc_indexed_box_plus_large_offset
30 +
31 +---
32 + rpython/jit/backend/ppc/opassembler.py | 16 +++++++++++-----
33 + rpython/jit/backend/ppc/regalloc.py | 4 ++--
34 + 2 files changed, 13 insertions(+), 7 deletions(-)
35 +
36 +diff --git a/rpython/jit/backend/ppc/opassembler.py b/rpython/jit/backend/ppc/opassembler.py
37 +index b79b18e530..4bbfbba93a 100644
38 +--- a/rpython/jit/backend/ppc/opassembler.py
39 ++++ b/rpython/jit/backend/ppc/opassembler.py
40 +@@ -755,13 +755,19 @@ class FieldOpAssembler(object):
41 + def _apply_offset(self, index_loc, ofs_loc):
42 + # If offset != 0 then we have to add it here. Note that
43 + # mc.addi() would not be valid with operand r0.
44 +- assert ofs_loc.is_imm() # must be an immediate...
45 +- assert _check_imm_arg(ofs_loc.getint()) # ...that fits 16 bits
46 + assert index_loc.is_core_reg()
47 + assert index_loc is not r.SCRATCH2
48 +- # (simplified version of _apply_scale())
49 +- if ofs_loc.value > 0:
50 +- self.mc.addi(r.SCRATCH2.value, index_loc.value, ofs_loc.value)
51 ++ if ofs_loc.is_imm():
52 ++ # if it is an immediate, it must fit into 16 bits
53 ++ assert _check_imm_arg(ofs_loc.getint())
54 ++ # (simplified version of _apply_scale())
55 ++ if ofs_loc.value != 0:
56 ++ self.mc.addi(r.SCRATCH2.value, index_loc.value, ofs_loc.value)
57 ++ index_loc = r.SCRATCH2
58 ++ else:
59 ++ # larger immediates are loaded into a register in regalloc.py
60 ++ assert ofs_loc.is_core_reg()
61 ++ self.mc.add(r.SCRATCH2.value, index_loc.value, ofs_loc.value)
62 + index_loc = r.SCRATCH2
63 + return index_loc
64 +
65 +diff --git a/rpython/jit/backend/ppc/regalloc.py b/rpython/jit/backend/ppc/regalloc.py
66 +index f3ee1129e4..827953cf12 100644
67 +--- a/rpython/jit/backend/ppc/regalloc.py
68 ++++ b/rpython/jit/backend/ppc/regalloc.py
69 +@@ -771,7 +771,7 @@ class Regalloc(BaseRegalloc, VectorRegalloc):
70 + value_loc = self.ensure_reg(op.getarg(2))
71 + assert op.getarg(3).getint() == 1 # scale
72 + ofs_loc = self.ensure_reg_or_16bit_imm(op.getarg(4))
73 +- assert ofs_loc.is_imm() # the arg(4) should always be a small constant
74 ++ # the arg(4) is often a small constant, but it may be too large
75 + size_loc = self.ensure_reg_or_any_imm(op.getarg(5))
76 + return [base_loc, index_loc, value_loc, ofs_loc, size_loc]
77 +
78 +@@ -780,7 +780,7 @@ class Regalloc(BaseRegalloc, VectorRegalloc):
79 + index_loc = self.ensure_reg(op.getarg(1))
80 + assert op.getarg(2).getint() == 1 # scale
81 + ofs_loc = self.ensure_reg_or_16bit_imm(op.getarg(3))
82 +- assert ofs_loc.is_imm() # the arg(3) should always be a small constant
83 ++ # the arg(3) is often a small constant, but it may be too large
84 + self.free_op_vars()
85 + res_loc = self.force_allocate_reg(op)
86 + size_box = op.getarg(4)
87 +--
88 +GitLab
89 +
90
91 diff --git a/dev-python/pypy-exe/pypy-exe-7.3.2.ebuild b/dev-python/pypy-exe/pypy-exe-7.3.2.ebuild
92 index c0dee5cf1c6..5f8b73f349d 100644
93 --- a/dev-python/pypy-exe/pypy-exe-7.3.2.ebuild
94 +++ b/dev-python/pypy-exe/pypy-exe-7.3.2.ebuild
95 @@ -59,6 +59,10 @@ check_env() {
96 check-reqs_pkg_pretend
97 }
98
99 +PATCHES=(
100 + "${FILESDIR}"/pypy-7.3.2-ppc64-segfault.patch
101 +)
102 +
103 pkg_pretend() {
104 [[ ${MERGE_TYPE} != binary ]] && check_env
105 }