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