From b0907db9eae4b85fcab4fa997428c438d9443ee0 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 13 Jan 2023 08:23:47 +0100 Subject: [PATCH] V4: Do not shift heap pointer bits on arm64 Android Memory obtained via mmap() is not subject to heap pointer tagging. We don't need to impose the overhead of shifting the bits around. Amends commit c7722d4ed61d6a887e9f6c403ffa10b2048de2a4. Pick-to: 6.5 Task-number: QTBUG-101686 Task-number: QTBUG-91150 Change-Id: I45dc291c5a1208dd747199f00f819e475d5c0aec Reviewed-by: Sami Shalayel Reviewed-by: Fabian Kosmale --- src/qml/common/qv4staticvalue_p.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qml/common/qv4staticvalue_p.h b/src/qml/common/qv4staticvalue_p.h index 6f89173231..e9c3554104 100644 --- a/src/qml/common/qv4staticvalue_p.h +++ b/src/qml/common/qv4staticvalue_p.h @@ -509,8 +509,13 @@ struct StaticValue // and IA64 are not officially supported, but we can expect more platforms with // similar "problems" in the future. enum PointerShift { -#if defined(Q_OS_ANDROID) && defined(Q_PROCESSOR_ARM_64) - // Android on arm64 uses the top byte to store pointer tags. +#if 0 && defined(Q_OS_ANDROID) && defined(Q_PROCESSOR_ARM_64) + // We used to assume that Android on arm64 uses the top byte to store pointer tags. + // However, at least currently, the pointer tags are only applied on new/malloc and + // delete/free, not on mmap() and munmap(). We manage the JS heap directly using + // mmap, so we don't have to preserve any tags. + // + // If this ever changes, here is how to preserve the top byte: // Move it to Upper3 and Lower5. Top1Shift = 0, Upper3Shift = 12,