home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / lib / msgc / include / gcint.h next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.0 KB  |  111 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef gcint_h___
  20. #define gcint_h___
  21.  
  22. #include "prmon.h"
  23. #include "prgc.h"
  24.  
  25. extern PRLogModuleInfo *_pr_msgc_lm;
  26. extern GCInfo _pr_gcData;
  27.  
  28. #if defined(_WIN32) && !defined(DEBUG)
  29. #undef INLINE_LOCK
  30. #endif
  31.  
  32. #ifdef INLINE_LOCK
  33. #define LOCK_GC()       EnterCriticalSection(&_pr_gcData.lock->mutexHandle)
  34. #define UNLOCK_GC()     LeaveCriticalSection(&_pr_gcData.lock->mutexHandle)
  35. #else
  36. #define LOCK_GC()       PR_EnterMonitor(_pr_gcData.lock)
  37. #define UNLOCK_GC()     PR_ExitMonitor (_pr_gcData.lock)
  38. #define GC_IS_LOCKED()  (PR_GetMonitorEntryCount(_pr_gcData.lock)!=0)
  39. #endif
  40.  
  41. #ifdef DEBUG
  42. #define _GCTRACE(x, y) if (_pr_gcData.flags & x) GCTrace y
  43. #else
  44. #define _GCTRACE(x, y)
  45. #endif
  46.  
  47. extern GCBeginGCHook *_pr_beginGCHook;
  48. extern void *_pr_beginGCHookArg;
  49. extern GCBeginGCHook *_pr_endGCHook;
  50. extern void *_pr_endGCHookArg;
  51.  
  52. extern GCBeginFinalizeHook *_pr_beginFinalizeHook;
  53. extern void *_pr_beginFinalizeHookArg;
  54. extern GCBeginFinalizeHook *_pr_endFinalizeHook;
  55. extern void *_pr_endFinalizeHookArg;
  56.  
  57. extern int _pr_do_a_dump;
  58. extern FILE *_pr_dump_file;
  59.  
  60. extern PRLogModuleInfo *_pr_gc_lm;
  61.  
  62. /*
  63. ** Root finders. Root finders are used by the GC to find pointers into
  64. ** the GC heap that are not contained in the GC heap.
  65. */
  66. typedef struct RootFinderStr RootFinder;
  67.  
  68. struct RootFinderStr {
  69.     RootFinder *next;
  70.     GCRootFinder *func;
  71.     char *name;
  72.     void *arg;
  73. };
  74. extern RootFinder *_pr_rootFinders;
  75.  
  76. typedef struct CollectorTypeStr {
  77.     GCType gctype;
  78.     uint32 flags;
  79. } CollectorType;
  80.  
  81. #define GC_MAX_TYPES    256
  82. extern CollectorType *_pr_collectorTypes;
  83.  
  84. #define _GC_TYPE_BUSY   0x1
  85. #define _GC_TYPE_FINAL  0x2
  86. #define _GC_TYPE_WEAK   0x4
  87.  
  88. /* Slot in _pr_gcTypes used for free memory */
  89. #define FREE_MEMORY_TYPEIX 255
  90.  
  91. extern void _PR_InitGC(PRWord flags);
  92. extern void _MD_InitGC(void);
  93. extern void PR_CALLBACK _PR_ScanFinalQueue(void *notused);
  94.  
  95. /*
  96. ** Grow the GC Heap.
  97. */
  98. extern void *_MD_GrowGCHeap(PRUint32 *sizep);
  99.  
  100. /*
  101. ** Extend the GC Heap.
  102. */
  103. extern PRBool _MD_ExtendGCHeap(char *base, PRInt32 oldSize, PRInt32 newSize);
  104.  
  105. /*
  106. ** Free a GC segment.
  107. */
  108. extern void _MD_FreeGCSegment(void *base, PRInt32 len);
  109.  
  110. #endif /* gcint_h___ */
  111.