Greetings, and thank you! This will indeed clear the warning -- thanks again! There are a few other places where this occurs in GCL's code as well. I'd left these in as a reminder of some changes I need to put in the compiler, as I can't control these warnings on user code in any case.
The situation is roughly this -- we've been able to put in many more optimizations by explicitly declaring the type of constant bindings to the return type of the initializing form. The compiler now relies on this in many places -- for example all array references are wrapped in a let binding of the indices so that they will be treated as fixnums, (actually, type 'seqind, which is (ash most-positive-fixnum -3)). Eventually we would like to expand this to autodeclare bindings which retain their type on modification, and maybe even bindings whose type can be inferred from their use as an argument to a known function in a known position, etc. To determine whether a binding is changed or not, I've written a little custom code at the top of gcl_cmplet.lsp. #'declare-let-bindings-new does all the work. Macros are recursively expanded, and certain forms which do not imply evaluation (i.e. 'the, the various binding forms, etc.) are stepped over. When a setq is found with the right syntax, the binding is detected as changed. The problem with this is that it basically duplicates the work that pass1 will do as it processes the let. There is a slot in the var structure which indicates whether it is changed -- one even has the type further down the stack when c1setq is processed. So we really want a trial run of pass1 on the let body. This works just fine, but is a bit slow -- noticeably so on pcl compilation, so I've shied away from this for now. But in the next few weeks I intend to get it working and address the speed bottleneck somehow. My special code is not smart enough to detect that index is changed as it is originally written, and so declares it as a constant type '(integer -1 -1). This can obviously be fixed, but I think it more efficient to centralize on an additional trial run of pass1. Take care, Robert Boyer <[EMAIL PROTECTED]> writes: > The compilation of emit-dlap is causing the warning: > > ;; Warning: Type mismatches between INDEX and (LET* ((#:G17380 1)) (+ > INDEX #:G17380)) > > This problem can be solved, I believe, by replacing the definition of > emit-dlap with the following. All I have done is to split the initial let* > into two lets, so that the declaration of the variable, index, of the first > let can have effect/scope before index is incf'ed. > > Bob > > (defun emit-dlap (args metatypes hit miss value-reg &optional slot-regs) > (let ((index -1)) > (declare (fixnum index)) > (let ((wrapper-bindings (mapcan #'(lambda (arg mt) > (unless (eq mt 't) > (incf index) > `((,(intern (format nil > "WRAPPER-~D" index) > *the-pcl-package*) > ,(emit-fetch-wrapper mt arg 'miss > (pop > slot-regs)))))) > args metatypes)) > (wrappers (mapcar #'car wrapper-bindings))) > (unless wrappers (error "Every metatype is T.")) > `(block dfun > (tagbody > (let ((field (cache-field cache)) > (cache-vector (cache-vector cache)) > (mask (cache-mask cache)) > (size (cache-size cache)) > (overflow (cache-overflow cache)) > ,@wrapper-bindings) > (declare (fixnum size field mask)) > ,(cond ((cdr wrappers) > (emit-greater-than-1-dlap wrappers 'miss value-reg)) > (value-reg > (emit-1-t-dlap (car wrappers) 'miss value-reg)) > (t > (emit-1-nil-dlap (car wrappers) 'miss))) > (return-from dfun ,hit)) > miss > (return-from dfun ,miss)))))) > > > -- Camm Maguire [EMAIL PROTECTED] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah _______________________________________________ Gcl-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/gcl-devel
