JEMALLOC_INLINE void
arena_prof_tctx_set(const void *ptr, size_t usize, prof_tctx_t *tctx)
{
arena_chunk_t *chunk;
cassert(config_prof);
assert(ptr != NULL);
chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
if (likely(chunk != ptr)) {
size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
assert(arena_mapbits_allocated_get(chunk, pageind) != 0);
if (unlikely(usize > SMALL_MAXCLASS || (uintptr_t)tctx >
(uintptr_t)1U)) {
arena_chunk_map_misc_t *elm;
assert(arena_mapbits_large_get(chunk, pageind) != 0);
elm = arena_miscelm_get(chunk, pageind);
atomic_write_p(&elm->prof_tctx_pun, tctx);
} else {
/*
* tctx must always be initialized for large runs.
* Assert that the surrounding conditional logic is
* equivalent to checking whether ptr refers to a large
* run.
*/
assert(arena_mapbits_large_get(chunk, pageind) == 0);
}
} else
huge_prof_tctx_set(ptr, tctx);
}
這段代碼里有顏色的那個是什么意思?函式怎么還可以這樣定義???
uj5u.com熱心網友回復:
一般是個宏,不同編譯器可能不一樣uj5u.com熱心網友回復:
@akirya C語言函式定義前怎么會有宏前綴啊,,,沒明白....uj5u.com熱心網友回復:
這是可選的東西,給編譯器看的。
跟C語言沒啥關系。
uj5u.com熱心網友回復:
#define JEMALLOC_INLINE inline估計什么地方有這么個宏定義
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/93041.html
標籤:基礎類
