mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-04-27 03:40:31 -07:00
predlib: define clos constants used by 'predlib' in 'symbols_table'
predlib.lsp is loaded before the clos module, but constants used by predlib were defined in the latter. That worked because the C compiler inlines constants that are fixnums, although it is a bit shaky to rely on particular optimizations. To avoid this dependency we hardcode relevant constants in symbols_list.h and later we assert in the clos module ethat their values are correct.
This commit is contained in:
parent
f27663bea6
commit
63d9f41f19
3 changed files with 9 additions and 7 deletions
|
|
@ -36,6 +36,7 @@
|
|||
#define MP_CONSTANT MP_PACKAGE | CONSTANT_SYMBOL
|
||||
#define CLOS_ORDINARY CLOS_PACKAGE | ORDINARY_SYMBOL
|
||||
#define CLOS_SPECIAL CLOS_PACKAGE | SPECIAL_SYMBOL
|
||||
#define CLOS_CONSTANT CLOS_PACKAGE | CONSTANT_SYMBOL
|
||||
#define KEYWORD KEYWORD_PACKAGE | CONSTANT_SYMBOL
|
||||
#define GRAY_ORDINARY GRAY_PACKAGE | ORDINARY_SYMBOL
|
||||
#define FFI_ORDINARY FFI_PACKAGE | ORDINARY_SYMBOL
|
||||
|
|
|
|||
|
|
@ -1690,6 +1690,8 @@ cl_symbols[] = {
|
|||
{CLOS_ "+BUILTIN-CLASSES+" ECL_FUN(NULL, NULL, -1) ECL_VAR(CLOS_ORDINARY, ECL_NIL)},
|
||||
{CLOS_ "*NEXT-METHODS*" ECL_FUN(NULL, NULL, -1) ECL_VAR(CLOS_SPECIAL, ECL_NIL)},
|
||||
{CLOS_ "*OPTIMIZE-SLOT-ACCESS*" ECL_FUN(NULL, NULL, -1) ECL_VAR(CLOS_SPECIAL, ECL_T)},
|
||||
{CLOS_ "+CLASS-NAME-NDX+" ECL_FUN(NULL, NULL, -1) ECL_VAR(CLOS_CONSTANT, ecl_make_fixnum(3))},
|
||||
{CLOS_ "+CLASS-PRECEDENCE-LIST-NDX+" ECL_FUN(NULL, NULL, -1) ECL_VAR(CLOS_CONSTANT, ecl_make_fixnum(7))},
|
||||
{CLOS_ "+THE-T-CLASS+" ECL_FUN(NULL, NULL, -1) ECL_VAR(CLOS_ORDINARY, ECL_NIL)},
|
||||
{CLOS_ "+THE-CLASS+" ECL_FUN(NULL, NULL, -1) ECL_VAR(CLOS_ORDINARY, ECL_NIL)},
|
||||
{CLOS_ "+THE-STD-CLASS+" ECL_FUN(NULL, NULL, -1) ECL_VAR(CLOS_ORDINARY, ECL_NIL)},
|
||||
|
|
|
|||
|
|
@ -76,13 +76,12 @@
|
|||
(dependents :initform nil :accessor class-dependents)
|
||||
(valid-initargs :accessor class-valid-initargs)
|
||||
(slot-table :accessor slot-table)
|
||||
(location-table :initform nil :accessor class-location-table)
|
||||
))
|
||||
|
||||
(defconstant +class-name-ndx+
|
||||
(position 'name +class-slots+ :key #'first))
|
||||
(defconstant +class-precedence-list-ndx+
|
||||
(position 'precedence-list +class-slots+ :key #'first)))
|
||||
(location-table :initform nil :accessor class-location-table)))
|
||||
;; INV these assertions validate constants hardcoded in symbols_list.h.
|
||||
(assert (= +class-name-ndx+
|
||||
(position 'name +class-slots+ :key #'first)))
|
||||
(assert (= +class-precedence-list-ndx+
|
||||
(position 'precedence-list +class-slots+ :key #'first))))
|
||||
|
||||
;;; ----------------------------------------------------------------------
|
||||
;;; STANDARD-CLASS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue