mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-15 05:43:19 -08:00
Safer inline expansion for BOUNDP
This commit is contained in:
parent
c59b212fd4
commit
ec9727f9f5
4 changed files with 19 additions and 14 deletions
|
|
@ -141,22 +141,23 @@ cl_symbol_value(cl_object sym)
|
|||
@(return value)
|
||||
}
|
||||
|
||||
bool
|
||||
ecl_boundp(cl_env_ptr env, cl_object sym)
|
||||
{
|
||||
if (Null(sym)) {
|
||||
return 1;
|
||||
} else {
|
||||
if (!SYMBOLP(sym))
|
||||
FEtype_error_symbol(sym);
|
||||
return ECL_SYM_VAL(the_env, sym) != OBJNULL;
|
||||
}
|
||||
}
|
||||
|
||||
cl_object
|
||||
cl_boundp(cl_object sym)
|
||||
{
|
||||
const cl_env_ptr the_env = ecl_process_env();
|
||||
cl_object output;
|
||||
if (Null(sym)) {
|
||||
output = Ct;
|
||||
} else {
|
||||
if (!SYMBOLP(sym))
|
||||
FEtype_error_symbol(sym);
|
||||
if (ECL_SYM_VAL(the_env, sym) == OBJNULL)
|
||||
output = Cnil;
|
||||
else
|
||||
output = Ct;
|
||||
}
|
||||
@(return output)
|
||||
@(return (ecl_boundp(the_env,sym)? Ct : Cnil))
|
||||
}
|
||||
|
||||
cl_object
|
||||
|
|
|
|||
|
|
@ -1227,7 +1227,8 @@
|
|||
(proclaim-function fboundp (symbol) t :predicate t)
|
||||
(proclaim-function symbol-value (symbol) t)
|
||||
(proclaim-function boundp (symbol) t :predicate t :no-side-effects t)
|
||||
(def-inline boundp :always (symbol) :bool "ECL_SYM_VAL(cl_env_copy,#0)!=OBJNULL")
|
||||
(def-inline boundp :always (t) :bool "ecl_boundp(cl_env_copy,#0)")
|
||||
(def-inline boundp :unsafe ((and symbol (not null))) :bool "ECL_SYM_VAL(cl_env_copy,#0)!=OBJNULL")
|
||||
|
||||
(proclaim-function macro-function (symbol) t)
|
||||
(proclaim-function special-operator-p (symbol) t :predicate t)
|
||||
|
|
|
|||
|
|
@ -1467,6 +1467,7 @@ extern ECL_API cl_object cl_symbol_value(cl_object sym);
|
|||
extern ECL_API cl_object cl_boundp(cl_object sym);
|
||||
extern ECL_API cl_object cl_special_operator_p(cl_object form);
|
||||
extern ECL_API cl_object ecl_fdefinition(cl_object fname);
|
||||
extern ECL_API bool ecl_boundp(cl_env_ptr env, cl_object o);
|
||||
|
||||
/* sequence.c */
|
||||
|
||||
|
|
|
|||
|
|
@ -1851,7 +1851,9 @@
|
|||
|
||||
(def-inline copy-readtable :always (null null) t "standard_readtable")
|
||||
|
||||
(def-inline boundp :always (symbol) :bool "ECL_SYM_VAL(cl_env_copy,#0)!=OBJNULL")
|
||||
(def-inline boundp :always (t) :bool "ecl_boundp(cl_env_copy,#0)")
|
||||
(def-inline boundp :unsafe (symbol) :bool "@0;Null(#0)||(ECL_SYM_VAL(cl_env_copy,#0)!=OBJNULL)")
|
||||
|
||||
|
||||
;; file sequence.d
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue