Fix build error on loongarch64 (#4558)
This commit is contained in:
parent
3e258f5a08
commit
cbd086a7ec
4 changed files with 299 additions and 237 deletions
|
|
@ -83,6 +83,8 @@ char *linux_reg_profile(RzDebug *dbg) {
|
|||
}
|
||||
#elif __s390x__
|
||||
#include "reg/linux-s390x.h"
|
||||
#elif __loongarch64
|
||||
#include "reg/linux-loongarch64.h"
|
||||
#else
|
||||
#error "Unsupported Linux CPU"
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -138,6 +138,12 @@ struct powerpc_regs_t {
|
|||
// typedef ut64 riscv64_regs_t [65];
|
||||
// #define RZ_DEBUG_REG_T riscv64_regs_t
|
||||
#define RZ_DEBUG_REG_T struct user_regs_struct
|
||||
|
||||
#elif __loongarch64
|
||||
#include <sys/ucontext.h>
|
||||
#include <asm/ptrace.h>
|
||||
#define RZ_DEBUG_REG_T struct user_regs_struct
|
||||
|
||||
// #define RZ_DEBUG_REG_T mcontext_t 77 784 in size (coz the fpu regs)
|
||||
|
||||
#elif __mips__
|
||||
|
|
|
|||
52
librz/debug/p/native/linux/reg/linux-loongarch64.h
Normal file
52
librz/debug/p/native/linux/reg/linux-loongarch64.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
// SPDX-FileCopyrightText: 2024 Wenlong Zhang <zhangwenlong@loongson.cn>
|
||||
// SPDX-License-Identifier: LGPL-3.0-only
|
||||
|
||||
return strdup(
|
||||
"=PC pc\n"
|
||||
"=SP sp\n"
|
||||
"=BP fp\n"
|
||||
"=A0 a0\n"
|
||||
"=A1 a1\n"
|
||||
"=A2 a2\n"
|
||||
"=A3 a3\n"
|
||||
"=A4 a4\n"
|
||||
"=A5 a5\n"
|
||||
"=A6 a6\n"
|
||||
"=A7 a7\n"
|
||||
"gpr zero .64 0 0\n"
|
||||
"gpr ra .64 8 0\n"
|
||||
"gpr tp .64 16 0\n"
|
||||
"gpr sp .64 24 0\n"
|
||||
/* args */
|
||||
"gpr a0 .64 32 0\n"
|
||||
"gpr a1 .64 40 0\n"
|
||||
"gpr a2 .64 48 0\n"
|
||||
"gpr a3 .64 56 0\n"
|
||||
"gpr a4 .64 64 0\n"
|
||||
"gpr a5 .64 72 0\n"
|
||||
"gpr a6 .64 80 0\n"
|
||||
"gpr a7 .64 88 0\n"
|
||||
/* tmp */
|
||||
"gpr t0 .64 96 0\n"
|
||||
"gpr t1 .64 104 0\n"
|
||||
"gpr t2 .64 112 0\n"
|
||||
"gpr t3 .64 120 0\n"
|
||||
"gpr t4 .64 128 0\n"
|
||||
"gpr t5 .64 136 0\n"
|
||||
"gpr t6 .64 144 0\n"
|
||||
"gpr t7 .64 152 0\n"
|
||||
"gpr t8 .64 160 0\n"
|
||||
/* saved */
|
||||
"gpr r21 .64 168 0\n" // Non-allocatable
|
||||
/* fp */
|
||||
"gpr fp .64 176 0\n"
|
||||
/* static */
|
||||
"gpr s0 .64 184 0\n"
|
||||
"gpr s1 .64 192 0\n"
|
||||
"gpr s2 .64 200 0\n"
|
||||
"gpr s3 .64 208 0\n"
|
||||
"gpr s4 .64 216 0\n"
|
||||
"gpr s5 .64 224 0\n"
|
||||
"gpr s6 .64 232 0\n"
|
||||
"gpr s7 .64 240 0\n"
|
||||
"gpr s8 .64 248 0\n");
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef JEMALLOC_INTERNAL_H
|
||||
#define JEMALLOC_INTERNAL_H
|
||||
#define JEMALLOC_INTERNAL_H
|
||||
|
||||
#include "jemalloc_internal_defs.h"
|
||||
#include "jemalloc_internal_decls.h"
|
||||
|
|
@ -8,146 +8,146 @@
|
|||
#include <sys/ktrace.h>
|
||||
#endif
|
||||
|
||||
#define JEMALLOC_NO_DEMANGLE
|
||||
#define JEMALLOC_NO_DEMANGLE
|
||||
#ifdef JEMALLOC_JET
|
||||
# define JEMALLOC_N(n) jet_##n
|
||||
# include "public_namespace.h"
|
||||
# define JEMALLOC_NO_RENAME
|
||||
# include "../jemalloc.h"
|
||||
# undef JEMALLOC_NO_RENAME
|
||||
#define JEMALLOC_N(n) jet_##n
|
||||
#include "public_namespace.h"
|
||||
#define JEMALLOC_NO_RENAME
|
||||
#include "../jemalloc.h"
|
||||
#undef JEMALLOC_NO_RENAME
|
||||
#else
|
||||
# define JEMALLOC_N(n) je_##n
|
||||
# include "../jemalloc.h"
|
||||
#define JEMALLOC_N(n) je_##n
|
||||
#include "../jemalloc.h"
|
||||
#endif
|
||||
#include "private_namespace.h"
|
||||
|
||||
static const bool config_debug =
|
||||
#ifdef JEMALLOC_DEBUG
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool have_dss =
|
||||
#ifdef JEMALLOC_DSS
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_fill =
|
||||
#ifdef JEMALLOC_FILL
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_lazy_lock =
|
||||
#ifdef JEMALLOC_LAZY_LOCK
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF;
|
||||
;
|
||||
static const char *const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF;
|
||||
static const bool config_prof =
|
||||
#ifdef JEMALLOC_PROF
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_prof_libgcc =
|
||||
#ifdef JEMALLOC_PROF_LIBGCC
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_prof_libunwind =
|
||||
#ifdef JEMALLOC_PROF_LIBUNWIND
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool maps_coalesce =
|
||||
#ifdef JEMALLOC_MAPS_COALESCE
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_munmap =
|
||||
#ifdef JEMALLOC_MUNMAP
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_stats =
|
||||
#ifdef JEMALLOC_STATS
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_tcache =
|
||||
#ifdef JEMALLOC_TCACHE
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_thp =
|
||||
#ifdef JEMALLOC_THP
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_tls =
|
||||
#ifdef JEMALLOC_TLS
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_utrace =
|
||||
#ifdef JEMALLOC_UTRACE
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_valgrind =
|
||||
#ifdef JEMALLOC_VALGRIND
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_xmalloc =
|
||||
#ifdef JEMALLOC_XMALLOC
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_ivsalloc =
|
||||
#ifdef JEMALLOC_IVSALLOC
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
static const bool config_cache_oblivious =
|
||||
#ifdef JEMALLOC_CACHE_OBLIVIOUS
|
||||
true
|
||||
true
|
||||
#else
|
||||
false
|
||||
false
|
||||
#endif
|
||||
;
|
||||
;
|
||||
|
||||
#ifdef JEMALLOC_ATOMIC9
|
||||
#include <machine/atomic.h>
|
||||
|
|
@ -165,7 +165,7 @@ static const bool config_cache_oblivious =
|
|||
|
||||
#include "ph.h"
|
||||
#ifndef __PGI
|
||||
#define RB_COMPACT
|
||||
#define RB_COMPACT
|
||||
#endif
|
||||
#include "rb.h"
|
||||
#include "qr.h"
|
||||
|
|
@ -185,7 +185,7 @@ static const bool config_cache_oblivious =
|
|||
* JEMALLOC_H_INLINES : Inline functions.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
#define JEMALLOC_H_TYPES
|
||||
#define JEMALLOC_H_TYPES
|
||||
|
||||
#include "jemalloc_internal_macros.h"
|
||||
|
||||
|
|
@ -206,111 +206,114 @@ typedef unsigned szind_t;
|
|||
*
|
||||
* aaaaaaaa aaaatttt tttttttt 0znnnnnn
|
||||
*/
|
||||
#define MALLOCX_ARENA_MASK ((int)~0xfffff)
|
||||
#define MALLOCX_ARENA_MAX 0xffe
|
||||
#define MALLOCX_TCACHE_MASK ((int)~0xfff000ffU)
|
||||
#define MALLOCX_TCACHE_MAX 0xffd
|
||||
#define MALLOCX_LG_ALIGN_MASK ((int)0x3f)
|
||||
#define MALLOCX_ARENA_MASK ((int)~0xfffff)
|
||||
#define MALLOCX_ARENA_MAX 0xffe
|
||||
#define MALLOCX_TCACHE_MASK ((int)~0xfff000ffU)
|
||||
#define MALLOCX_TCACHE_MAX 0xffd
|
||||
#define MALLOCX_LG_ALIGN_MASK ((int)0x3f)
|
||||
/* Use MALLOCX_ALIGN_GET() if alignment may not be specified in flags. */
|
||||
#define MALLOCX_ALIGN_GET_SPECIFIED(flags) \
|
||||
(ZU(1) << (flags & MALLOCX_LG_ALIGN_MASK))
|
||||
#define MALLOCX_ALIGN_GET(flags) \
|
||||
(MALLOCX_ALIGN_GET_SPECIFIED(flags) & (SIZE_T_MAX-1))
|
||||
#define MALLOCX_ZERO_GET(flags) \
|
||||
((bool)(flags & MALLOCX_ZERO))
|
||||
#define MALLOCX_ALIGN_GET_SPECIFIED(flags) \
|
||||
(ZU(1) << (flags & MALLOCX_LG_ALIGN_MASK))
|
||||
#define MALLOCX_ALIGN_GET(flags) \
|
||||
(MALLOCX_ALIGN_GET_SPECIFIED(flags) & (SIZE_T_MAX - 1))
|
||||
#define MALLOCX_ZERO_GET(flags) \
|
||||
((bool)(flags & MALLOCX_ZERO))
|
||||
|
||||
#define MALLOCX_TCACHE_GET(flags) \
|
||||
(((unsigned)((flags & MALLOCX_TCACHE_MASK) >> 8)) - 2)
|
||||
#define MALLOCX_ARENA_GET(flags) \
|
||||
(((unsigned)(((unsigned)flags) >> 20)) - 1)
|
||||
#define MALLOCX_TCACHE_GET(flags) \
|
||||
(((unsigned)((flags & MALLOCX_TCACHE_MASK) >> 8)) - 2)
|
||||
#define MALLOCX_ARENA_GET(flags) \
|
||||
(((unsigned)(((unsigned)flags) >> 20)) - 1)
|
||||
|
||||
/* Smallest size class to support. */
|
||||
#define TINY_MIN (1U << LG_TINY_MIN)
|
||||
#define TINY_MIN (1U << LG_TINY_MIN)
|
||||
|
||||
/*
|
||||
* Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
|
||||
* classes).
|
||||
*/
|
||||
#ifndef LG_QUANTUM
|
||||
# if (defined(__i386__) || defined(_M_IX86))
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __ia64__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __alpha__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# if (defined(__sparc64__) || defined(__sparcv9) || defined(__sparc_v9__))
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# if (defined(__amd64__) || defined(__x86_64__) || defined(_M_X64))
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __arm__
|
||||
# define LG_QUANTUM 3
|
||||
# endif
|
||||
# ifdef __aarch64__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __hppa__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __m68k__
|
||||
# define LG_QUANTUM 3
|
||||
# endif
|
||||
# ifdef __mips__
|
||||
# define LG_QUANTUM 3
|
||||
# endif
|
||||
# ifdef __or1k__
|
||||
# define LG_QUANTUM 3
|
||||
# endif
|
||||
# ifdef __powerpc__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# if defined(__riscv) || defined(__riscv__)
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __s390__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __SH4__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __tile__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __le32__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifdef __e2k__
|
||||
# define LG_QUANTUM 4
|
||||
# endif
|
||||
# ifndef LG_QUANTUM
|
||||
# error "Unknown minimum alignment for architecture; specify via "
|
||||
"--with-lg-quantum"
|
||||
# endif
|
||||
#if (defined(__i386__) || defined(_M_IX86))
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __ia64__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __alpha__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#if (defined(__sparc64__) || defined(__sparcv9) || defined(__sparc_v9__))
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#if (defined(__amd64__) || defined(__x86_64__) || defined(_M_X64))
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __arm__
|
||||
#define LG_QUANTUM 3
|
||||
#endif
|
||||
#ifdef __aarch64__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __hppa__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __m68k__
|
||||
#define LG_QUANTUM 3
|
||||
#endif
|
||||
#ifdef __mips__
|
||||
#define LG_QUANTUM 3
|
||||
#endif
|
||||
#ifdef __or1k__
|
||||
#define LG_QUANTUM 3
|
||||
#endif
|
||||
#ifdef __powerpc__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#if defined(__riscv) || defined(__riscv__)
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __s390__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __SH4__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __tile__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __le32__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __e2k__
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifdef __loongarch64
|
||||
#define LG_QUANTUM 4
|
||||
#endif
|
||||
#ifndef LG_QUANTUM
|
||||
#error "Unknown minimum alignment for architecture; specify via "
|
||||
"--with-lg-quantum"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define QUANTUM ((size_t)(1U << LG_QUANTUM))
|
||||
#define QUANTUM_MASK (QUANTUM - 1)
|
||||
#define QUANTUM ((size_t)(1U << LG_QUANTUM))
|
||||
#define QUANTUM_MASK (QUANTUM - 1)
|
||||
|
||||
/* Return the smallest quantum multiple that is >= a. */
|
||||
#define QUANTUM_CEILING(a) \
|
||||
#define QUANTUM_CEILING(a) \
|
||||
(((a) + QUANTUM_MASK) & ~QUANTUM_MASK)
|
||||
|
||||
#define LONG ((size_t)(1U << LG_SIZEOF_LONG))
|
||||
#define LONG_MASK (LONG - 1)
|
||||
#define LONG ((size_t)(1U << LG_SIZEOF_LONG))
|
||||
#define LONG_MASK (LONG - 1)
|
||||
|
||||
/* Return the smallest long multiple that is >= a. */
|
||||
#define LONG_CEILING(a) \
|
||||
#define LONG_CEILING(a) \
|
||||
(((a) + LONG_MASK) & ~LONG_MASK)
|
||||
|
||||
#define SIZEOF_PTR (1U << LG_SIZEOF_PTR)
|
||||
#define PTR_MASK (SIZEOF_PTR - 1)
|
||||
#define SIZEOF_PTR (1U << LG_SIZEOF_PTR)
|
||||
#define PTR_MASK (SIZEOF_PTR - 1)
|
||||
|
||||
/* Return the smallest (void *) multiple that is >= a. */
|
||||
#define PTR_CEILING(a) \
|
||||
#define PTR_CEILING(a) \
|
||||
(((a) + PTR_MASK) & ~PTR_MASK)
|
||||
|
||||
/*
|
||||
|
|
@ -320,53 +323,53 @@ typedef unsigned szind_t;
|
|||
* CACHELINE cannot be based on LG_CACHELINE because __declspec(align()) can
|
||||
* only handle raw constants.
|
||||
*/
|
||||
#define LG_CACHELINE 6
|
||||
#define CACHELINE 64
|
||||
#define CACHELINE_MASK (CACHELINE - 1)
|
||||
#define LG_CACHELINE 6
|
||||
#define CACHELINE 64
|
||||
#define CACHELINE_MASK (CACHELINE - 1)
|
||||
|
||||
/* Return the smallest cacheline multiple that is >= s. */
|
||||
#define CACHELINE_CEILING(s) \
|
||||
#define CACHELINE_CEILING(s) \
|
||||
(((s) + CACHELINE_MASK) & ~CACHELINE_MASK)
|
||||
|
||||
/* Page size. LG_PAGE is determined by the configure script. */
|
||||
#ifdef PAGE_MASK
|
||||
# undef PAGE_MASK
|
||||
#undef PAGE_MASK
|
||||
#endif
|
||||
#define PAGE ((size_t)(1U << LG_PAGE))
|
||||
#define PAGE_MASK ((size_t)(PAGE - 1))
|
||||
#define PAGE ((size_t)(1U << LG_PAGE))
|
||||
#define PAGE_MASK ((size_t)(PAGE - 1))
|
||||
|
||||
/* Return the page base address for the page containing address a. */
|
||||
#define PAGE_ADDR2BASE(a) \
|
||||
#define PAGE_ADDR2BASE(a) \
|
||||
((void *)((uintptr_t)(a) & ~PAGE_MASK))
|
||||
|
||||
/* Return the smallest pagesize multiple that is >= s. */
|
||||
#define PAGE_CEILING(s) \
|
||||
#define PAGE_CEILING(s) \
|
||||
(((s) + PAGE_MASK) & ~PAGE_MASK)
|
||||
|
||||
/* Return the nearest aligned address at or below a. */
|
||||
#define ALIGNMENT_ADDR2BASE(a, alignment) \
|
||||
#define ALIGNMENT_ADDR2BASE(a, alignment) \
|
||||
((void *)((uintptr_t)(a) & ((~(alignment)) + 1)))
|
||||
|
||||
/* Return the offset between a and the nearest aligned address at or below a. */
|
||||
#define ALIGNMENT_ADDR2OFFSET(a, alignment) \
|
||||
#define ALIGNMENT_ADDR2OFFSET(a, alignment) \
|
||||
((size_t)((uintptr_t)(a) & (alignment - 1)))
|
||||
|
||||
/* Return the smallest alignment multiple that is >= s. */
|
||||
#define ALIGNMENT_CEILING(s, alignment) \
|
||||
#define ALIGNMENT_CEILING(s, alignment) \
|
||||
(((s) + (alignment - 1)) & ((~(alignment)) + 1))
|
||||
|
||||
/* Declare a variable-length array. */
|
||||
#if __STDC_VERSION__ < 199901L
|
||||
# ifdef _MSC_VER
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# else
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
# define VARIABLE_ARRAY(type, name, count) \
|
||||
#ifdef _MSC_VER
|
||||
#include <malloc.h>
|
||||
#define alloca _alloca
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#define VARIABLE_ARRAY(type, name, count) \
|
||||
type *name = alloca(sizeof(type) * (count))
|
||||
#else
|
||||
# define VARIABLE_ARRAY(type, name, count) type name[(count)]
|
||||
#define VARIABLE_ARRAY(type, name, count) type name[(count)]
|
||||
#endif
|
||||
|
||||
#include "nstime.h"
|
||||
|
|
@ -400,7 +403,7 @@ typedef unsigned szind_t;
|
|||
|
||||
#undef JEMALLOC_H_TYPES
|
||||
/******************************************************************************/
|
||||
#define JEMALLOC_H_STRUCTS
|
||||
#define JEMALLOC_H_STRUCTS
|
||||
|
||||
#include "nstime.h"
|
||||
#include "valgrind.h"
|
||||
|
|
@ -418,11 +421,11 @@ typedef unsigned szind_t;
|
|||
#include "mutex.h"
|
||||
#include "mb.h"
|
||||
#include "bitmap.h"
|
||||
#define JEMALLOC_ARENA_STRUCTS_A
|
||||
#define JEMALLOC_ARENA_STRUCTS_A
|
||||
#include "arena.h"
|
||||
#undef JEMALLOC_ARENA_STRUCTS_A
|
||||
#include "extent.h"
|
||||
#define JEMALLOC_ARENA_STRUCTS_B
|
||||
#define JEMALLOC_ARENA_STRUCTS_B
|
||||
#include "arena.h"
|
||||
#undef JEMALLOC_ARENA_STRUCTS_B
|
||||
#include "base.h"
|
||||
|
|
@ -439,71 +442,71 @@ typedef unsigned szind_t;
|
|||
|
||||
#undef JEMALLOC_H_STRUCTS
|
||||
/******************************************************************************/
|
||||
#define JEMALLOC_H_EXTERNS
|
||||
#define JEMALLOC_H_EXTERNS
|
||||
|
||||
extern bool opt_abort;
|
||||
extern const char *opt_junk;
|
||||
extern bool opt_junk_alloc;
|
||||
extern bool opt_junk_free;
|
||||
extern size_t opt_quarantine;
|
||||
extern bool opt_redzone;
|
||||
extern bool opt_utrace;
|
||||
extern bool opt_xmalloc;
|
||||
extern bool opt_zero;
|
||||
extern unsigned opt_narenas;
|
||||
extern bool opt_abort;
|
||||
extern const char *opt_junk;
|
||||
extern bool opt_junk_alloc;
|
||||
extern bool opt_junk_free;
|
||||
extern size_t opt_quarantine;
|
||||
extern bool opt_redzone;
|
||||
extern bool opt_utrace;
|
||||
extern bool opt_xmalloc;
|
||||
extern bool opt_zero;
|
||||
extern unsigned opt_narenas;
|
||||
|
||||
extern bool in_valgrind;
|
||||
extern bool in_valgrind;
|
||||
|
||||
/* Number of CPUs. */
|
||||
extern unsigned ncpus;
|
||||
extern unsigned ncpus;
|
||||
|
||||
/* Number of arenas used for automatic multiplexing of threads and arenas. */
|
||||
extern unsigned narenas_auto;
|
||||
extern unsigned narenas_auto;
|
||||
|
||||
/*
|
||||
* Arenas that are used to service external requests. Not all elements of the
|
||||
* arenas array are necessarily used; arenas are created lazily as needed.
|
||||
*/
|
||||
extern arena_t **arenas;
|
||||
extern arena_t **arenas;
|
||||
|
||||
/*
|
||||
* pind2sz_tab encodes the same information as could be computed by
|
||||
* pind2sz_compute().
|
||||
*/
|
||||
extern size_t const pind2sz_tab[NPSIZES];
|
||||
extern size_t const pind2sz_tab[NPSIZES];
|
||||
/*
|
||||
* index2size_tab encodes the same information as could be computed (at
|
||||
* unacceptable cost in some code paths) by index2size_compute().
|
||||
*/
|
||||
extern size_t const index2size_tab[NSIZES];
|
||||
extern size_t const index2size_tab[NSIZES];
|
||||
/*
|
||||
* size2index_tab is a compact lookup table that rounds request sizes up to
|
||||
* size classes. In order to reduce cache footprint, the table is compressed,
|
||||
* and all accesses are via size2index().
|
||||
*/
|
||||
extern uint8_t const size2index_tab[];
|
||||
extern uint8_t const size2index_tab[];
|
||||
|
||||
arena_t *a0get(void);
|
||||
void *a0malloc(size_t size);
|
||||
void a0dalloc(void *ptr);
|
||||
void *bootstrap_malloc(size_t size);
|
||||
void *bootstrap_calloc(size_t num, size_t size);
|
||||
void bootstrap_free(void *ptr);
|
||||
unsigned narenas_total_get(void);
|
||||
arena_t *arena_init(tsdn_t *tsdn, unsigned ind);
|
||||
arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind);
|
||||
arena_t *arena_choose_hard(tsd_t *tsd, bool internal);
|
||||
void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind);
|
||||
void thread_allocated_cleanup(tsd_t *tsd);
|
||||
void thread_deallocated_cleanup(tsd_t *tsd);
|
||||
void iarena_cleanup(tsd_t *tsd);
|
||||
void arena_cleanup(tsd_t *tsd);
|
||||
void arenas_tdata_cleanup(tsd_t *tsd);
|
||||
void narenas_tdata_cleanup(tsd_t *tsd);
|
||||
void arenas_tdata_bypass_cleanup(tsd_t *tsd);
|
||||
void jemalloc_prefork(void);
|
||||
void jemalloc_postfork_parent(void);
|
||||
void jemalloc_postfork_child(void);
|
||||
arena_t *a0get(void);
|
||||
void *a0malloc(size_t size);
|
||||
void a0dalloc(void *ptr);
|
||||
void *bootstrap_malloc(size_t size);
|
||||
void *bootstrap_calloc(size_t num, size_t size);
|
||||
void bootstrap_free(void *ptr);
|
||||
unsigned narenas_total_get(void);
|
||||
arena_t *arena_init(tsdn_t *tsdn, unsigned ind);
|
||||
arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind);
|
||||
arena_t *arena_choose_hard(tsd_t *tsd, bool internal);
|
||||
void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind);
|
||||
void thread_allocated_cleanup(tsd_t *tsd);
|
||||
void thread_deallocated_cleanup(tsd_t *tsd);
|
||||
void iarena_cleanup(tsd_t *tsd);
|
||||
void arena_cleanup(tsd_t *tsd);
|
||||
void arenas_tdata_cleanup(tsd_t *tsd);
|
||||
void narenas_tdata_cleanup(tsd_t *tsd);
|
||||
void arenas_tdata_bypass_cleanup(tsd_t *tsd);
|
||||
void jemalloc_prefork(void);
|
||||
void jemalloc_postfork_parent(void);
|
||||
void jemalloc_postfork_child(void);
|
||||
|
||||
#include "nstime.h"
|
||||
#include "valgrind.h"
|
||||
|
|
@ -536,7 +539,7 @@ void jemalloc_postfork_child(void);
|
|||
|
||||
#undef JEMALLOC_H_EXTERNS
|
||||
/******************************************************************************/
|
||||
#define JEMALLOC_H_INLINES
|
||||
#define JEMALLOC_H_INLINES
|
||||
|
||||
#include "nstime.h"
|
||||
#include "valgrind.h"
|
||||
|
|
@ -562,41 +565,40 @@ void jemalloc_postfork_child(void);
|
|||
#include "huge.h"
|
||||
|
||||
#ifndef JEMALLOC_ENABLE_INLINE
|
||||
pszind_t psz2ind(size_t psz);
|
||||
size_t pind2sz_compute(pszind_t pind);
|
||||
size_t pind2sz_lookup(pszind_t pind);
|
||||
size_t pind2sz(pszind_t pind);
|
||||
size_t psz2u(size_t psz);
|
||||
szind_t size2index_compute(size_t size);
|
||||
szind_t size2index_lookup(size_t size);
|
||||
szind_t size2index(size_t size);
|
||||
size_t index2size_compute(szind_t index);
|
||||
size_t index2size_lookup(szind_t index);
|
||||
size_t index2size(szind_t index);
|
||||
size_t s2u_compute(size_t size);
|
||||
size_t s2u_lookup(size_t size);
|
||||
size_t s2u(size_t size);
|
||||
size_t sa2u(size_t size, size_t alignment);
|
||||
arena_t *arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal);
|
||||
arena_t *arena_choose(tsd_t *tsd, arena_t *arena);
|
||||
arena_t *arena_ichoose(tsd_t *tsd, arena_t *arena);
|
||||
arena_tdata_t *arena_tdata_get(tsd_t *tsd, unsigned ind,
|
||||
bool refresh_if_missing);
|
||||
arena_t *arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing);
|
||||
ticker_t *decay_ticker_get(tsd_t *tsd, unsigned ind);
|
||||
pszind_t psz2ind(size_t psz);
|
||||
size_t pind2sz_compute(pszind_t pind);
|
||||
size_t pind2sz_lookup(pszind_t pind);
|
||||
size_t pind2sz(pszind_t pind);
|
||||
size_t psz2u(size_t psz);
|
||||
szind_t size2index_compute(size_t size);
|
||||
szind_t size2index_lookup(size_t size);
|
||||
szind_t size2index(size_t size);
|
||||
size_t index2size_compute(szind_t index);
|
||||
size_t index2size_lookup(szind_t index);
|
||||
size_t index2size(szind_t index);
|
||||
size_t s2u_compute(size_t size);
|
||||
size_t s2u_lookup(size_t size);
|
||||
size_t s2u(size_t size);
|
||||
size_t sa2u(size_t size, size_t alignment);
|
||||
arena_t *arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal);
|
||||
arena_t *arena_choose(tsd_t *tsd, arena_t *arena);
|
||||
arena_t *arena_ichoose(tsd_t *tsd, arena_t *arena);
|
||||
arena_tdata_t *arena_tdata_get(tsd_t *tsd, unsigned ind,
|
||||
bool refresh_if_missing);
|
||||
arena_t *arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing);
|
||||
ticker_t *decay_ticker_get(tsd_t *tsd, unsigned ind);
|
||||
#endif
|
||||
|
||||
|
||||
#include "bitmap.h"
|
||||
/*
|
||||
* Include portions of arena.h interleaved with tcache.h in order to resolve
|
||||
* circular dependencies.
|
||||
*/
|
||||
#define JEMALLOC_ARENA_INLINE_A
|
||||
#define JEMALLOC_ARENA_INLINE_A
|
||||
#include "arena.h"
|
||||
#undef JEMALLOC_ARENA_INLINE_A
|
||||
#include "tcache.h"
|
||||
#define JEMALLOC_ARENA_INLINE_B
|
||||
#define JEMALLOC_ARENA_INLINE_B
|
||||
#include "arena.h"
|
||||
#undef JEMALLOC_ARENA_INLINE_B
|
||||
#include "hash.h"
|
||||
|
|
|
|||
Loading…
Reference in a new issue