mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-13 16:30:32 -07:00
speed up looking up and setting values of dynamic variables
Introduce ecl_cmp_symbol_value and ecl_cmp_setq which do the minimal amount of work needed to implement symbol-value and setq for dynamic variables which we have checked to be non-null and of type symbol in the compiler. Also introduce a type check in ecl_symbol_value to be consistent with ecl_setq which also checks the type. These two functions are mainly used for the embedding interface now, so for that reason it is also useful to have a type check in there.
This commit is contained in:
parent
52e62805dd
commit
d437bd0779
17 changed files with 105 additions and 78 deletions
|
|
@ -357,14 +357,14 @@
|
|||
(LEXICAL (wt-lex var-loc))
|
||||
((SPECIAL GLOBAL)
|
||||
(if (safe-compile)
|
||||
(wt "ecl_symbol_value(" var-loc ")")
|
||||
(wt "ecl_cmp_symbol_value(cl_env_copy," var-loc ")")
|
||||
(wt "ECL_SYM_VAL(cl_env_copy," var-loc ")")))
|
||||
(t (wt var-loc))
|
||||
)))
|
||||
|
||||
(defun set-var (loc var &aux (var-loc (var-loc var))) ; ccb
|
||||
(unless (var-p var)
|
||||
(baboon :format-control "set-var: ~s is not a vairable."
|
||||
(baboon :format-control "set-var: ~s is not a variable."
|
||||
:format-arguments (list var)))
|
||||
(case (var-kind var)
|
||||
(CLOSURE
|
||||
|
|
@ -377,7 +377,7 @@
|
|||
(wt #\;))
|
||||
((SPECIAL GLOBAL)
|
||||
(if (safe-compile)
|
||||
(wt-nl "cl_set(" var-loc ",")
|
||||
(wt-nl "ecl_cmp_setq(cl_env_copy," var-loc ",")
|
||||
(wt-nl "ECL_SETQ(cl_env_copy," var-loc ","))
|
||||
(wt-coerce-loc (var-rep-type var) loc)
|
||||
(wt ");"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue