aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-28 22:02:52 +0200
committerStefan Boberg <[email protected]>2021-09-28 22:02:52 +0200
commitbfa8934826f2e25cb128ef38255c16186d87de14 (patch)
treee9260966636f7ebaf2634380f36e407bb43a0054
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-bfa8934826f2e25cb128ef38255c16186d87de14.tar.xz
zen-bfa8934826f2e25cb128ef38255c16186d87de14.zip
Removed IsPointerToStack()
-rw-r--r--zencore/include/zencore/refcount.h2
-rw-r--r--zencore/include/zencore/zencore.h7
-rw-r--r--zencore/zencore.cpp28
3 files changed, 5 insertions, 32 deletions
diff --git a/zencore/include/zencore/refcount.h b/zencore/include/zencore/refcount.h
index 50bd82f59..0a1e15614 100644
--- a/zencore/include/zencore/refcount.h
+++ b/zencore/include/zencore/refcount.h
@@ -17,7 +17,7 @@ namespace zen {
class RefCounted
{
public:
- RefCounted() : m_RefCount(IsPointerToStack(this)){};
+ RefCounted() = default;
virtual ~RefCounted() = default;
inline uint32_t AddRef() const { return AtomicIncrement(const_cast<RefCounted*>(this)->m_RefCount); }
diff --git a/zencore/include/zencore/zencore.h b/zencore/include/zencore/zencore.h
index b5b47d076..136ed2944 100644
--- a/zencore/include/zencore/zencore.h
+++ b/zencore/include/zencore/zencore.h
@@ -112,7 +112,7 @@
#if ZEN_ARCH_ARM64
// On ARM we can't do this because the executable will require jumps larger
// than the branch instruction can handle. Clang will only generate
-// the trampolines in the .text segment of the binary. If the uedbg segment
+// the trampolines in the .text segment of the binary. If the zcold segment
// is present it will generate code that it cannot link.
# define ZEN_DEBUG_SECTION
#else
@@ -121,7 +121,7 @@
// it well off the hot path and hopefully out of the instruction cache. It also
// facilitates reasoning about the makeup of a compiled/linked binary.
# define ZEN_DEBUG_SECTION ZEN_CODE_SECTION(".zcold")
-#endif // DO_CHECK || DO_GUARD_SLOW
+#endif
namespace zen {
@@ -194,7 +194,6 @@ char (&ZenArrayCountHelper(const T (&)[N]))[N + 1];
namespace zen {
-ZENCORE_API bool IsPointerToStack(const void* ptr); // Query if pointer is within the stack of the currently executing thread
ZENCORE_API bool IsApplicationExitRequested();
ZENCORE_API void RequestApplicationExit(int ExitCode);
ZENCORE_API bool IsDebuggerPresent();
@@ -205,6 +204,8 @@ ZENCORE_API void zencore_forcelinktests();
} // namespace zen
+//////////////////////////////////////////////////////////////////////////
+
#ifndef ZEN_USE_MIMALLOC
# define ZEN_USE_MIMALLOC 1
#endif
diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp
index f6abc2ee7..19acdd1f5 100644
--- a/zencore/zencore.cpp
+++ b/zencore/zencore.cpp
@@ -34,34 +34,6 @@ namespace zen {
//////////////////////////////////////////////////////////////////////////
-// NOTE: This should just be removed
-bool
-IsPointerToStack(const void* ptr)
-{
-#if ZEN_PLATFORM_WINDOWS
- ULONG_PTR StackLow, StackHigh;
- GetCurrentThreadStackLimits(&StackLow, &StackHigh);
-
- const uintptr_t intPtr = reinterpret_cast<uintptr_t>(ptr);
-
- const bool IsOnStack = (intPtr - StackLow) < (StackHigh - StackLow);
- //ZEN_ASSERT(!IsOnStack);
- return IsOnStack;
-#elif ZEN_PLATFORM_LINUX
- pthread_t self = pthread_self();
-
- pthread_attr_t attr;
- pthread_getattr_np(self, &attr);
-
- void* StackLow;
- size_t size;
- pthread_attr_getstack(&attr, &StackLow, &size);
-
- return (uintptr_t(ptr) - uintptr_t(StackLow)) < uintptr_t(size);
-#elif 0
-#endif
-}
-
bool
IsDebuggerPresent()
{