You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/01/21 02:06:22 UTC

[GitHub] [trafficserver] wangrong1069 commented on a change in pull request #8601: fix trafficserver segmentation fault on arm64

wangrong1069 commented on a change in pull request #8601:
URL: https://github.com/apache/trafficserver/pull/8601#discussion_r789286393



##########
File path: include/tscore/ink_queue.h
##########
@@ -136,7 +136,11 @@ 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(__aarch64__)
+#define FREELIST_POINTER(_x) ((void *)((((intptr_t)(_x).data) & 0x000FFFFFFFFFFFFFULL)))
+#define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 52)
+#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = (((intptr_t)(_p)) | (((_v)&0xFFFULL) << 52))
+#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__mips64)
 #define FREELIST_POINTER(_x) \
   ((void *)(((((intptr_t)(_x).data) << 16) >> 16) | (((~((((intptr_t)(_x).data) << 16 >> 63) - 1)) >> 48) << 48))) // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 48)

Review comment:
       Hi, do you mean we should update the code as below.
   
   #elif defined(__aarch64__)
   #define FREELIST_POINTER(_x) \
     ((void *)(((((uintptr_t)(_x).data) << 12) >> 12) | (((~((((intptr_t)(_x).data) << 12 >> 63) - 1)) >> 52) << 52))) // sign extend
   #define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 52)
   #define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = ((((intptr_t)(_p)) & 0x000FFFFFFFFFFFFFULL) | (((_v)&0xFFFULL) << 52))
   
   I think the last commit would be simpler and more efficient. maybe i'm wrong.
   Can you give some detailed comments, thank you.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org