From 6d7c94c1ebe6d504bd193ee92a2ee6ffa1329ddf Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Mon, 11 Feb 2019 13:19:58 -0500 Subject: remove pointer tagging hack in SkRecord This interferes with other uses of pointer tagging, like ARM pointer authentication or HSWASAN. (cherry picked from AOSP commit 5d4e25e03b4dcc5c16a253d593d896de9b993a65) Test: hwasan build of SkQPTestCases Bug: 155391001 Merged-In: I1a78dd4e1b9b18dd02738bb1dfbbb968f29675bc Change-Id: I1a78dd4e1b9b18dd02738bb1dfbbb968f29675bc -- SKIA Commit Details -- Reviewed-on: https://skia-review.googlesource.com/c/191286 (cherry picked from commit 740e5db7ab58708e64c1eaf19b7fd35eb2f1ad4e) Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288158 (cherry picked from commit 0f3e31cee78a979e44572baa8414dc0f99c9e3f9) Change-Id: I8c296275a213362a8664adba225e84607e6c6cc5 --- src/core/SkRecord.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/core/SkRecord.h b/src/core/SkRecord.h index 088975bc16..feabec8b15 100644 --- a/src/core/SkRecord.h +++ b/src/core/SkRecord.h @@ -141,22 +141,20 @@ private: // A typed pointer to some bytes in fAlloc. visit() and mutate() allow polymorphic dispatch. struct Record { - // On 32-bit machines we store type in 4 bytes, followed by a pointer. Simple. - // On 64-bit machines we store a pointer with the type slotted into two top (unused) bytes. - // FWIW, SkRecords::Type is tiny. It can easily fit in one byte. - uint64_t fTypeAndPtr; - static const int kTypeShift = sizeof(void*) == 4 ? 32 : 48; + SkRecords::Type fType; + void* fPtr; // Point this record to its data in fAlloc. Returns ptr for convenience. template T* set(T* ptr) { - fTypeAndPtr = ((uint64_t)T::kType) << kTypeShift | (uintptr_t)ptr; + fType = T::kType; + fPtr = ptr; SkASSERT(this->ptr() == ptr && this->type() == T::kType); return ptr; } - SkRecords::Type type() const { return (SkRecords::Type)(fTypeAndPtr >> kTypeShift); } - void* ptr() const { return (void*)(fTypeAndPtr & ((1ull< -- cgit v1.2.3