|
TBCI Numerical high perf. C++ Library
2.8.0
|
Caches memory blocks to avoid calls to __builtin_free()/new() It performs very well for strictly recursive new/delete pairs. More...
#include <cstdio>#include "tbci/smp.h"

Go to the source code of this file.
Classes | |
| class | tbci_memalloc< T > |
| class | tbci_memalloc< T > |
| struct | tbci_memalloc_cache_tls< T > |
| struct | tbci_memalloc_cache< T > |
| For specializations of the memory allocator: More... | |
| class | tbci_memalloc< double > |
| class | tbci_memalloc< doubleptr > |
| class | tbci_memalloc< float > |
| class | tbci_memalloc< floatptr > |
| class | tbci_memalloc< unsigned > |
| class | tbci_memalloc< uintptr > |
| class | tbci_memalloc< int > |
| class | tbci_memalloc< intptr > |
| class | tbci_memalloc< unsigned char > |
| class | tbci_memalloc< signed char > |
| class | tbci_memalloc< charptr > |
| class | tbci_memalloc< ucharptr > |
| class | tbci_memalloc< long > |
| class | tbci_memalloc< longptr > |
| class | tbci_memalloc< unsigned long > |
| class | tbci_memalloc< ulongptr > |
| class | tbci_memalloc< unsigned short > |
| class | tbci_memalloc< voidptr > |
Macros | |
| #define | MALLOC_CACHE 1 |
| #define | MALLOC |
| #define | TBCI_MALLOC_LOCK 1 |
| #define | DEBUG_PRINTF1(arg1) do {} while (0) |
| #define | DEBUG_PRINTF2(a1, a2) do {} while (0) |
| #define | DEBUG_PRINTF3(a1, a2, a3) do {} while (0) |
| #define | DEBUG_PRINTF4(a1, a2, a3, a4) do {} while (0) |
| #define | TBCI_MALLOC_POOLSZ 8 |
| #define | TBCI_MALLOC_LIMIT 8192 |
| #define | DUMMY1 |
| #define | DUMMY2(TYPE) |
| #define | DUMMY3(t) |
| #define | FGD2 FGDT |
| #define | MINLINE inline |
| #define | NO_SINGLETON_PUBLIC |
| #define | TBCI_SIMD_ALIGN 16 |
| #define | TBCI_MALLOC_ALIGN_FACT 1 |
| #define | _MC_NEW(T, SZ) new T[SZ] |
| #define | _MC_DELETE(T, PTR) delete[] (T*)PTR |
| #define | SSE_VARS_MAY_BE_UNALIGNED |
| #define | INC(x) ++x; |
| #define | SMP_LOCK |
| SMP locking: The TBCI worker threads don't do memory allocations so the memalloc_cache code does not need to be multithreading safe. More... | |
| #define | SMP_UNLOCK |
| #define | SPECIALIZE_MEMALLOC_CLASS(TYPE) |
| Allocator specialization macro, subsequently used to specialize the allocator for the elementary types. More... | |
| #define | SPECIALIZE_MEMALLOC(TYPE) |
| #define | SPECIALIZE_MEMALLOC2(TYPE, SHTP) |
| #define | NEW(t, s) tbci_s_allocator<t>(DUMMY3(t)).alloc(s) |
| #define | TBCIDELETE(t, v, sz) tbci_s_allocator<t>(DUMMY3(t)).dealloc(v, sz) |
| #define | TBCIDELETE_RO(t, v, sz) tbci_s_allocator<t>(DUMMY3(t)).dealloc(v, sz) |
| #define | REALLOC(v, os, t, s) |
Typedefs | |
| typedef double * | doubleptr |
| typedef float * | floatptr |
| typedef unsigned int * | uintptr |
| typedef int * | intptr |
| typedef char * | charptr |
| typedef unsigned char * | ucharptr |
| typedef long * | longptr |
| typedef unsigned long * | ulongptr |
| typedef void * | voidptr |
Variables | |
| const T * | free_pt [8] |
| unsigned short | free_sz [8] |
| unsigned char | free_idx |
| volatile unsigned int | miss |
| volatile unsigned int | hit |
| volatile unsigned int | srch |
| volatile unsigned int | all |
| struct tbci_memalloc_cache | ALIGN |
Caches memory blocks to avoid calls to __builtin_free()/new() It performs very well for strictly recursive new/delete pairs.
Definition in file malloc_cache.h.
Definition at line 131 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::dealloc(), tbci_memalloc_cache< T >::deinit(), and tbci_memalloc_cache< T >::free_and_enter().
Definition at line 130 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::alloc().
| #define DEBUG_PRINTF1 | ( | arg1 | ) | do {} while (0) |
Definition at line 54 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::deinit(), and tbci_memalloc_cache< T >::find_by_sz().
| #define DEBUG_PRINTF2 | ( | a1, | |
| a2 | |||
| ) | do {} while (0) |
Definition at line 55 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::find_by_sz().
| #define DEBUG_PRINTF3 | ( | a1, | |
| a2, | |||
| a3 | |||
| ) | do {} while (0) |
Definition at line 56 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::alloc(), and tbci_memalloc_cache< T >::deinit().
| #define DEBUG_PRINTF4 | ( | a1, | |
| a2, | |||
| a3, | |||
| a4 | |||
| ) | do {} while (0) |
Definition at line 57 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::free_and_enter().
| #define DUMMY1 |
Definition at line 74 of file malloc_cache.h.
| #define DUMMY2 | ( | TYPE | ) |
Definition at line 75 of file malloc_cache.h.
| #define DUMMY3 | ( | t | ) |
Definition at line 76 of file malloc_cache.h.
| #define FGD2 FGDT |
Definition at line 77 of file malloc_cache.h.
Definition at line 143 of file malloc_cache.h.
| #define MALLOC |
Definition at line 29 of file malloc_cache.h.
| #define MALLOC_CACHE 1 |
Definition at line 14 of file malloc_cache.h.
| #define MINLINE inline |
Definition at line 80 of file malloc_cache.h.
| #define NEW | ( | t, | |
| s | |||
| ) | tbci_s_allocator<t>(DUMMY3(t)).alloc(s) |
Definition at line 633 of file malloc_cache.h.
Referenced by BVector< T >::BVector(), BVector< unsigned >::BVector(), BdMatrix< T >::constructor(), F_TSMatrix< T >::detach(), TSVector< T >::detach(), TSMatrix< T >::detach(), eig(), BVector< T >::remove(), BVector< T >::resize(), F_TMatrix< T >::resize(), TMatrix< T >::resize(), TMatrix< T >::row_expand(), and Vector< T >::Vector().
| #define NO_SINGLETON_PUBLIC |
Definition at line 89 of file malloc_cache.h.
| #define REALLOC | ( | v, | |
| os, | |||
| t, | |||
| s | |||
| ) |
Definition at line 636 of file malloc_cache.h.
Referenced by BdMatrix< T >::adddiag(), BVector< T >::append(), BVector< T >::resize(), and TMatrix< T >::row_expand().
| #define SMP_LOCK |
SMP locking: The TBCI worker threads don't do memory allocations so the memalloc_cache code does not need to be multithreading safe.
However, to make the TBCI threading framework more useful, we should allow this in the future.
The current implementation does the following:
Possible future work:
Definition at line 242 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::find_and_rmv(), and tbci_memalloc_cache< T >::free_and_enter().
| #define SMP_UNLOCK |
Definition at line 243 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::find_and_rmv(), and tbci_memalloc_cache< T >::free_and_enter().
| #define SPECIALIZE_MEMALLOC | ( | TYPE | ) |
Definition at line 578 of file malloc_cache.h.
| #define SPECIALIZE_MEMALLOC2 | ( | TYPE, | |
| SHTP | |||
| ) |
Definition at line 587 of file malloc_cache.h.
| #define SPECIALIZE_MEMALLOC_CLASS | ( | TYPE | ) |
Allocator specialization macro, subsequently used to specialize the allocator for the elementary types.
Definition at line 549 of file malloc_cache.h.
| #define SSE_VARS_MAY_BE_UNALIGNED |
Definition at line 133 of file malloc_cache.h.
| #define TBCI_MALLOC_ALIGN_FACT 1 |
Definition at line 126 of file malloc_cache.h.
| #define TBCI_MALLOC_LIMIT 8192 |
Definition at line 65 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::alloc(), and tbci_memalloc_cache< T >::dealloc().
| #define TBCI_MALLOC_LOCK 1 |
Definition at line 37 of file malloc_cache.h.
| #define TBCI_MALLOC_POOLSZ 8 |
Definition at line 62 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::deinit(), tbci_memalloc_cache< T >::enter(), tbci_memalloc_cache< T >::find_by_sz(), and tbci_memalloc_cache< T >::init().
| #define TBCI_SIMD_ALIGN 16 |
Definition at line 122 of file malloc_cache.h.
| #define TBCIDELETE | ( | t, | |
| v, | |||
| sz | |||
| ) | tbci_s_allocator<t>(DUMMY3(t)).dealloc(v, sz) |
Definition at line 634 of file malloc_cache.h.
Referenced by F_TSMatrix< T >::clone(), TSVector< T >::clone(), TSMatrix< T >::clone(), BVector< T >::destroy(), F_TMatrix< T >::destroy(), F_TSMatrix< T >::destroy(), TSVector< T >::destroy(), F_TSMatrix< T >::detach(), TSMatrix< T >::detach(), eig(), BdMatrix< T >::free_diags(), TMatrix< T >::real_destroy(), TSMatrix< T >::real_destroy(), BdMatrix< T >::reconfig(), BVector< T >::remove(), BdMatrix< T >::removediag(), BVector< T >::resize(), F_TMatrix< T >::resize(), BdMatrix< T >::resize(), TMatrix< T >::resize(), TMatrix< T >::row_expand(), F_TMatrix< T >::set_ptrs(), TMatrix< T >::set_ptrs(), and TVector< T >::slice().
| #define TBCIDELETE_RO | ( | t, | |
| v, | |||
| sz | |||
| ) | tbci_s_allocator<t>(DUMMY3(t)).dealloc(v, sz) |
Definition at line 635 of file malloc_cache.h.
| typedef char* charptr |
Definition at line 617 of file malloc_cache.h.
| typedef double* doubleptr |
Definition at line 604 of file malloc_cache.h.
| typedef float* floatptr |
Definition at line 607 of file malloc_cache.h.
| typedef int* intptr |
Definition at line 613 of file malloc_cache.h.
| typedef long* longptr |
Definition at line 622 of file malloc_cache.h.
| typedef unsigned char* ucharptr |
Definition at line 619 of file malloc_cache.h.
| typedef unsigned int* uintptr |
Definition at line 610 of file malloc_cache.h.
| typedef unsigned long* ulongptr |
Definition at line 625 of file malloc_cache.h.
| typedef void* voidptr |
Definition at line 628 of file malloc_cache.h.
| struct tbci_memalloc_cache_tls ALIGN | ( | 64 | ) |
|
inline |
Definition at line 567 of file malloc_cache.h.
|
inline |
Definition at line 618 of file malloc_cache.h.
|
inline |
Definition at line 603 of file malloc_cache.h.
|
inline |
Definition at line 605 of file malloc_cache.h.
|
inline |
Definition at line 606 of file malloc_cache.h.
|
inline |
Definition at line 608 of file malloc_cache.h.
|
inline |
Definition at line 612 of file malloc_cache.h.
|
inline |
Definition at line 614 of file malloc_cache.h.
|
inline |
Definition at line 621 of file malloc_cache.h.
|
inline |
Definition at line 623 of file malloc_cache.h.
|
inline |
Definition at line 616 of file malloc_cache.h.
|
inline |
Definition at line 620 of file malloc_cache.h.
|
inline |
Definition at line 611 of file malloc_cache.h.
|
inline |
Definition at line 626 of file malloc_cache.h.
|
inline |
Definition at line 609 of file malloc_cache.h.
|
inline |
Definition at line 615 of file malloc_cache.h.
|
inline |
Definition at line 624 of file malloc_cache.h.
|
inline |
Definition at line 627 of file malloc_cache.h.
|
inline |
Definition at line 629 of file malloc_cache.h.
| volatile unsigned int all |
Definition at line 98 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::smp_deinit().
| unsigned char free_idx |
Definition at line 96 of file malloc_cache.h.
| const T* free_pt[8] |
Definition at line 94 of file malloc_cache.h.
| unsigned short free_sz[8] |
Definition at line 95 of file malloc_cache.h.
| volatile unsigned int hit |
Definition at line 98 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::smp_deinit().
| volatile unsigned int miss |
Definition at line 97 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::smp_deinit().
| volatile unsigned int srch |
Definition at line 98 of file malloc_cache.h.
Referenced by tbci_memalloc_cache< T >::smp_deinit().
1.8.5