Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Richard Gobeille
EDuke32
Commits
899769f9
Commit
899769f9
authored
May 27, 2022
by
Richard Gobeille
Browse files
engine: smmalloc GCC 12 warning fixes
parent
62426363
Changes
2
Hide whitespace changes
Inline
Side-by-side
source/build/include/smmalloc.h
View file @
899769f9
...
...
@@ -389,11 +389,11 @@ class Allocator
#ifdef SMMALLOC_STATS_SUPPORT
if
(
enableStatistic
)
{
buckets
[
bucketIndex
].
stats
.
cacheHitCount
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
buckets
[
bucketIndex
&
(
SMM_MAX_BUCKET_COUNT
-
1
)
].
stats
.
cacheHitCount
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
}
#endif
#if __SANITIZE_ADDRESS__ == 1
ASAN_UNPOISON_MEMORY_REGION
(
pRes
,
Align
(
_bytesCount
,
8
));
ASAN_UNPOISON_MEMORY_REGION
(
pRes
,
Align
(
_bytesCount
,
8
));
#endif
return
pRes
;
}
...
...
@@ -407,11 +407,11 @@ class Allocator
#ifdef SMMALLOC_STATS_SUPPORT
if
(
enableStatistic
)
{
buckets
[
bucketIndex
].
stats
.
hitCount
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
buckets
[
bucketIndex
&
(
SMM_MAX_BUCKET_COUNT
-
1
)
].
stats
.
hitCount
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
}
#endif
#if __SANITIZE_ADDRESS__ == 1
ASAN_UNPOISON_MEMORY_REGION
(
pRes
,
Align
(
_bytesCount
,
8
));
ASAN_UNPOISON_MEMORY_REGION
(
pRes
,
Align
(
_bytesCount
,
8
));
#endif
return
pRes
;
}
...
...
@@ -420,7 +420,7 @@ class Allocator
#ifdef SMMALLOC_STATS_SUPPORT
if
(
enableStatistic
)
{
buckets
[
bucketIndex
].
stats
.
missCount
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
buckets
[
bucketIndex
&
(
SMM_MAX_BUCKET_COUNT
-
1
)
].
stats
.
missCount
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
}
#endif
}
...
...
@@ -469,7 +469,7 @@ class Allocator
PoolBucket
*
bucket
=
&
buckets
[
bucketIndex
];
bucket
->
FreeInterval
(
p
,
p
);
#if 0 //__SANITIZE_ADDRESS__ == 1
ASAN_POISON_MEMORY_REGION(p, GetBucketElementSize(bucketIndex));
ASAN_POISON_MEMORY_REGION(p, GetBucketElementSize(bucketIndex));
#endif
return
;
}
...
...
@@ -500,7 +500,7 @@ class Allocator
{
// reuse existing memory
#if __SANITIZE_ADDRESS__ == 1
ASAN_UNPOISON_MEMORY_REGION
(
p
,
Align
(
bytesCount
,
8
));
ASAN_UNPOISON_MEMORY_REGION
(
p
,
Align
(
bytesCount
,
8
));
#endif
return
p
;
}
...
...
source/build/src/smmalloc.cpp
View file @
899769f9
...
...
@@ -20,6 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include
"smmalloc.h"
#include
"log.h"
namespace
sm
{
...
...
@@ -43,7 +44,7 @@ void TlsPoolBucket::Init(uint32_t* pCacheStack, uint32_t maxElementsNum, CacheWa
SM_ASSERT
(
maxElementsCount
==
0
);
Allocator
::
PoolBucket
*
poolBucket
=
alloc
->
GetBucketByIndex
(
bucketIndex
);
ABORT_IF_F
(
!
poolBucket
,
"TlsPoolBucket::Init: invalid bucket index"
);
SM_ASSERT
(
maxElementsNum
>=
SMM_MAX_CACHE_ITEMS_COUNT
+
2
);
pStorageL1
=
pCacheStack
;
numElementsL1
=
0
;
...
...
@@ -153,8 +154,8 @@ void Allocator::CreateThreadCache(CacheWarmupOptions warmupOptions, std::initial
void
Allocator
::
DestroyThreadCache
()
{
#if __SANITIZE_ADDRESS__ == 1
auto
buf
=
this
->
pBuffer
.
get
();
ASAN_UNPOISON_MEMORY_REGION
(
buf
,
this
->
pBufferEnd
-
buf
);
auto
buf
=
this
->
pBuffer
.
get
();
ASAN_UNPOISON_MEMORY_REGION
(
buf
,
this
->
pBufferEnd
-
buf
);
#endif
for
(
size_t
i
=
0
;
i
<
SMM_MAX_BUCKET_COUNT
;
i
++
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment