diff options
author | nagachika <nagachika@ruby-lang.org> | 2021-03-20 14:23:45 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-03-20 14:23:45 +0900 |
commit | 6ef46f71c743507a0e2ae0eef14dce0539b0ff52 (patch) | |
tree | 51cd700e6a4d5cb11d773d082d6aae7bbf2baca1 /gc.c | |
parent | ef1ed1b53afdff80cb217d77f3fbcbe7906c729e (diff) |
merge revision(s) 511b55bcefc81c036294dc9a544d14bd342acd3b: [Backport #17215]
Enable arm64 optimizations that exist for power/x86 (#3393)
* Enable unaligned accesses on arm64
64-bit Arm platforms support unaligned accesses.
Running the string benchmarks this change improves performance
by an average of 1.04x, min .96x, max 1.21x, median 1.01x
* arm64 enable gc optimizations
Similar to x86 and powerpc optimizations.
| |compare-ruby|built-ruby|
|:------|-----------:|---------:|
|hash1 | 0.225| 0.237|
| | -| 1.05x|
|hash2 | 0.110| 0.110|
| | 1.00x| -|
* vm_exec.c: improve performance for arm64
| |compare-ruby|built-ruby|
|:------------------------------|-----------:|---------:|
|vm_array | 26.501M| 27.959M|
| | -| 1.06x|
|vm_attr_ivar | 21.606M| 31.429M|
| | -| 1.45x|
|vm_attr_ivar_set | 21.178M| 26.113M|
| | -| 1.23x|
|vm_backtrace | 6.621| 6.668|
| | -| 1.01x|
|vm_bigarray | 26.205M| 29.958M|
| | -| 1.14x|
|vm_bighash | 504.155k| 479.306k|
| | 1.05x| -|
|vm_block | 16.692M| 21.315M|
| | -| 1.28x|
|block_handler_type_iseq | 5.083| 7.004|
| | -| 1.38x|
---
gc.c | 13 +++++++++++++
gc.h | 2 ++
include/ruby/internal/config.h | 2 ++
regint.h | 2 +-
siphash.c | 2 +-
st.c | 2 +-
vm_exec.c | 8 ++++++++
7 files changed, 28 insertions(+), 3 deletions(-)
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1153,6 +1153,19 @@ tick(void) return val; } +#elif defined(__aarch64__) && defined(__GNUC__) +typedef unsigned long tick_t; +#define PRItick "lu" + +static __inline__ tick_t +tick(void) +{ + unsigned long val; + __asm__ __volatile__ ("mrs %0, cntvct_el0", : "=r" (val)); + return val; +} + + #elif defined(_WIN32) && defined(_MSC_VER) #include <intrin.h> typedef unsigned __int64 tick_t; |