From c739700ef98bdc6d5b67ce1ae3e43edbffe58700 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Wed, 15 Nov 2023 17:21:46 +0100 Subject: [PATCH 1/2] [UR] Fix util_atomic_load_acquire implementation for windows it was assinging destination to the destination ingoring the source... --- source/common/unified_malloc_framework/src/utils/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/unified_malloc_framework/src/utils/utils.h b/source/common/unified_malloc_framework/src/utils/utils.h index 4dd779c57b..32d499787b 100644 --- a/source/common/unified_malloc_framework/src/utils/utils.h +++ b/source/common/unified_malloc_framework/src/utils/utils.h @@ -43,7 +43,7 @@ static __inline unsigned char util_mssb_index(long long value) { // There is no good way to do atomic_load on windows... #define util_atomic_load_acquire(object, dest) \ do { \ - *dest = InterlockedOr64Acquire((LONG64 volatile *)dest, 0); \ + *dest = InterlockedOr64Acquire((LONG64 volatile *)object, 0); \ } while (0) #define util_atomic_store_release(object, desired) \ From ef109b24d494127596febad36496dcaf12da4f76 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Wed, 15 Nov 2023 17:23:27 +0100 Subject: [PATCH 2/2] [UR] Fix overflow in critnib on Windows 1UL is 4 bytes on windows causing wrong results with bit mask --- source/common/unified_malloc_framework/src/critnib/critnib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/common/unified_malloc_framework/src/critnib/critnib.c b/source/common/unified_malloc_framework/src/critnib/critnib.c index 8a11a9c3f5..71a589d5dc 100644 --- a/source/common/unified_malloc_framework/src/critnib/critnib.c +++ b/source/common/unified_malloc_framework/src/critnib/critnib.c @@ -81,7 +81,7 @@ #define DELETED_LIFE 16 #define SLICE 4 -#define NIB ((1UL << SLICE) - 1) +#define NIB ((1ULL << SLICE) - 1) #define SLNODES (1 << SLICE) typedef uintptr_t word; @@ -156,7 +156,7 @@ static inline bool is_leaf(struct critnib_node *n) { return (word)n & 1; } * internal: to_leaf -- untag a leaf pointer */ static inline struct critnib_leaf *to_leaf(struct critnib_node *n) { - return (void *)((word)n & ~1UL); + return (void *)((word)n & ~1ULL); } /*