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
5c3b9f20
Commit
5c3b9f20
authored
34 years ago
by
ram
Browse files
Options
Downloads
Patches
Plain Diff
Added caching of the PRIMITIVE-TYPE via DEFUN-CACHED, and also reordered
the cases to put popular ones first.
parent
dfb9f196
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
compiler/old-rt/vm.lisp
+29
-18
29 additions, 18 deletions
compiler/old-rt/vm.lisp
with
29 additions
and
18 deletions
compiler/old-rt/vm.lisp
+
29
−
18
View file @
5c3b9f20
...
...
@@ -137,7 +137,7 @@
(
t
*any-primitive-type*
))))
;;; P
rimitive-Type
-- Interface
;;; P
RIMITIVE-TYPE
-- Interface
;;;
;;; Return the primitive type corresponding to a type descriptor structure.
;;; If a fixnum or an interesting simple vector, then return the appropriate
...
...
@@ -147,9 +147,36 @@
;;; In a bootstrapping situation, we should be careful to use the correct
;;; values for the system parameters.
;;;
(
defun
primitive-type
(
type
)
;;; Note: DEFUN-CACHED caches this translation; If the primitive type
;;; translation is ever changed (due to hardware configuration switches, etc.),
;;; then PRIMITIVE-TYPE-CACHE-CLEAR must be called to clear old cached
;;; information.
;;;
(
defun-cached
(
primitive-type
:hash-function
(
lambda
(
x
)
(
logand
(
cache-hash-eq
x
)
#x1FF
))
:hash-bits
9
:values
2
:default
(
values
nil
:empty
))
((
type
eq
))
(
declare
(
type
ctype
type
))
(
etypecase
type
(
named-type
(
case
(
named-type-name
type
)
((
t
bignum
ratio
string-char
function
)
(
values
(
primitive-type-or-lose
(
named-type-name
type
))
t
))
(
cons
(
values
(
primitive-type-or-lose
'list
)
nil
))
(
standard-char
(
values
(
primitive-type-or-lose
'string-char
)
nil
))
(
t
(
values
*any-primitive-type*
nil
))))
(
member-type
(
let*
((
members
(
member-type-members
type
))
(
res
(
primitive-type-of
(
first
members
))))
(
dolist
(
mem
(
rest
members
)
(
values
res
nil
))
(
unless
(
eq
(
primitive-type-of
mem
)
res
)
(
return
(
values
*any-primitive-type*
nil
))))))
(
numeric-type
(
if
(
not
(
eq
(
numeric-type-complexp
type
)
:real
))
(
values
*any-primitive-type*
nil
)
...
...
@@ -198,22 +225,6 @@
(
unless
ptype-exact
(
setq
exact
nil
))
(
unless
(
eq
ptype
res
)
(
return
(
values
*any-primitive-type*
nil
)))))))))
(
member-type
(
let*
((
members
(
member-type-members
type
))
(
res
(
primitive-type-of
(
first
members
))))
(
dolist
(
mem
(
rest
members
)
(
values
res
nil
))
(
unless
(
eq
(
primitive-type-of
mem
)
res
)
(
return
(
values
*any-primitive-type*
nil
))))))
(
named-type
(
case
(
named-type-name
type
)
((
t
bignum
ratio
string-char
function
)
(
values
(
primitive-type-or-lose
(
named-type-name
type
))
t
))
(
cons
(
values
(
primitive-type-or-lose
'list
)
nil
))
(
standard-char
(
values
(
primitive-type-or-lose
'string-char
)
nil
))
(
t
(
values
*any-primitive-type*
nil
))))
(
ctype
(
values
*any-primitive-type*
nil
))))
...
...
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