Changeset 11636
- Timestamp:
- 02/06/09 23:01:59 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r11634 r11636 3194 3194 3195 3195 3196 (defun emit-numeric-comparison (op representation false-LABEL) 3197 (let* ((pos (position op comparison-ops)) 3198 (ops-table (cdr (assoc representation comparison-ins))) 3199 (ops (aref ops-table pos))) 3200 (if (listp ops) 3201 (progn 3202 (emit (car ops)) 3203 (emit (cadr ops) false-LABEL)) 3204 (emit ops false-LABEL)))) 3205 3196 3206 ;; Note that /= is not transitive, so we don't handle it here. 3197 3207 (defknown p2-numeric-comparison (t t t) t) … … 3221 3231 arg1 'stack common-rep 3222 3232 arg2 'stack common-rep) 3223 (let* ((pos (position op comparison-ops)) 3224 (ops-table (cdr (assoc common-rep comparison-ins))) 3225 (ops (aref ops-table pos))) 3226 (if (listp ops) 3227 (progn 3228 (emit (car ops)) 3229 (emit (cadr ops) LABEL1)) 3230 (emit ops LABEL1))) 3233 (emit-numeric-comparison op common-rep LABEL1) 3231 3234 (emit-push-true representation) 3232 3235 (emit 'goto LABEL2) … … 6757 6760 (let ((type1 (derive-compiler-type arg1)) 6758 6761 (type2 (derive-compiler-type arg2))) 6759 (cond ((and (fixnum-type-p type1) (fixnum-type-p type2)) 6760 (compile-form arg1 'stack :int) 6761 (emit 'dup) 6762 (compile-form arg2 'stack :int) 6763 (emit 'dup_x1) 6764 (let ((LABEL1 (gensym))) 6765 (emit (if (eq op 'max) 'if_icmpge 'if_icmple) LABEL1) 6766 (emit 'swap) ;; The lower stack value is greater-or-equal 6762 (cond ((and (java-long-type-p type1) (java-long-type-p type2)) 6763 (let ((common-rep (if (and (fixnum-type-p type1) 6764 (fixnum-type-p type2)) 6765 :int :long)) 6766 (LABEL1 (gensym))) 6767 (compile-form arg1 'stack common-rep) 6768 (emit-dup common-rep) 6769 (compile-form arg2 'stack common-rep) 6770 (emit (if (eq common-rep :long) 6771 'dup2_x2 'dup_x1)) 6772 (emit-numeric-comparison (if (eq op 'max) '<= '>=) 6773 common-rep LABEL1) 6774 (emit-swap common-rep common-rep) 6767 6775 (label LABEL1) 6768 (emit 'pop)) ;; Throw away the lower stack value 6769 (convert-representation :int representation) 6770 (emit-move-from-stack target representation)) 6771 ((and (java-long-type-p type1) (java-long-type-p type2)) 6772 (compile-form arg1 'stack :long) 6773 (emit 'dup2) 6774 (compile-form arg2 'stack :long) 6775 (emit 'dup2_x2) 6776 (emit 'lcmp) 6777 (let ((LABEL1 (gensym))) 6778 (emit (if (eq op 'max) 'ifge 'ifle) LABEL1) 6779 (emit 'dup2_x2) ;; pour-mans swap2 6780 (emit 'pop2) 6781 (label LABEL1) 6782 (emit 'pop2)) 6783 (convert-representation :long representation) 6784 (emit-move-from-stack target representation)) 6776 (emit-move-from-stack nil common-rep) 6777 (convert-representation common-rep representation) 6778 (emit-move-from-stack target representation))) 6785 6779 (t 6786 6780 (compile-form arg1 'stack nil)
Note: See TracChangeset
for help on using the changeset viewer.