gc_alloc_ptrs.h raw

   1  /*
   2   * Copyright (c) 1996-1998 by Silicon Graphics.  All rights reserved.
   3   * Copyright (c) 2018-2021 Ivan Maidanski
   4   *
   5   * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
   6   * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
   7   *
   8   * Permission is hereby granted to use or copy this program
   9   * for any purpose, provided the above notices are retained on all copies.
  10   * Permission to modify the code and to distribute modified code is granted,
  11   * provided the above notices are retained, and a notice that the code was
  12   * modified is included with the above copyright notice.
  13   */
  14  
  15  /* This file is kept for a binary compatibility purpose only. */
  16  
  17  #ifndef GC_ALLOC_PTRS_H
  18  #define GC_ALLOC_PTRS_H
  19  
  20  #include "gc/gc.h"
  21  
  22  #ifdef __cplusplus
  23  extern "C" {
  24  #endif
  25  
  26  #ifndef GC_API_PRIV
  27  #  define GC_API_PRIV GC_API
  28  #endif
  29  
  30  /*
  31   * Some compilers do not accept `const` together with the `dllimport`
  32   * attribute, so the symbols below are exported as non-constant ones.
  33   */
  34  #ifndef GC_APIVAR_CONST
  35  #  if defined(GC_BUILD) || !defined(GC_DLL)
  36  #    define GC_APIVAR_CONST const
  37  #  else
  38  #    define GC_APIVAR_CONST /*< empty */
  39  #  endif
  40  #endif
  41  
  42  GC_API_PRIV void **GC_APIVAR_CONST GC_objfreelist_ptr;
  43  GC_API_PRIV void **GC_APIVAR_CONST GC_aobjfreelist_ptr;
  44  GC_API_PRIV void **GC_APIVAR_CONST GC_uobjfreelist_ptr;
  45  
  46  #ifdef GC_ATOMIC_UNCOLLECTABLE
  47  GC_API_PRIV void **GC_APIVAR_CONST GC_auobjfreelist_ptr;
  48  #endif
  49  
  50  /*
  51   * Manually update the number of bytes allocated during the current
  52   * collection cycle and the number of explicitly deallocated bytes of
  53   * memory since the last collection, respectively.  Both functions are
  54   * unsynchronized, `GC_call_with_alloc_lock()` should be used to avoid
  55   * data race.
  56   */
  57  GC_API_PRIV void GC_CALL GC_incr_bytes_allocd(size_t /* `bytes` */);
  58  GC_API_PRIV void GC_CALL GC_incr_bytes_freed(size_t /* `bytes` */);
  59  
  60  #ifdef __cplusplus
  61  } /* extern "C" */
  62  #endif
  63  
  64  #endif /* GC_ALLOC_PTRS_H */
  65