From 8bbebf02e846f89c8a7df1edb3c814cea6797f28 Mon Sep 17 00:00:00 2001 From: jjgarcia Date: Mon, 20 Mar 2006 09:04:10 +0000 Subject: [PATCH] Allow the user to impose that all slot accesses go through SLOT-VALUE, etc. --- src/CHANGELOG | 5 +++++ src/clos/kernel.lsp | 1 + src/clos/standard.lsp | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/CHANGELOG b/src/CHANGELOG index 46dc68b12..79ae95929 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -88,6 +88,11 @@ ECL 0.9i COMPUTE-SLOTS assign a location to each slot definition that has allocation :INSTANCE or :CLASS. + - A new defclass option, :optimize-slot-access, which defaults to T, controls + whether the slots accessors should address directly the values in the class + or use SLOT-VALUE. It should be set to NIL when one intends to redefine the + SLOT-*-USING-CLASS methods. + * Errors fixed: - The intermediate output of the compiler is written in the directory in which diff --git a/src/clos/kernel.lsp b/src/clos/kernel.lsp index ddd796dc8..60718bbc0 100644 --- a/src/clos/kernel.lsp +++ b/src/clos/kernel.lsp @@ -74,6 +74,7 @@ (defparameter +standard-class-slots+ (append +class-slots+ '((slot-table :accessor slot-table) + (optimize-slot-access :initarg :optimize-slot-access :initform t) (forward))))) #.(create-accessors +standard-class-slots+ 'standard-class) diff --git a/src/clos/standard.lsp b/src/clos/standard.lsp index 5b9922c95..f32c0705c 100644 --- a/src/clos/standard.lsp +++ b/src/clos/standard.lsp @@ -397,7 +397,8 @@ because it contains a reference to the undefined class~% ~A" reader setter) (declare (fixnum index)) (if (and (eql (slot-definition-allocation slotd) :instance) - (si:fixnump index)) + (si:fixnump index) + (slot-value standard-class 'optimize-slot-access)) (setf reader #'(lambda (self) (let ((value (si:instance-ref self index))) (if (si:sl-boundp value)