You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2022/03/10 00:14:23 UTC
[trafficserver] branch 9.2.x updated: update FREELIST macros for AArch64 (#8688)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new fe4f555 update FREELIST macros for AArch64 (#8688)
fe4f555 is described below
commit fe4f5554c08366f6a9c7863d638790098f148949
Author: wangrong <93...@users.noreply.github.com>
AuthorDate: Mon Mar 7 02:56:58 2022 +0800
update FREELIST macros for AArch64 (#8688)
remove redundant right shift operations when extract pointer
on AArch64, use 52~62 bits to save version info
(cherry picked from commit af0b0b4158542611f6e15573d1d300649c96b1e6)
---
include/tscore/ink_queue.h | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/include/tscore/ink_queue.h b/include/tscore/ink_queue.h
index ffddafe..4b8f028 100644
--- a/include/tscore/ink_queue.h
+++ b/include/tscore/ink_queue.h
@@ -139,10 +139,10 @@ union head_p {
#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) \
(_x).s.pointer = _p; \
(_x).s.version = _v
-#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__aarch64__) || defined(__mips64)
+#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__mips64)
/* Layout of FREELIST_POINTER
*
- * 0 ~ 47 bits : 48 bits, Virtual Address (47 bits for AMD64 and 48 bits for AArch64)
+ * 0 ~ 47 bits : 48 bits, Virtual Address
* 48 ~ 62 bits : 15 bits, Freelist Version
* 63 bits : 1 bits, The type of Virtual Address (0 = user space, 1 = kernel space)
*/
@@ -158,11 +158,30 @@ union head_p {
#else
/* the shift is `logical' */
#define FREELIST_POINTER(_x) \
- ((void *)((((intptr_t)(_x).data) & 0x0000FFFFFFFFFFFFLL) | (((~((((intptr_t)(_x).data) >> 63) - 1)) >> 48) << 48)))
+ ((void *)((((intptr_t)(_x).data) & 0x0000FFFFFFFFFFFFLL) | ((~((((intptr_t)(_x).data) >> 63) - 1)) << 48)))
#endif
#define FREELIST_VERSION(_x) ((((intptr_t)(_x).data) & 0x7FFF000000000000LL) >> 48)
#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = ((((intptr_t)(_p)) & 0x8000FFFFFFFFFFFFLL) | (((_v)&0x7FFFLL) << 48))
+#elif defined(__aarch64__)
+/* Layout of FREELIST_POINTER
+ *
+ * 0 ~ 51 bits : 52 bits, Virtual Address
+ * 52 ~ 62 bits : 11 bits, Freelist Version
+ * 63 bits : 1 bits, The type of Virtual Address (0 = user space, 1 = kernel space)
+ */
+#if ((~0 >> 1) < 0)
+/* the shift is `arithmetic' */
+#define FREELIST_POINTER(_x) \
+ ((void *)((((intptr_t)(_x).data) & 0x000FFFFFFFFFFFFFLL) | ((((intptr_t)(_x).data) >> 63) << 52))) // sign extend
+#else
+/* the shift is `logical' */
+#define FREELIST_POINTER(_x) \
+ ((void *)((((intptr_t)(_x).data) & 0x000FFFFFFFFFFFFFLL) | ((~((((intptr_t)(_x).data) >> 63) - 1)) << 52)))
+#endif
+
+#define FREELIST_VERSION(_x) ((((intptr_t)(_x).data) & 0x7FF0000000000000LL) >> 52)
+#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = ((((intptr_t)(_p)) & 0x800FFFFFFFFFFFFFLL) | (((_v)&0x7FFLL) << 52))
#else
#error "unsupported processor"
#endif