Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
63015c7f
Commit
63015c7f
authored
Feb 11, 1999
by
simonm
Browse files
[project @ 1999-02-11 17:40:23 by simonm]
finalise/finalize changes.
parent
09e2e8bb
Changes
6
Hide whitespace changes
Inline
Side-by-side
ghc/includes/StgMiscClosures.h
View file @
63015c7f
/* -----------------------------------------------------------------------------
* $Id: StgMiscClosures.h,v 1.
9
1999/02/
05 16:02
:2
9
simonm Exp $
* $Id: StgMiscClosures.h,v 1.
10
1999/02/
11 17:40
:2
3
simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -28,7 +28,7 @@ STGFUN(BCO_entry);
STGFUN
(
EVACUATED_entry
);
STGFUN
(
FOREIGN_entry
);
STGFUN
(
WEAK_entry
);
STGFUN
(
NO_FINALI
S
ER_entry
);
STGFUN
(
NO_FINALI
Z
ER_entry
);
STGFUN
(
DEAD_WEAK_entry
);
STGFUN
(
STABLE_NAME_entry
);
STGFUN
(
TSO_entry
);
...
...
@@ -60,7 +60,7 @@ extern const StgInfoTable EVACUATED_info;
extern
const
StgInfoTable
FOREIGN_info
;
extern
const
StgInfoTable
WEAK_info
;
extern
const
StgInfoTable
DEAD_WEAK_info
;
extern
const
StgInfoTable
NO_FINALI
S
ER_info
;
extern
const
StgInfoTable
NO_FINALI
Z
ER_info
;
extern
const
StgInfoTable
STABLE_NAME_info
;
extern
const
StgInfoTable
FULL_MVAR_info
;
extern
const
StgInfoTable
EMPTY_MVAR_info
;
...
...
@@ -87,7 +87,7 @@ extern const StgInfoTable ret_bco_info;
extern
StgClosure
END_TSO_QUEUE_closure
;
extern
StgClosure
END_MUT_LIST_closure
;
extern
StgClosure
NO_FINALI
S
ER_closure
;
extern
StgClosure
NO_FINALI
Z
ER_closure
;
extern
StgClosure
dummy_ret_closure
;
extern
StgIntCharlikeClosure
CHARLIKE_closure
[];
...
...
ghc/rts/Evaluator.c
View file @
63015c7f
/* -----------------------------------------------------------------------------
* $Id: Evaluator.c,v 1.
8
1999/02/
05 16:02:38
simonm Exp $
* $Id: Evaluator.c,v 1.
9
1999/02/
11 17:40:24
simonm Exp $
*
* Copyright (c) The GHC Team 1994-1999.
*
...
...
@@ -202,7 +202,7 @@ static /*inline*/ void PushTaggedInteger ( mpz_ptr x )
SET_HDR(w, &WEAK_info, CCCS);
w->key = stgCast(StgClosure*,result);
w->value = stgCast(StgClosure*,result); /* or any other closure you have handy */
w->finali
s
er = funPtrToIO(mpz_free);
w->finali
z
er = funPtrToIO(mpz_free);
w->link = weak_ptr_list;
weak_ptr_list = w;
IF_DEBUG(weak, fprintf(stderr,"New weak pointer watching Foreign MPZ at %p\n",w));
...
...
@@ -2330,7 +2330,7 @@ enterLoop:
SET_HDR
(
w
,
&
WEAK_info
,
CCCS
);
w
->
key
=
PopCPtr
();
w
->
value
=
PopCPtr
();
w
->
finali
s
er
=
PopCPtr
();
w
->
finali
z
er
=
PopCPtr
();
w
->
link
=
weak_ptr_list
;
weak_ptr_list
=
w
;
IF_DEBUG
(
weak
,
fprintf
(
stderr
,
"New weak pointer at %p
\n
"
,
w
));
...
...
ghc/rts/GC.c
View file @
63015c7f
/* -----------------------------------------------------------------------------
* $Id: GC.c,v 1.
29
1999/02/
09 12:50:38
simonm Exp $
* $Id: GC.c,v 1.
30
1999/02/
11 17:40:26
simonm Exp $
*
* (c) The GHC Team 1998-1999
*
...
...
@@ -652,8 +652,8 @@ void GarbageCollect(void (*get_roots)(void))
alloc_blocks
=
0
;
alloc_blocks_lim
=
RtsFlags
.
GcFlags
.
minAllocAreaSize
;
/* start any pending finali
s
ers */
scheduleFinali
s
ers
(
old_weak_ptr_list
);
/* start any pending finali
z
ers */
scheduleFinali
z
ers
(
old_weak_ptr_list
);
/* check sanity after GC */
IF_DEBUG
(
sanity
,
checkSanity
(
N
));
...
...
@@ -692,7 +692,7 @@ void GarbageCollect(void (*get_roots)(void))
new live weak pointers, then all the currently unreachable ones are
dead.
For generational GC: we just don't try to finali
s
e weak pointers in
For generational GC: we just don't try to finali
z
e weak pointers in
older generations than the one we're collecting. This could
probably be optimised by keeping per-generation lists of weak
pointers, but for a few weak pointers this scheme will work.
...
...
@@ -707,7 +707,7 @@ traverse_weak_ptr_list(void)
if
(
weak_done
)
{
return
rtsFalse
;
}
/* doesn't matter where we evacuate values/finali
s
ers to, since
/* doesn't matter where we evacuate values/finali
z
ers to, since
* these pointers are treated as roots (iff the keys are alive).
*/
evac_gen
=
0
;
...
...
@@ -717,9 +717,9 @@ traverse_weak_ptr_list(void)
if
((
new
=
isAlive
(
w
->
key
)))
{
w
->
key
=
new
;
/* evacuate the value and finali
s
er */
/* evacuate the value and finali
z
er */
w
->
value
=
evacuate
(
w
->
value
);
w
->
finali
s
er
=
evacuate
(
w
->
finali
s
er
);
w
->
finali
z
er
=
evacuate
(
w
->
finali
z
er
);
/* remove this weak ptr from the old_weak_ptr list */
*
last_w
=
w
->
link
;
/* and put it on the new weak ptr list */
...
...
@@ -739,12 +739,12 @@ traverse_weak_ptr_list(void)
/* If we didn't make any changes, then we can go round and kill all
* the dead weak pointers. The old_weak_ptr list is used as a list
* of pending finali
s
ers later on.
* of pending finali
z
ers later on.
*/
if
(
flag
==
rtsFalse
)
{
for
(
w
=
old_weak_ptr_list
;
w
;
w
=
w
->
link
)
{
w
->
value
=
evacuate
(
w
->
value
);
w
->
finali
s
er
=
evacuate
(
w
->
finali
s
er
);
w
->
finali
z
er
=
evacuate
(
w
->
finali
z
er
);
}
weak_done
=
rtsTrue
;
}
...
...
ghc/rts/RtsStartup.c
View file @
63015c7f
/* -----------------------------------------------------------------------------
* $Id: RtsStartup.c,v 1.
6
1999/02/
05 16:02:50
simonm Exp $
* $Id: RtsStartup.c,v 1.
7
1999/02/
11 17:40:27
simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -114,8 +114,8 @@ extern void startupHaskell(int argc, char *argv[])
void
shutdownHaskell
(
void
)
{
/* Finali
s
e any remaining weak pointers */
finali
s
eWeakPointersNow
();
/* Finali
z
e any remaining weak pointers */
finali
z
eWeakPointersNow
();
#if defined(GRAN)
#error FixMe.
...
...
ghc/rts/Sanity.c
View file @
63015c7f
/* -----------------------------------------------------------------------------
* $Id: Sanity.c,v 1.
9
1999/02/
05 16:02:52
simonm Exp $
* $Id: Sanity.c,v 1.
10
1999/02/
11 17:40:28
simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -264,7 +264,7 @@ checkClosure( StgClosure* p )
{
StgWeak
*
w
=
(
StgWeak
*
)
p
;
ASSERT
(
LOOKS_LIKE_PTR
(
w
->
key
));
ASSERT
(
LOOKS_LIKE_PTR
(
w
->
value
));
ASSERT
(
LOOKS_LIKE_PTR
(
w
->
finali
s
er
));
ASSERT
(
LOOKS_LIKE_PTR
(
w
->
finali
z
er
));
if
(
w
->
link
)
{
ASSERT
(
LOOKS_LIKE_PTR
(
w
->
link
));
}
...
...
ghc/rts/Weak.h
View file @
63015c7f
/* -----------------------------------------------------------------------------
* $Id: Weak.h,v 1.
3
1999/02/
05 16:03:04
simonm Exp $
* $Id: Weak.h,v 1.
4
1999/02/
11 17:40:28
simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
* Weak pointers / finali
s
ers
* Weak pointers / finali
z
ers
*
* ---------------------------------------------------------------------------*/
extern
StgWeak
*
weak_ptr_list
;
void
finali
s
eWeakPointersNow
(
void
);
void
scheduleFinali
s
ers
(
StgWeak
*
w
);
void
finali
z
eWeakPointersNow
(
void
);
void
scheduleFinali
z
ers
(
StgWeak
*
w
);
void
markWeakList
(
void
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment