diff --git a/Source/JavaScriptCore/heap/ConservativeRoots.cpp b/Source/JavaScriptCore/heap/ConservativeRoots.cpp index 2b184aef57c7..d7dd2a8b8324 100644 --- a/Source/JavaScriptCore/heap/ConservativeRoots.cpp +++ b/Source/JavaScriptCore/heap/ConservativeRoots.cpp @@ -106,7 +106,7 @@ SUPPRESS_ASAN void ConservativeRoots::genericAddSpan(void* begin, void* end, MarkHook& markHook) { #ifdef __CHERI_PURE_CAPABILITY__ - if ((vaddr_t)begin > (vaddr_t)end) { //XXXKG: end may not be a capability hence use address_get, otherwise we will get a tag violation + if ((ptraddr_t)begin > (ptraddr_t)end) { //XXXKG: end may not be a capability hence use address_get, otherwise we will get a tag violation #else if (begin > end) { #endif @@ -123,7 +123,7 @@ void ConservativeRoots::genericAddSpan(void* begin, void* end, MarkHook& markHoo HeapVersion newlyAllocatedVersion = m_heap.objectSpace().newlyAllocatedVersion(); for (HeapPtr* it = static_cast*>(begin); #ifdef __CHERI_PURE_CAPABILITY__ - (vaddr_t)it != (vaddr_t)static_cast*>(end); + (ptraddr_t)it != (ptraddr_t)static_cast*>(end); #else it != static_cast*>(end); #endif diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.h b/Source/JavaScriptCore/heap/MachineStackMarker.h index 216b5263386d..bfde2021dbe0 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.h +++ b/Source/JavaScriptCore/heap/MachineStackMarker.h @@ -67,7 +67,7 @@ class MachineThreads { #define GET_STACK_BOUNDED_POINTER_TO_VARIABLE(var) \ __builtin_cheri_offset_increment( \ currentStackPointer(), \ - (vaddr_t) &(var) - __builtin_cheri_address_get(currentStackPointer())) + (ptraddr_t) &(var) - __builtin_cheri_address_get(currentStackPointer())) #else #define GET_STACK_BOUNDED_POINTER_TO_VARIABLE(var) \ &(var) diff --git a/Source/JavaScriptCore/heap/MarkedBlock.h b/Source/JavaScriptCore/heap/MarkedBlock.h index 2a0bddaa1baf..aee568e8dae0 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.h +++ b/Source/JavaScriptCore/heap/MarkedBlock.h @@ -571,7 +571,7 @@ inline size_t MarkedBlock::Handle::size() inline size_t MarkedBlock::atomNumber(const void* p) { #ifdef __CHERI_PURE_CAPABILITY__ - return ((vaddr_t)p - (vaddr_t)this) / atomSize; + return ((ptraddr_t)p - (ptraddr_t)this) / atomSize; #else return (reinterpret_cast(p) - reinterpret_cast(this)) / atomSize; #endif diff --git a/Source/JavaScriptCore/interpreter/CLoopStack.h b/Source/JavaScriptCore/interpreter/CLoopStack.h index d64d19caf483..3fe7930cc042 100644 --- a/Source/JavaScriptCore/interpreter/CLoopStack.h +++ b/Source/JavaScriptCore/interpreter/CLoopStack.h @@ -55,7 +55,7 @@ namespace JSC { bool containsAddress(Register* address) { #ifdef __CHERI_PURE_CAPABILITY__ - return ((vaddr_t)lowAddress() <= (vaddr_t)address && (vaddr_t)address < (vaddr_t)highAddress()); + return ((ptraddr_t)lowAddress() <= (ptraddr_t)address && (ptraddr_t)address < (ptraddr_t)highAddress()); #else return (lowAddress() <= address && address < highAddress()); #endif diff --git a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h index eeaa817c16d9..fa129be80725 100644 --- a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h +++ b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h @@ -91,7 +91,7 @@ class PropertyTable final : public JSCell { bool operator==(const ordered_iterator& other) { #ifdef __CHERI_PURE_CAPABILITY__ - return (vaddr_t)m_valuePtr == (vaddr_t)other.m_valuePtr; + return (ptraddr_t)m_valuePtr == (ptraddr_t)other.m_valuePtr; #else return m_valuePtr == other.m_valuePtr; #endif @@ -100,7 +100,7 @@ class PropertyTable final : public JSCell { bool operator!=(const ordered_iterator& other) { #ifdef __CHERI_PURE_CAPABILITY__ - return (vaddr_t)m_valuePtr != (vaddr_t)other.m_valuePtr; + return (ptraddr_t)m_valuePtr != (ptraddr_t)other.m_valuePtr; #else return m_valuePtr != other.m_valuePtr; #endif diff --git a/Source/JavaScriptCore/runtime/VM.h b/Source/JavaScriptCore/runtime/VM.h index f9b9ede613d0..ca088064b792 100644 --- a/Source/JavaScriptCore/runtime/VM.h +++ b/Source/JavaScriptCore/runtime/VM.h @@ -978,7 +978,7 @@ class VM : public ThreadSafeRefCounted, public DoublyLinkedListNode { void* curr = currentStackPointer(); #ifdef __CHERI_PURE_CAPABILITY__ // XXXKG: limit may or may not be a capability - return (vaddr_t)curr >= (vaddr_t)stackLimit; + return (ptraddr_t)curr >= (ptraddr_t)stackLimit; #else return curr >= stackLimit; #endif diff --git a/Source/WTF/wtf/HashFunctions.h b/Source/WTF/wtf/HashFunctions.h index 8906cc3dd9b4..d116be073722 100644 --- a/Source/WTF/wtf/HashFunctions.h +++ b/Source/WTF/wtf/HashFunctions.h @@ -129,14 +129,14 @@ namespace WTF { static unsigned hash(PtrType key) { #ifdef __CHERI_PURE_CAPABILITY__ - return IntHash::hash(reinterpret_cast(key)); + return IntHash::hash(reinterpret_cast(key)); #else return IntHash::hash(reinterpret_cast(key)); #endif } static bool equal(PtrType a, PtrType b) { #ifdef __CHERI_PURE_CAPABILITY__ - return (vaddr_t)a == (vaddr_t)b; + return (ptraddr_t)a == (ptraddr_t)b; #else return a == b; #endif @@ -150,14 +150,14 @@ namespace WTF { static unsigned hash(PtrType key) { #ifdef __CHERI_PURE_CAPABILITY__ - return IntHash::hash(reinterpret_cast(key)); + return IntHash::hash(reinterpret_cast(key)); #else return IntHash::hash(reinterpret_cast(key)); #endif } static bool equal(PtrType a, PtrType b) { #ifdef __CHERI_PURE_CAPABILITY__ - return (vaddr_t)a == (vaddr_t)b; + return (ptraddr_t)a == (ptraddr_t)b; #else return a == b; #endif @@ -181,8 +181,8 @@ namespace WTF { template struct IntCapHash { typedef T IntCapType; - static unsigned hash(IntCapType key) { return IntHash::hash(static_cast(key)); } - static bool equal(IntCapType a, IntCapType b) { return (vaddr_t)(void*)a == (vaddr_t)(void*)b; } + static unsigned hash(IntCapType key) { return IntHash::hash(static_cast(key)); } + static bool equal(IntCapType a, IntCapType b) { return (ptraddr_t)(void*)a == (ptraddr_t)(void*)b; } static const bool safeToCompareToEmptyOrDeleted = true; }; template<> struct IntHash<__uintcap_t> : public IntCapHash<__uintcap_t> {}; diff --git a/Source/WTF/wtf/RefCountedArray.h b/Source/WTF/wtf/RefCountedArray.h index f22e7e308e18..ee9bc790f487 100644 --- a/Source/WTF/wtf/RefCountedArray.h +++ b/Source/WTF/wtf/RefCountedArray.h @@ -229,7 +229,7 @@ class RefCountedArray { char* result = reinterpret_cast(this) + size(); //XXXKG: check alignment #ifdef __CHERI_PURE_CAPABILITY__ - ASSERT(!((vaddr_t)result & (sizeof(__uintcap_t)-1))); + ASSERT(!((ptraddr_t)result & (sizeof(__uintcap_t)-1))); #else ASSERT(!(bitwise_cast(result) & 7)); #endif diff --git a/Source/WTF/wtf/StackBounds.h b/Source/WTF/wtf/StackBounds.h index 3aa3671261d6..0067bbd5a908 100644 --- a/Source/WTF/wtf/StackBounds.h +++ b/Source/WTF/wtf/StackBounds.h @@ -161,9 +161,9 @@ class StackBounds { void* currentPosition = currentStackPointer(); ASSERT(m_origin != m_bound); ASSERT(isGrowingDownward() -#ifdef __CHERI_PURE_CAPABILITY__ // XXXKG: use vaddr_t because m_bound may not have tag set (if obtained from pthreads) - ? ((vaddr_t)currentPosition < (vaddr_t)m_origin && (vaddr_t)currentPosition > (vaddr_t)m_bound) - : ((vaddr_t)currentPosition > (vaddr_t)m_origin && (vaddr_t)currentPosition < (vaddr_t)m_bound)); +#ifdef __CHERI_PURE_CAPABILITY__ // XXXKG: use ptraddr_t because m_bound may not have tag set (if obtained from pthreads) + ? ((ptraddr_t)currentPosition < (ptraddr_t)m_origin && (ptraddr_t)currentPosition > (ptraddr_t)m_bound) + : ((ptraddr_t)currentPosition > (ptraddr_t)m_origin && (ptraddr_t)currentPosition < (ptraddr_t)m_bound)); #else ? (currentPosition < m_origin && currentPosition > m_bound) : (currentPosition > m_origin && currentPosition < m_bound)); diff --git a/Source/WTF/wtf/StdLibExtras.h b/Source/WTF/wtf/StdLibExtras.h index dab1f3e7a463..dd2995174b29 100644 --- a/Source/WTF/wtf/StdLibExtras.h +++ b/Source/WTF/wtf/StdLibExtras.h @@ -131,7 +131,7 @@ inline bool is8ByteAligned(void* p) { static_assert(sizeof(double) == 8, ""); #ifdef __CHERI_PURE_CAPABILITY__ - return !((vaddr_t)(p) & (sizeof(double) - 1)); + return !((ptraddr_t)(p) & (sizeof(double) - 1)); #else return !((uintptr_t)(p) & (sizeof(double) - 1)); #endif diff --git a/Source/WTF/wtf/text/ASCIIFastPath.h b/Source/WTF/wtf/text/ASCIIFastPath.h index 157f4844f44a..d53bd52815e0 100644 --- a/Source/WTF/wtf/text/ASCIIFastPath.h +++ b/Source/WTF/wtf/text/ASCIIFastPath.h @@ -38,7 +38,7 @@ template inline bool isAlignedTo(const void* pointer) { #ifdef __CHERI_PURE_CAPABILITY__ - return !(reinterpret_cast(pointer) & mask); + return !(reinterpret_cast(pointer) & mask); #else return !(reinterpret_cast(pointer) & mask); #endif