Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
b1ca967e
Commit
b1ca967e
authored
31 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Added stuff to fake scavenger hooks in the non-gengc system.
parent
1aea8bc7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/scavhook.lisp
+79
-1
79 additions, 1 deletion
code/scavhook.lisp
with
79 additions
and
1 deletion
code/scavhook.lisp
+
79
−
1
View file @
b1ca967e
...
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/scavhook.lisp,v 1.
1
199
1
/0
7/30 00
:4
0
:0
4
wlott Exp $"
)
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/scavhook.lisp,v 1.
2
199
3
/0
5/20 13
:4
5
:0
6
wlott Exp $"
)
;;;
;;; **********************************************************************
;;;
...
...
@@ -21,6 +21,9 @@
(
export
'
(
scavenger-hook
scavenger-hook-p
make-scavenger-hook
scavenger-hook-value
scavenger-hook-function
))
#+
gengc
(
progn
(
defun
scavenger-hook-p
(
object
)
"Returns T if OBJECT is a scavenger-hook, and NIL if not."
(
scavenger-hook-p
object
))
...
...
@@ -53,3 +56,78 @@
(
type
scavenger-hook
scavhook
))
(
setf
(
scavenger-hook-function
scavhook
)
function
))
)
; #+gengc progn
#-
gengc
(
progn
(
defstruct
(
scavhook
(
:conc-name
scavenger-hook-
)
(
:constructor
%make-scavenger-hook
(
%value
function
last-addr
))
(
:print-function
%print-scavenger-hook
))
;;
;; The value we are monitoring.
(
%value
nil
:type
t
)
;;
;; The function to invoke when the value gets scavenged (i.e. moved)
(
function
nil
:type
function
)
;;
;; The address of where it was last time.
(
last-addr
0
:type
(
unsigned-byte
#.
vm:word-bits
)))
(
defun
%print-scavenger-hook
(
scavhook
stream
depth
)
(
declare
(
ignore
depth
))
(
print-unreadable-object
(
scavhook
stream
:identity
t
:type
t
)))
(
eval-when
(
compile
eval
)
(
setf
(
info
type
kind
'scavenger-hook
)
:defined
)
(
setf
(
info
type
builtin
'scavenger-hook
)
nil
))
(
deftype
scavenger-hook
()
'scavhook
)
(
defvar
*scavenger-hooks*
nil
)
(
defun
make-scavenger-hook
(
&key
value
(
function
(
required-argument
)))
(
without-gcing
(
let
((
scavhook
(
%make-scavenger-hook
value
function
(
kernel:get-lisp-obj-address
value
))))
(
push
(
make-weak-pointer
scavhook
)
*scavenger-hooks*
)
scavhook
)))
(
declaim
(
inline
scavenger-hook-p
))
(
defun
scavenger-hook-p
(
thing
)
(
scavhook-p
thing
))
(
declaim
(
inline
scavenger-hook-value
))
(
defun
scavenger-hook-value
(
scavhook
)
(
scavenger-hook-%value
scavhook
))
(
defun
(
setf
scavenger-hook-value
)
(
value
scavhook
)
(
without-gcing
(
setf
(
scavenger-hook-%value
scavhook
)
value
)
(
setf
(
scavenger-hook-last-addr
scavhook
)
(
kernel:get-lisp-obj-address
value
)))
value
)
(
defun
scavhook-after-gc-hook
()
(
do
((
prev
nil
)
(
next
*scavenger-hooks*
(
cdr
next
)))
((
null
next
))
(
multiple-value-bind
(
scavhook
valid
)
(
weak-pointer-value
(
car
next
))
(
cond
(
valid
(
let*
((
value
(
scavenger-hook-value
scavhook
))
(
addr
(
kernel:get-lisp-obj-address
value
)))
(
unless
(
=
addr
(
scavenger-hook-last-addr
scavhook
))
(
setf
(
scavenger-hook-last-addr
scavhook
)
addr
)
(
funcall
(
scavenger-hook-function
scavhook
))))
(
setf
prev
next
))
(
prev
(
setf
(
cdr
prev
)
(
cdr
next
)))
(
t
(
setf
*scavenger-hooks*
(
cdr
next
)))))))
(
pushnew
'scavhook-after-gc-hook
*after-gc-hooks*
)
)
; #-gengc progn
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment