Merge ~lucaskanashiro/ubuntu/+source/ruby2.5:bionic-arm64-optimization into ubuntu/+source/ruby2.5:ubuntu/bionic-devel

Proposed by Lucas Kanashiro
Status: Merged
Approved by: Lucas Kanashiro
Approved revision: 87b6ba6b1cab4536a638916fb19bd165cf735fd6
Merge reported by: Lucas Kanashiro
Merged at revision: 87b6ba6b1cab4536a638916fb19bd165cf735fd6
Proposed branch: ~lucaskanashiro/ubuntu/+source/ruby2.5:bionic-arm64-optimization
Merge into: ubuntu/+source/ruby2.5:ubuntu/bionic-devel
Diff against target: 397 lines (+331/-1)
8 files modified
debian/changelog (+19/-0)
debian/control (+1/-0)
debian/patches/0029-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-1-.patch (+58/-0)
debian/patches/0030-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-2-.patch (+46/-0)
debian/patches/arm64-optimizations.patch (+179/-0)
debian/patches/series (+3/-0)
debian/tests/bundled-gems (+24/-1)
debian/tests/control (+1/-0)
Reviewer Review Type Date Requested Status
Bryce Harrington (community) Approve
Canonical Server Pending
git-ubuntu developers Pending
Review via email: mp+393470@code.launchpad.net

Description of the change

Apply upstream patch to optimize performance on arm64 in Bionic.

Upstream patch: https://github.com/ruby/ruby/commit/511b55bcefc81c03
LP bug: https://bugs.launchpad.net/ubuntu/+source/ruby2.7/+bug/1901074

I was not able to build this package from the git-ubuntu branch, there is some mismatch with the upstream tarball in the archive. So I am submitting the changes here using the git-ubuntu repo to facilitate the review but I built the package pulling the source package from LP (the changes are the same I am proposing here).

Moreover, I needed to add some extra changes to fix a FTBFS and also DEP-8 tests. I was kind of surprised that autopkgtest never passed for ruby2.5.

PPA: https://launchpad.net/~lucaskanashiro/+archive/ubuntu/ruby2.7-arm64-optimization/+packages

Autopkgtest is still happy:

autopkgtest [17:57:34]: @@@@@@@@@@@@@@@@@@@@ summary
run-all PASS
bundled-gems PASS
builtin-extensions PASS
rubyconfig PASS

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :
Download full text (4.7 KiB)

### Branch Review ###

* Changelog:
  - [-] old content and logical tag match as expected
  - [√] changelog entry correct version and targeted codename
  - [√] changelog entries correct
  - [√] update-maintainer has been run

* Actual changes:
  - [-] no upstream changes to consider
  - [-] no further upstream version to consider
  - [√] debian changes look safe

* Old Delta:
  - [-] dropped changes are ok to be dropped
  - [-] nothing else to drop
  - [-] changes forwarded upstream/debian (if appropriate)

* New Delta:
  - [-] no new patches added
  - [√] patches match what was proposed upstream
  - [√] patches correctly included in debian/patches/series
  - [x] patches have correct DEP3 metadata
    + Need bug links, see below

* Build/Test:
  - [√] build is ok
  - [√] verified PPA package installs/uninstalls
  - [x] autopkgtest against the PPA package passes
    + see below
  - [-] sanity checks test fine

I didn't attempt to build locally from git-ubuntu, but the PPA seems to have built fine. I did try running the autopkgtest locally using the ppa, but it fails on the run-all test:

autopkgtest [22:24:33]: test rubyconfig: -----------------------]
autopkgtest [22:24:33]: test rubyconfig: - - - - - - - - - - results - - - - - - - - - -
rubyconfig PASS
autopkgtest [22:24:33]: @@@@@@@@@@@@@@@@@@@@ summary
run-all FAIL non-zero exit status 1
bundled-gems PASS
builtin-extensions PASS
rubyconfig PASS

Here's the specific test case output:

FAIL test/rubygems/test_gem_util.rb
-----------------------------------

[/var/lib/gems/2.5.0/specifications/bundler-1.16.1.gemspec] isn't a Gem::Specification (NilClass instead).
[/var/lib/gems/2.5.0/specifications/bundler-audit-1.0.0.gemspec] isn't a Gem::Specification (NilClass instead).
Run options: -v --excludes-dir=test/excludes/ --excludes-dir=debian/tests/excludes/any/ --excludes-dir=debian/tests/excludes/amd64/ --name=!/memory_leak/

# Running tests:

[1/5] TestGemUtil#test_silent_system = 0.05 s
[2/5] TestGemUtil#test_class_popen = 0.04 s
[3/5] TestGemUtil#test_traverse_parents = 0.00 s
[4/5] TestGemUtil#test_traverse_parents_does_not_crash_on_permissions_error = 0.01 s
[5/5] TestGemUtil#test_linked_list_find = 0.00 s

  1) Failure:
TestGemUtil#test_traverse_parents_does_not_crash_on_permissions_error [/tmp/autopkgtest.XIAQZ1/autopkgtest_tmp/test/rubygems/test_gem_util.rb:43]:
--- expected
+++ actual
@@ -1 +1 @@
-"/tmp/test_rubygems_103177/d"
+"/tmp/test_rubygems_103177/d/e/f"

Finished tests in 0.105744s, 47.2839 tests/s, 94.5678 assertions/s.
5 tests, 10 assertions, 1 failures, 0 errors, 0 skips

The DEP3 for the added patches miss their upstream bug links. The arm patch doesn't appear to have an actual bug report afaict but there is a PR with a bit of context:

https://github.com/ruby/ruby/pull/3393
https://bugs.ruby-lang.org/issues/14655

Inline below are some refactoring and typo fixing suggestions.

### SRU Text Review ###

Some suggestions to help improve the SRU text to help it pass.

The timezone patch doesn't appear to have a ubuntu bug. I gather this is added strictly just to fix test suite failure, which is great, and as such might not ...

Read more...

review: Needs Fixing
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks for the review Bryce! I believe I addressed all your comments, it is up for review again. I uploaded a new version to the PPA with the all the improvements.

Regarding the autopkgtest failure I was not able to reproduce it, I ran it locally multiple times with different backends and all of them passed:

autopkgtest [18:38:52]: @@@@@@@@@@@@@@@@@@@@ summary
run-all PASS
bundled-gems PASS
builtin-extensions PASS
rubyconfig PASS

I tested with the commands below:

$ autopkgtest -U -s ruby2.5_2.5.1-1ubuntu1.7~ppa4_amd64.changes -- lxd ubuntu-daily:bionic
$ autopkgtest -U -s ruby2.5_2.5.1-1ubuntu1.7~ppa4_amd64.changes -- qemu @autopkgtest-bionic.cfg
$ cat autopkgtest-bionic.cfg
--ram-size=2046
/home/lucas/autopkgtest/autopkgtest-bionic-amd64.img

Here you can find the log of one of my executions: https://paste.ubuntu.com/p/H2fHr4y7Yb/

Revision history for this message
Bryce Harrington (bryce) wrote :

Looks good, +1.

review: Approve
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks for the review Bryce! Uploaded:

$ git push pkg upload/2.5.1-1ubuntu1.7
Enumerating objects: 43, done.
Counting objects: 100% (43/43), done.
Delta compression using up to 32 threads
Compressing objects: 100% (32/32), done.
Writing objects: 100% (33/33), 8.03 KiB | 4.01 MiB/s, done.
Total 33 (delta 21), reused 2 (delta 1)
To ssh://git.launchpad.net/ubuntu/+source/ruby2.5
 * [new tag] upload/2.5.1-1ubuntu1.7 -> upload/2.5.1-1ubuntu1.7

$ dput ubuntu ../ruby2.5_2.5.1-1ubuntu1.7_source.changes
Checking signature on .changes
gpg: ../ruby2.5_2.5.1-1ubuntu1.7_source.changes: Valid signature from F823A2729883C97C
Checking signature on .dsc
gpg: ../ruby2.5_2.5.1-1ubuntu1.7.dsc: Valid signature from F823A2729883C97C
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading ruby2.5_2.5.1-1ubuntu1.7.dsc: done.
  Uploading ruby2.5_2.5.1-1ubuntu1.7.debian.tar.xz: done.
  Uploading ruby2.5_2.5.1-1ubuntu1.7_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 08fcc18..c1b4e7f 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,22 @@
6+ruby2.5 (2.5.1-1ubuntu1.7) bionic; urgency=medium
7+
8+ * d/p/arm64-optimizations.patch: enable arm64 optimizations that exist
9+ for power/x86. It includes enabling unaligned memory access, gc and
10+ vm_exec.c optimizations (LP: #1901074).
11+ * Fix FTBFS, many tests were failing during the build (LP: #1903902).
12+ - Add missing b-d on tzdata.
13+ * Fix DEP-8 tests (LP: #1903905).
14+ - Backport patches to fix Kiritimati TZ tests:
15+ + 0029-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-1-.patch
16+ + 0030-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-2-.patch
17+ - d/t/control: add restriction to allow-stderr. The rubyconfig test calls
18+ dpkg-architecture which is returning a warning in Bionic.
19+ - d/t/bundled-gems: skip gems which do not match upstream expectations.
20+ Some gems listed as bundled by upstream are not satisfied by the Ubuntu
21+ Bionic archive.
22+
23+ -- Lucas Kanashiro <lucas.kanashiro@canonical.com> Thu, 05 Nov 2020 10:30:22 -0300
24+
25 ruby2.5 (2.5.1-1ubuntu1.6) bionic-security; urgency=medium
26
27 * SECURITY UPDATE: NULL injection vulnerability
28diff --git a/debian/control b/debian/control
29index 50986d7..2a2cbe8 100644
30--- a/debian/control
31+++ b/debian/control
32@@ -24,6 +24,7 @@ Build-Depends: bison,
33 procps,
34 rubygems-integration (>= 1.6),
35 systemtap-sdt-dev [linux-any],
36+ tzdata,
37 zlib1g-dev
38 Standards-Version: 4.1.2
39 Homepage: http://www.ruby-lang.org/
40diff --git a/debian/patches/0029-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-1-.patch b/debian/patches/0029-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-1-.patch
41new file mode 100644
42index 0000000..374cc5e
43--- /dev/null
44+++ b/debian/patches/0029-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-1-.patch
45@@ -0,0 +1,58 @@
46+From: Lucas Kanashiro <lucas.kanashiro@canonical.com>
47+Date: Thu, 5 Nov 2020 17:17:25 -0300
48+Subject: Backport upstream patch to fix Kiritimati TZ test [1/2]
49+
50+Original commit message:
51+
52+test_time_tz.rb: Kiritimati tzdata fix
53+
54+* test/ruby/test_time_tz.rb (TestTimeTZ#test_pacific_kiritimati):
55+ fix the expected data at the skip of New Year's Eve 1994.
56+ [Bug #14655]
57+
58+git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
59+
60+Origin: upstream, https://github.com/ruby/ruby/commit/2965c2d4df7
61+Bug-Upstream: https://bugs.ruby-lang.org/issues/14655
62+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ruby2.5/+bug/1903905
63+Reviewed-By: Lucas Kanashiro <lucas.kanashiro@canonical.com>
64+Last-Updated: 2020-11-04
65+---
66+ test/ruby/test_time_tz.rb | 17 ++++++++++++++---
67+ 1 file changed, 14 insertions(+), 3 deletions(-)
68+
69+diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
70+index 52d8bf8..ff3169e 100644
71+--- a/test/ruby/test_time_tz.rb
72++++ b/test/ruby/test_time_tz.rb
73+@@ -91,6 +91,9 @@ def group_by(e, &block)
74+ end
75+ end
76+ }
77++ CORRECT_KIRITIMATI_SKIP_1994 = with_tz("Pacific/Kiritimati") {
78++ Time.local(1994, 12, 31, 0, 0, 0).year == 1995
79++ }
80+
81+ def time_to_s(t)
82+ t.to_s
83+@@ -180,9 +183,17 @@ def test_europe_lisbon
84+
85+ def test_pacific_kiritimati
86+ with_tz(tz="Pacific/Kiritimati") {
87+- assert_time_constructor(tz, "1994-12-31 23:59:59 -1000", :local, [1994,12,31,23,59,59])
88+- assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,1,0,0,0])
89+- assert_time_constructor(tz, "1995-01-02 23:59:59 +1400", :local, [1995,1,1,23,59,59])
90++ assert_time_constructor(tz, "1994-12-30 00:00:00 -1000", :local, [1994,12,30,0,0,0])
91++ assert_time_constructor(tz, "1994-12-30 23:59:59 -1000", :local, [1994,12,30,23,59,59])
92++ if CORRECT_KIRITIMATI_SKIP_1994
93++ assert_time_constructor(tz, "1995-01-01 00:00:00 +1400", :local, [1994,12,31,0,0,0])
94++ assert_time_constructor(tz, "1995-01-01 23:59:59 +1400", :local, [1994,12,31,23,59,59])
95++ assert_time_constructor(tz, "1995-01-01 00:00:00 +1400", :local, [1995,1,1,0,0,0])
96++ else
97++ assert_time_constructor(tz, "1994-12-31 23:59:59 -1000", :local, [1994,12,31,23,59,59])
98++ assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,1,0,0,0])
99++ assert_time_constructor(tz, "1995-01-02 23:59:59 +1400", :local, [1995,1,1,23,59,59])
100++ end
101+ assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,2,0,0,0])
102+ }
103+ end
104diff --git a/debian/patches/0030-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-2-.patch b/debian/patches/0030-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-2-.patch
105new file mode 100644
106index 0000000..a6c0b90
107--- /dev/null
108+++ b/debian/patches/0030-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-2-.patch
109@@ -0,0 +1,46 @@
110+From: Lucas Kanashiro <lucas.kanashiro@canonical.com>
111+Date: Thu, 5 Nov 2020 17:21:47 -0300
112+Subject: Backport upstream patch to fix Kiritimati TZ test [2/2]
113+
114+Original commit message:
115+
116+test_time_tz.rb: Kiritimati tzdata fix
117+
118+* test/ruby/test_time_tz.rb (gen_zdump_test): fix the expected
119+ data at the Kiritimati's skip of New Year's Eve 1994.
120+ [Bug #14655]
121+
122+git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
123+
124+Origin: upstream, https://github.com/ruby/ruby/commit/584b5929f9b7
125+Bug-Upstream: https://bugs.ruby-lang.org/issues/14655
126+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ruby2.5/+bug/1903905
127+Reviewed-By: Lucas Kanashiro <lucas.kanashiro@canonical.com>
128+Last-Updated: 2020-11-05
129+---
130+ test/ruby/test_time_tz.rb | 9 +++++++++
131+ 1 file changed, 9 insertions(+)
132+
133+diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
134+index ff3169e..dad8e67 100644
135+--- a/test/ruby/test_time_tz.rb
136++++ b/test/ruby/test_time_tz.rb
137+@@ -381,9 +381,18 @@ def self.gen_zdump_test(data)
138+ Europe/London Sun Aug 10 01:00:00 1947 UTC = Sun Aug 10 02:00:00 1947 BST isdst=1 gmtoff=3600
139+ Europe/London Sun Nov 2 01:59:59 1947 UTC = Sun Nov 2 02:59:59 1947 BST isdst=1 gmtoff=3600
140+ Europe/London Sun Nov 2 02:00:00 1947 UTC = Sun Nov 2 02:00:00 1947 GMT isdst=0 gmtoff=0
141++End
142++ if CORRECT_KIRITIMATI_SKIP_1994
143++ gen_zdump_test <<'End'
144++Pacific/Kiritimati Sat Dec 31 09:59:59 1994 UTC = Fri Dec 30 23:59:59 1994 LINT isdst=0 gmtoff=-36000
145++Pacific/Kiritimati Sat Dec 31 10:00:00 1994 UTC = Sun Jan 1 00:00:00 1995 LINT isdst=0 gmtoff=50400
146++End
147++ else
148++ gen_zdump_test <<'End'
149+ Pacific/Kiritimati Sun Jan 1 09:59:59 1995 UTC = Sat Dec 31 23:59:59 1994 LINT isdst=0 gmtoff=-36000
150+ Pacific/Kiritimati Sun Jan 1 10:00:00 1995 UTC = Mon Jan 2 00:00:00 1995 LINT isdst=0 gmtoff=50400
151+ End
152++ end
153+ gen_zdump_test <<'End' if has_right_tz
154+ right/America/Los_Angeles Fri Jun 30 23:59:60 1972 UTC = Fri Jun 30 16:59:60 1972 PDT isdst=1 gmtoff=-25200
155+ right/America/Los_Angeles Wed Dec 31 23:59:60 2008 UTC = Wed Dec 31 15:59:60 2008 PST isdst=0 gmtoff=-28800
156diff --git a/debian/patches/arm64-optimizations.patch b/debian/patches/arm64-optimizations.patch
157new file mode 100644
158index 0000000..1e98b50
159--- /dev/null
160+++ b/debian/patches/arm64-optimizations.patch
161@@ -0,0 +1,179 @@
162+From: Lucas Kanashiro <lucas.kanashiro@canonical.com>
163+Date: Thu, 5 Nov 2020 10:27:17 -0300
164+Subject: Backport some arm64 optimizations
165+
166+Original commit message:
167+
168+From 511b55bcefc81c036294dc9a544d14bd342acd3b Mon Sep 17 00:00:00 2001
169+From: AGSaidi <AGSaidi@users.noreply.github.com>
170+Date: Thu, 13 Aug 2020 12:15:54 -0500
171+Subject: [PATCH] Enable arm64 optimizations that exist for power/x86 (#3393)
172+
173+* Enable unaligned accesses on arm64
174+
175+64-bit Arm platforms support unaligned accesses.
176+
177+Running the string benchmarks this change improves performance
178+by an average of 1.04x, min .96x, max 1.21x, median 1.01x
179+
180+* arm64 enable gc optimizations
181+
182+Similar to x86 and powerpc optimizations.
183+
184+| |compare-ruby|built-ruby|
185+|:------|-----------:|---------:|
186+|hash1 | 0.225| 0.237|
187+| | -| 1.05x|
188+|hash2 | 0.110| 0.110|
189+| | 1.00x| -|
190+
191+* vm_exec.c: improve performance for arm64
192+
193+| |compare-ruby|built-ruby|
194+|:------------------------------|-----------:|---------:|
195+|vm_array | 26.501M| 27.959M|
196+| | -| 1.06x|
197+|vm_attr_ivar | 21.606M| 31.429M|
198+| | -| 1.45x|
199+|vm_attr_ivar_set | 21.178M| 26.113M|
200+| | -| 1.23x|
201+|vm_backtrace | 6.621| 6.668|
202+| | -| 1.01x|
203+|vm_bigarray | 26.205M| 29.958M|
204+| | -| 1.14x|
205+|vm_bighash | 504.155k| 479.306k|
206+| | 1.05x| -|
207+|vm_block | 16.692M| 21.315M|
208+| | -| 1.28x|
209+|block_handler_type_iseq | 5.083| 7.004|
210+| | -| 1.38x|
211+
212+Origin: upstream, https://github.com/ruby/ruby/commit/511b55bcefc81c03
213+Bug-Upstream: https://github.com/ruby/ruby/pull/3393
214+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ruby2.7/+bug/1901074
215+Reviewed-By: Lucas Kanashiro <lucas.kanashiro@canonical.com>
216+Last-Updated: 2020-11-05
217+---
218+ gc.c | 12 ++++++++++++
219+ gc.h | 2 ++
220+ include/ruby/defines.h | 2 +-
221+ regint.h | 2 +-
222+ siphash.c | 2 +-
223+ st.c | 2 +-
224+ vm_exec.c | 8 ++++++++
225+ 7 files changed, 26 insertions(+), 4 deletions(-)
226+
227+diff --git a/gc.c b/gc.c
228+index f031861..8cf2fbb 100644
229+--- a/gc.c
230++++ b/gc.c
231+@@ -975,6 +975,18 @@ tick(void)
232+ return val;
233+ }
234+
235++#elif defined(__aarch64__) && defined(__GNUC__)
236++typedef unsigned long tick_t;
237++#define PRItick "lu"
238++
239++static __inline__ tick_t
240++tick(void)
241++{
242++ unsigned long val;
243++ __asm__ __volatile__ ("mrs %0, cntvct_el0", : "=r" (val));
244++ return val;
245++}
246++
247+ #elif defined(_WIN32) && defined(_MSC_VER)
248+ #include <intrin.h>
249+ typedef unsigned __int64 tick_t;
250+diff --git a/gc.h b/gc.h
251+index 2c91e06..0f8a56f 100644
252+--- a/gc.h
253++++ b/gc.h
254+@@ -6,6 +6,8 @@
255+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p)))
256+ #elif defined(__i386) && defined(__GNUC__)
257+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p)))
258++#elif defined(__aarch64__) && defined(__GNUC__)
259++#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("mov\t%0, sp" : "=r" (*(p)))
260+ #else
261+ NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
262+ #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
263+diff --git a/include/ruby/defines.h b/include/ruby/defines.h
264+index 9940c93..fff794e 100644
265+--- a/include/ruby/defines.h
266++++ b/include/ruby/defines.h
267+@@ -358,7 +358,7 @@ void rb_ia64_flushrs(void);
268+ #ifndef UNALIGNED_WORD_ACCESS
269+ # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
270+ defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
271+- defined(__powerpc64__) || \
272++ defined(__powerpc64__) || defined(__aarch64__) || \
273+ defined(__mc68020__)
274+ # define UNALIGNED_WORD_ACCESS 1
275+ # else
276+diff --git a/regint.h b/regint.h
277+index a2f5bbb..0740429 100644
278+--- a/regint.h
279++++ b/regint.h
280+@@ -52,7 +52,7 @@
281+ #ifndef UNALIGNED_WORD_ACCESS
282+ # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
283+ defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
284+- defined(__powerpc64__) || \
285++ defined(__powerpc64__) || defined(__aarch64__) || \
286+ defined(__mc68020__)
287+ # define UNALIGNED_WORD_ACCESS 1
288+ # else
289+diff --git a/siphash.c b/siphash.c
290+index 153d2c6..ddf8ee2 100644
291+--- a/siphash.c
292++++ b/siphash.c
293+@@ -30,7 +30,7 @@
294+ #ifndef UNALIGNED_WORD_ACCESS
295+ # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
296+ defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
297+- defined(__powerpc64__) || \
298++ defined(__powerpc64__) || defined(__aarch64__) || \
299+ defined(__mc68020__)
300+ # define UNALIGNED_WORD_ACCESS 1
301+ # endif
302+diff --git a/st.c b/st.c
303+index 9740e02..93635e6 100644
304+--- a/st.c
305++++ b/st.c
306+@@ -1744,7 +1744,7 @@ st_values_check(st_table *tab, st_data_t *values, st_index_t size,
307+ #ifndef UNALIGNED_WORD_ACCESS
308+ # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
309+ defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
310+- defined(__powerpc64__) || \
311++ defined(__powerpc64__) || defined(__aarch64__) || \
312+ defined(__mc68020__)
313+ # define UNALIGNED_WORD_ACCESS 1
314+ # endif
315+diff --git a/vm_exec.c b/vm_exec.c
316+index 87e9714..65bbca2 100644
317+--- a/vm_exec.c
318++++ b/vm_exec.c
319+@@ -27,6 +27,9 @@ static void vm_analysis_insn(int insn);
320+ #elif defined(__GNUC__) && defined(__powerpc64__)
321+ #define DECL_SC_REG(type, r, reg) register type reg_##r __asm__("r" reg)
322+
323++#elif defined(__GNUC__) && defined(__aarch64__)
324++#define DECL_SC_REG(type, r, reg) register type reg_##r __asm__("x" reg)
325++
326+ #else
327+ #define DECL_SC_REG(type, r, reg) register type reg_##r
328+ #endif
329+@@ -74,6 +77,11 @@ vm_exec_core(rb_execution_context_t *ec, VALUE initial)
330+ DECL_SC_REG(rb_control_frame_t *, cfp, "15");
331+ #define USE_MACHINE_REGS 1
332+
333++#elif defined(__GNUC__) && defined(__aarch64__)
334++ DECL_SC_REG(const VALUE *, pc, "19");
335++ DECL_SC_REG(rb_control_frame_t *, cfp, "20");
336++#define USE_MACHINE_REGS 1
337++
338+ #else
339+ register rb_control_frame_t *reg_cfp;
340+ const VALUE *reg_pc;
341diff --git a/debian/patches/series b/debian/patches/series
342index 488ec39..44beaf8 100644
343--- a/debian/patches/series
344+++ b/debian/patches/series
345@@ -25,3 +25,6 @@ CVE-2019-15845.patch
346 CVE-2019-16201.patch
347 CVE-2019-16254.patch
348 CVE-2019-16255.patch
349+arm64-optimizations.patch
350+0029-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-1-.patch
351+0030-Backport-upstream-patch-to-fix-Kiritimati-TZ-test-2-.patch
352diff --git a/debian/tests/bundled-gems b/debian/tests/bundled-gems
353index 5767c70..4ee2d21 100755
354--- a/debian/tests/bundled-gems
355+++ b/debian/tests/bundled-gems
356@@ -1,9 +1,32 @@
357-#!/bin/sh
358+#!/bin/bash
359
360 set -e
361
362+bionic_meets_gem_requirement() {
363+ local gem="$1"
364+ # The gems listed below do not match what ruby upstream expects.
365+ # * power_assert: upstream expects version >= 1.1.1. Bionic has version 0.3.0-1
366+ # but actually it contains 0.2.7, look at the gemspec:
367+ # /usr/share/rubygems-integration/all/specifications/power_assert-0.2.7.gemspec
368+ # * test-unit: upstream expects version >= 3.2.7. Bionic has version 3.2.5-1.
369+ # * xmlrpc: upstream expects version >= 0.3.0. This package is not available in
370+ # Bionic, just from Focal onwards.
371+ # Also see LP #1903905.
372+ local gems_not_expected_to_work=(power_assert test-unit xmlrpc)
373+
374+ for gem_skipped in "${gems_not_expected_to_work[@]}"; do
375+ if [[ "${gem}" == "${gem_skipped}" ]]; then
376+ echo "${gem} in Bionic does not match what ruby upstream expects for this version."
377+ return 1
378+ fi
379+ done
380+ return 0
381+}
382+
383 rc=0
384 while read gem version repository; do
385+ bionic_meets_gem_requirement "${gem}" || continue
386+
387 if ruby2.5 -e "gem '${gem}', '>= ${version}'"; then
388 echo "${gem} (>= ${version}) OK"
389 else
390diff --git a/debian/tests/control b/debian/tests/control
391index d5c2ee0..2b0bab8 100644
392--- a/debian/tests/control
393+++ b/debian/tests/control
394@@ -1,2 +1,3 @@
395 Tests: run-all bundled-gems builtin-extensions rubyconfig
396 Depends: @
397+Restrictions: allow-stderr

Subscribers

People subscribed via source and target branches