#define FIXOBJ_RECORD_APP_INDEX 0x12 /* Index of record applicator. */
#define DUMMY_HISTORY 0x13 /* Empty history structure. */
#define Bignum_One 0x14 /* Cache for bignum one. */
-/* #define UNUSED 0x15 */
+#define FIXOBJ_PROXIED_RECORD_TYPES 0x15
#define Termination_Vector 0x16 /* Names for terminations. */
#define Termination_Proc_Vector 0x17 /* Handlers for terminations. */
/* #define UNUSED 0x18 */
/* 0x12 */ "record-applicator-index", \
/* 0x13 */ "dummy-history", \
/* 0x14 */ "bignum-one", \
- /* 0x15 */ 0, \
+ /* 0x15 */ "proxied-record-types", \
/* 0x16 */ "microcode-terminations-vector", \
/* 0x17 */ "microcode-terminations-procedures", \
/* 0x18 */ 0, \
/* 0x3D */ "pc-sample/prob-comp-table", \
/* 0x3E */ "pc-sample/ufo-table", \
/* 0x3F */ "compiled-code-bkpt-handler", \
- /* 0x40 */ 0 , \
+ /* 0x40 */ 0, \
/* 0x41 */ "callback-handler", \
/* 0x42 */ 0, \
/* 0x43 */ 0, \
8 #!aux
9 '()
10 weak #f
+ ...
+ 0x100 -> 0x1FF reserved for fasdumpable records
*/
#define SHARP_F MAKE_OBJECT (TC_FALSE, 0)
#define UNSPECIFIC MAKE_OBJECT (TC_CONSTANT, 1)
#define DEFAULT_OBJECT MAKE_OBJECT (TC_CONSTANT, 7)
#define EMPTY_LIST MAKE_OBJECT (TC_CONSTANT, 9)
+#define FASDUMP_RECORD_MARKER_START 0x100
+#define FASDUMP_RECORD_MARKER_END 0x200
#define BROKEN_HEART_ZERO MAKE_OBJECT (TC_BROKEN_HEART, 0)
/* Last immediate reference trap. */
STORE_FIXOBJ (ARITY_DISPATCHER_TAG,
(char_pointer_to_symbol
("#[(microcode)arity-dispatcher-tag]")));
+ STORE_FIXOBJ (FIXOBJ_PROXIED_RECORD_TYPES,
+ (make_vector ((FASDUMP_RECORD_MARKER_END
+ - FASDUMP_RECORD_MARKER_START),
+ SHARP_F,
+ false)));
#ifdef __WIN32__
NT_initialize_fov (fixed_objects);
PRIMITIVE_RETURN (UNSPECIFIC);
}
\f
+static SCHEME_OBJECT record_marker (SCHEME_OBJECT);
+
/* An applicable record is one whose tag is FIXOBJ_RECORD_TAG and
which has an applicator at FIXOBJ_RECORD_APP_INDEX within that tag.
It is applied just like an entity: the record is passed as the
SCHEME_OBJECT
record_applicator (SCHEME_OBJECT record)
{
- SCHEME_OBJECT metatag = (VECTOR_REF (fixed_objects, FIXOBJ_RECORD_TAG));
- SCHEME_OBJECT index_object
- = (VECTOR_REF (fixed_objects, FIXOBJ_RECORD_APP_INDEX));
+ SCHEME_OBJECT marker = (record_marker (record));
+ return ((RECORD_P (marker))
+ && ((VECTOR_REF (marker, 0))
+ == (VECTOR_REF (fixed_objects, FIXOBJ_RECORD_TAG))))
+ ? (VECTOR_REF (marker,
+ (FIXNUM_TO_ULONG (VECTOR_REF (fixed_objects,
+ FIXOBJ_RECORD_APP_INDEX)))))
+ : SHARP_F;
+}
- if ((RECORD_P (metatag))
- && (FIXNUM_P (index_object))
- && (FIXNUM_TO_ULONG_P (index_object)))
- {
- unsigned long index = (FIXNUM_TO_ULONG (index_object));
- SCHEME_OBJECT tag = (VECTOR_REF (record, 0));
- if (RECORD_P (tag)
- && ((VECTOR_REF (tag, 0)) == metatag)
- && (index < (VECTOR_LENGTH (tag)))) {
- return (VECTOR_REF (tag, index));
- }
- }
- return SHARP_F;
+static SCHEME_OBJECT
+record_marker (SCHEME_OBJECT record)
+{
+ SCHEME_OBJECT marker = (VECTOR_REF (record, 0));
+ return (((OBJECT_TYPE (marker)) == TC_CONSTANT)
+ && ((OBJECT_DATUM (marker)) >= FASDUMP_RECORD_MARKER_START)
+ && ((OBJECT_DATUM (marker)) < FASDUMP_RECORD_MARKER_END))
+ ? (VECTOR_REF ((VECTOR_REF (fixed_objects, FIXOBJ_PROXIED_RECORD_TYPES)),
+ ((OBJECT_DATUM (marker)) - FASDUMP_RECORD_MARKER_START)))
+ : marker;
}
(define (%valid-default-inits? default-inits n-fields)
(fix:= n-fields (length default-inits)))
+(defer-boot-action 'record-procedures
+ (lambda ()
+ (set! %valid-default-inits?
+ (named-lambda (%valid-default-inits? default-inits n-fields)
+ (and (fix:= n-fields (length default-inits))
+ (every (lambda (init)
+ (or (not init)
+ (thunk? init)))
+ default-inits))))
+ unspecific))
+
(define (initialize-record-procedures!)
- (set! %valid-default-inits?
- (named-lambda (%valid-default-inits? default-inits n-fields)
- (and (fix:= n-fields (length default-inits))
- (every (lambda (init)
- (or (not init)
- (thunk? init)))
- default-inits))))
- (%initialize-applicator-context!))
+ (run-deferred-boot-actions 'record-procedures))
\f
(define %record-metatag)
(define record-type?)
(guarantee record-type? record-type 'set-record-type-applicator!)
(if applicator
(guarantee procedure? applicator 'set-record-type-applicator!))
- (if (%record-type-fasdumpable? record-type)
- (error "Record types can't be applicable and fasdumpable:" record-type))
(%set-record-type-applicator! record-type applicator))
\f
(define (record? object)
(register-predicate! %record-type-proxy? 'record-type-proxy)
(define (set-record-type-fasdumpable! type proxy)
- (guarantee record-type? type 'set-record-type-fasdumpable!)
- (guarantee %record-type-proxy? proxy 'set-record-type-fasdumpable!)
- (if (%record-type-applicator type)
- (error "Record types can't be applicable and fasdumpable:" type))
- (without-interrupts
- (lambda ()
- (if (%record-type-fasdumpable? type)
- (error "Record type already fasdumpable:" type))
- (if (%proxy->record-type proxy)
- (error "Record-type proxy already in use:" proxy))
- (%set-proxied-record-type! proxy type)
- (%set-record-type-instance-marker! type proxy))))
+ (defer-boot-action 'record-procedures
+ (lambda ()
+ (set-record-type-fasdumpable! type proxy))))
+
+(defer-boot-action 'record-procedures
+ (lambda ()
+ (set! set-record-type-fasdumpable!
+ (named-lambda (set-record-type-fasdumpable! type proxy)
+ (guarantee record-type? type 'set-record-type-fasdumpable!)
+ (guarantee %record-type-proxy? proxy 'set-record-type-fasdumpable!)
+ (without-interrupts
+ (lambda ()
+ (if (%record-type-fasdumpable? type)
+ (error "Record type already fasdumpable:" type))
+ (if (%proxy->record-type proxy)
+ (error "Record-type proxy already in use:" proxy))
+ (%set-proxied-record-type! proxy type)
+ (%set-record-type-instance-marker! type proxy)))))
+ unspecific))
(define-integrable (%record-type-proxy->index marker)
(fix:- (object-new-type (ucode-type fixnum) marker) #x100))
(vector-set! %proxied-record-types (%record-type-proxy->index proxy) type))
(define %proxied-record-types)
-(add-boot-init!
- (lambda ()
- (set! %proxied-record-types (make-vector #x100 #f))
- unspecific))
+(defer-boot-action 'record-procedures
+ (lambda ()
+ (set! %proxied-record-types (fixed-objects-item 'proxied-record-types))
+ unspecific))
(define record-type-proxy:pathname (%index->record-type-proxy 0))
(define record-type-proxy:host (%index->record-type-proxy 1))