Sun May 24 13:30:05 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* cleanup finalization stuff
hunk ./src/clos.lisp 113
- :documentation "Pointer to the C++ object.")
- (owned-p :accessor owned-p :initarg :owned-p
- :initform t
- :documentation "T when the object is owned by Lisp and
-NIL when C++ is the owner.")
- (const-p :reader const-p :initarg :const-p
- :initform nil
- :documentation "T when the object is const and NIL otherwise."))
+ :documentation "Pointer to the C++ object."))
hunk ./src/clos.lisp 121
- ((enumerations :initform (make-hash-table)
- :initarg :enumerations
- :reader enumerations
- :documentation "The enumerations of the class.
-Maps the type-id of the enumeration to a hash-table that
-maps an enum value to a symbol."))
+ ()
hunk ./src/clos.lisp 195
-(defun smoke-class-symbol (class)
- (if (external-p class)
- (class-name (find-smoke-class class))
- (lispify (name class))))
+(defun smoke-class-symbol (smoke-class)
+ "Returns the Lisp class-name of SMOKE-CLASS:"
+ (if (external-p smoke-class)
+ (class-name (find-smoke-class smoke-class))
+ (lispify (name smoke-class))))
hunk ./src/clos.lisp 284
- (pointer value))
+ (cast value (find-smoke-class (get-class type))))
+ ;(pointer value))
hunk ./src/clos.lisp 287
- (cancel-finalization value) ;; Fixme mark object as invalid or copy it
- ;(remove-object (pointer value))
- (remove-if-exists (pointer value));;FIXME!
- (setf (slot-value value 'pointer) (null-pointer))))
+ (cancel-finalization value) [_$_]
+ (unless (virtual-destructor-p (class-of value))
+ (remove-object (pointer value))))) ;; Fixme mark object as invalid or copy it
+
hunk ./src/clos.lisp 309
-;(eval-startup (:execute)
-; (memoize:memoize-function 'get-gf-for-method)
-; (memoize:clear-memoized-function 'get-gf-for-method))
-
hunk ./src/clos.lisp 395
- (setf (slot-value object 'owned-p) t)
+ (take-ownership object)
hunk ./src/clos.lisp 401
- :owned-p (stack-p type)
hunk ./src/clos.lisp 402
+ (when (stack-p type)
+ (take-ownership ret)
+ (add-object ret))
hunk ./src/object-map.lisp 61
+(defun take-ownership (object)
+ "Assigns the ownership of OBJECT to Lisp. i.e.:
+cl-smoke is responsible for deleting the object."
+ (let ((finalizer (make-finalize object)))
+ (finalize object finalizer)))
+ [_$_]
hunk ./src/object-map.lisp 68
+ "Adds OBJECT to the pointer -> object map. It can later be retrived
+with GET-OBJECT."
hunk ./src/object-map.lisp 74
- (when (owned-p object)
- (let ((finalizer (make-finalize object)))
- (finalize object finalizer)))
hunk ./src/objects/class.lisp 50
+(defun virtual-destructor-p (class)
+ "Returns T when CLASS has a virtual destructor and NIL otherwise."
+ (/= 0 (get-flag class :virtual-destructor)))
+
hunk ./src/objects/stack.lisp 164
- (object-to-lisp (foreign-slot-value stack-item
- 'smoke-stack-item
- 'class)
- type))
+ (let ((object (object-to-lisp (foreign-slot-value stack-item
+ 'smoke-stack-item
+ 'class)
+ type)))
+ object))
hunk ./src/objects/type.lisp 36
- (boole boole-and (get-struct-slot-value type 'flags)
- (foreign-enum-value 'smoke-type-flags flag)))
+ (logand (get-struct-slot-value type 'flags)
+ #xF0 ;; = ! 0x0F
+ (foreign-enum-value 'smoke-type-flags flag)))
+
+(defun get-allocation-flag (type)
+ (logand (get-struct-slot-value type 'flags)
+ #x30))
hunk ./src/objects/type.lisp 46
- (/= 0 (get-flag type :stack)))
+ (= (get-allocation-flag type) (get-flag type :stack)))
hunk ./src/objects/type.lisp 50
- (/= 0 (get-flag type :reference)))
+ (= (get-allocation-flag type) (get-flag type :reference)))
hunk ./src/objects/type.lisp 54
- (/= 0 (get-flag type :pointer)))
+ (= (get-allocation-flag type) (get-flag type :pointer)))
hunk ./src/objects/type.lisp 67
- (boole boole-and (get-struct-slot-value type 'flags)
- (foreign-enum-value 'smoke-type-flags :type-id)))
+ (logand (get-struct-slot-value type 'flags)
+ (foreign-enum-value 'smoke-type-flags :type-id)))
hunk ./src/smoke.lisp 81
+