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
d6669461
Commit
d6669461
authored
34 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Wrote reallocate-system-memory.
parent
1627a6b3
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/alieneval.lisp
+27
-1
27 additions, 1 deletion
code/alieneval.lisp
with
27 additions
and
1 deletion
code/alieneval.lisp
+
27
−
1
View file @
d6669461
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/alieneval.lisp,v 1.1.1.2
0
1990/0
7/07 00:51:37
wlott Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/alieneval.lisp,v 1.1.1.2
1
1990/0
8/15 17:45:03
wlott Exp $
;;;
;;;
;;; This file contains any the part of the Alien implementation that
;;; This file contains any the part of the Alien implementation that
;;; is not part of the compiler.
;;; is not part of the compiler.
...
@@ -372,13 +372,39 @@
...
@@ -372,13 +372,39 @@
;;; Allocate random memory from the system area.
;;; Allocate random memory from the system area.
;;;
;;;
(
defun
allocate-system-memory
(
bytes
)
(
defun
allocate-system-memory
(
bytes
)
(
declare
(
type
index
bytes
))
(
gr-call*
mach:vm_allocate
*task-self*
(
int-sap
0
)
bytes
t
))
(
gr-call*
mach:vm_allocate
*task-self*
(
int-sap
0
)
bytes
t
))
;;; REALLOCATE-SYSTEM-MEMORY -- public
;;;
;;; Either allocate more memory at the end of this block, or allocate a new
;;; block and move the old memory into it.
;;;
(
defun
reallocate-system-memory
(
old
old-size
new-size
)
(
declare
(
type
system-area-pointer
old
)
(
type
index
old-size
new-size
))
;; ### Got to work the page size into this somehow. The vm_allocate
;; will fail much more often than it otherwise would 'cause if the old
;; block stops in the middle of a page, we can't extend it.
(
if
(
eql
(
mach:vm_allocate
*task-self*
(
sap+
old
old-size
)
(
-
new-size
old-size
)
nil
)
mach:kern-success
)
old
(
let
((
new
(
allocate-system-memory
new-size
)))
(
declare
(
type
system-area-pointer
new
))
(
system-area-copy
old
0
new
0
(
*
old-size
vm:byte-bits
))
(
deallocate-system-memory
old
old-size
)
new
)))
;;; DEALLOCATE-SYSTEM-MEMORY -- public
;;; DEALLOCATE-SYSTEM-MEMORY -- public
;;;
;;;
;;; Deallocate that memory.
;;; Deallocate that memory.
;;;
;;;
(
defun
deallocate-system-memory
(
addr
bytes
)
(
defun
deallocate-system-memory
(
addr
bytes
)
(
declare
(
type
system-area-pointer
addr
)
(
type
index
bytes
))
(
gr-call*
mach:vm_deallocate
*task-self*
addr
bytes
))
(
gr-call*
mach:vm_deallocate
*task-self*
addr
bytes
))
...
...
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