Changeset 13153
- Timestamp:
- 01/16/11 12:02:54 (13 years ago)
- Location:
- branches/unsafe-p-removal/abcl/src/org/armedbear/lisp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/unsafe-p-removal/abcl/src/org/armedbear/lisp/compiler-pass1.lisp
r13151 r13153 1154 1154 '( 1155 1155 1156 constantp endp evenp floatp integerp listp minusp1157 numberp oddp plusp rationalp realp1158 ;; predicates not marked as such?1159 simple-vector-p1160 stringp1161 symbolp1162 vectorp1163 zerop1164 atom1165 consp1166 fixnump1167 packagep1168 readtablep1169 characterp1170 bit-vector-p1171 SIMPLE-TYPEP1172 1173 declare1174 multiple-value-call1175 multiple-value-list1176 multiple-value-prog11177 nth1178 progn1179 1180 EQL EQUAL1181 + - / *1182 < < > >= = /=1183 ASH1184 AREF1185 RPLACA RPLACD1186 1156 %ldb 1187 1157 and 1188 1158 aset 1189 car1190 cdr1191 1159 char 1192 1160 char-code … … 1200 1168 delete 1201 1169 elt 1202 eq1203 eql1204 1170 find-class 1205 1171 funcall … … 1210 1176 gethash 1211 1177 gethash1 1212 if1213 1178 sys::%length 1214 1179 list … … 1226 1191 min 1227 1192 mod 1228 neq1229 1193 not 1230 1194 nthcdr -
branches/unsafe-p-removal/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r13151 r13153 672 672 `(let (*saved-operands* 673 673 *operand-representations* 674 (*register* *register*)) ;; hmm can we do this?? either body 674 (*register* *register*) 675 ) ;; hmm can we do this?? either body 675 676 ;; could allocate registers ... 676 677 ,@argument-buildup-body … … 681 682 "Load any operands which have been saved into registers 682 683 back onto the stack in preparation of the execution of the opcode." 683 (dolist (operand (reverse *saved-operands*)) 684 (emit 'aload operand))) 684 (mapcar #'emit-push-register 685 (reverse *saved-operands*) 686 (reverse *operand-representations*))) 685 687 686 688 (defun save-existing-operands () 687 689 "If any operands have been compiled to the stack, 688 690 save them in registers." 689 (do times (i (length *operand-representations*))691 (dolist (representation *operand-representations*) 690 692 (let ((register (allocate-register))) 691 693 (push register *saved-operands*) 692 (emit 'astore register)))694 (emit-move-from-stack register representation))) 693 695 694 696 (setf *saved-operands* (nreverse *saved-operands*))) 695 697 696 (defun compile-operand (form representation )698 (defun compile-operand (form representation &optional cast) 697 699 "Compiles `form` into `representation`, storing the resulting value 698 700 on the operand stack, if it's safe to do so. Otherwise stores the value … … 705 707 706 708 (compile-form form 'stack representation) 709 (when cast 710 (emit-checkcast cast)) 707 711 (when unsafe 708 712 (let ((register (allocate-register))) 709 713 (push register *saved-operands*) 710 (assert (null representation)) 711 (emit 'astore register))) 714 (emit-move-from-stack register representation))) 712 715 713 716 (push representation *operand-representations*))) … … 830 833 (sys::%format t "emit-move-from-stack general case~%") 831 834 (aver nil)))) 835 836 (defknown emit-push-register (t &optional t) t) 837 (defun emit-push-register (source &optional representation) 838 (declare (optimize speed)) 839 (assert (fixnump source)) 840 (emit (ecase representation 841 ((:int :boolean :char) 842 'iload) 843 (:long 'lload) 844 (:float 'fload) 845 (:double 'dload) 846 ((nil) 'aload)) 847 source)) 832 848 833 849 ;; Expects value on stack. … … 1597 1613 (let ((arg1 (car args)) 1598 1614 (arg2 (cadr args))) 1599 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 1600 arg2 'stack nil) 1601 (emit-invokevirtual +lisp-object+ op 1602 (lisp-object-arg-types 1) +lisp-object+) 1615 (with-operand-accumulation 1616 ((compile-operand arg1 nil) 1617 (compile-operand arg2 nil) 1618 (maybe-emit-clear-values arg1 arg2)) 1619 (emit-invokevirtual +lisp-object+ op 1620 (lisp-object-arg-types 1) +lisp-object+)) 1603 1621 (fix-boxing representation nil) 1604 1622 (emit-move-from-stack target representation))) … … 1650 1668 (arg1 (%car args)) 1651 1669 (arg2 (%cadr args))) 1652 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 1653 arg2 'stack nil) 1654 (let ((LABEL1 (gensym)) 1655 (LABEL2 (gensym))) 1656 (emit (if (eq op 'EQ) 'if_acmpne 'if_acmpeq) LABEL1) 1657 (emit-push-true representation) 1658 (emit 'goto LABEL2) 1659 (label LABEL1) 1660 (emit-push-false representation) 1661 (label LABEL2)) 1670 (with-operand-accumulation 1671 ((compile-operand arg1 nil) 1672 (compile-operand arg2 nil) 1673 (maybe-emit-clear-values arg1 arg2)) 1674 (let ((LABEL1 (gensym)) 1675 (LABEL2 (gensym))) 1676 (emit (if (eq op 'EQ) 'if_acmpne 'if_acmpeq) LABEL1) 1677 (emit-push-true representation) 1678 (emit 'goto LABEL2) 1679 (label LABEL1) 1680 (emit-push-false representation) 1681 (label LABEL2))) 1662 1682 (emit-move-from-stack target representation)) 1663 1683 t) … … 1677 1697 (cond ((and (fixnum-type-p type1) 1678 1698 (fixnum-type-p type2)) 1679 (compile-forms-and-maybe-emit-clear-values arg1 'stack :int 1680 arg2 'stack :int) 1699 (with-operand-accumulation 1700 ((compile-operand arg1 :int) 1701 (compile-operand arg2 :int) 1702 (maybe-emit-clear-values arg1 arg2))) 1681 1703 (let ((label1 (gensym)) 1682 1704 (label2 (gensym))) … … 1688 1710 (label label2))) 1689 1711 ((fixnum-type-p type2) 1690 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 1691 arg2 'stack :int) 1712 (with-operand-accumulation 1713 ((compile-operand arg1 nil) 1714 (compile-operand arg2 :int) 1715 (maybe-emit-clear-values arg1 arg2))) 1692 1716 (emit-ifne-for-eql representation '(:int))) 1693 1717 ((fixnum-type-p type1) 1694 (compile-forms-and-maybe-emit-clear-values arg1 'stack :int 1695 arg2 'stack nil) 1718 (with-operand-accumulation 1719 ((compile-operand arg1 :int) 1720 (compile-operand arg2 nil) 1721 (maybe-emit-clear-values arg1 arg2))) 1696 1722 (emit 'swap) 1697 1723 (emit-ifne-for-eql representation '(:int))) 1698 1724 ((eq type2 'CHARACTER) 1699 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 1700 arg2 'stack :char) 1725 (with-operand-accumulation 1726 ((compile-operand arg1 nil) 1727 (compile-operand arg2 :char) 1728 (maybe-emit-clear-values arg1 arg2))) 1701 1729 (emit-ifne-for-eql representation '(:char))) 1702 1730 ((eq type1 'CHARACTER) 1703 (compile-forms-and-maybe-emit-clear-values arg1 'stack :char 1704 arg2 'stack nil) 1731 (with-operand-accumulation 1732 ((compile-operand arg1 :char) 1733 (compile-operand arg2 nil) 1734 (maybe-emit-clear-values arg1 arg2))) 1705 1735 (emit 'swap) 1706 1736 (emit-ifne-for-eql representation '(:char))) 1707 1737 (t 1708 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 1709 arg2 'stack nil) 1738 (with-operand-accumulation 1739 ((compile-operand arg1 nil) 1740 (compile-operand arg2 nil) 1741 (maybe-emit-clear-values arg1 arg2))) 1710 1742 (ecase representation 1711 1743 (:boolean … … 2213 2245 (let ((LABEL1 (gensym)) 2214 2246 (LABEL2 (gensym))) 2215 (compile-forms-and-maybe-emit-clear-values 2216 arg1 'stack common-rep 2217 arg2 'stack common-rep) 2218 (emit-numeric-comparison op common-rep LABEL1) 2219 (emit-push-true representation) 2220 (emit 'goto LABEL2) 2221 (label LABEL1) 2222 (emit-push-false representation) 2223 (label LABEL2)) 2247 (with-operand-accumulation 2248 ((compile-operand arg1 common-rep) 2249 (compile-operand arg2 common-rep) 2250 (maybe-emit-clear-values arg1 arg2)) 2251 (emit-numeric-comparison op common-rep LABEL1) 2252 (emit-push-true representation) 2253 (emit 'goto LABEL2) 2254 (label LABEL1) 2255 (emit-push-false representation) 2256 (label LABEL2))) 2224 2257 (emit-move-from-stack target representation) 2225 2258 (return-from p2-numeric-comparison)) … … 2265 2298 (arg3-register 2266 2299 (unless (node-constant-p arg3) (allocate-register)))) 2267 ( compile-form arg1 'stack :int)2268 (compile-form arg2 'stack:int)2269 (when arg2-register2270 (emit 'dup)2271 (emit 'istore arg2-register))2272 (cond (arg3-register2273 (compile-form arg3 'stack :int)2274 (emit 'istore arg3-register)2275 (maybe-emit-clear-values arg1 arg2 arg3))2276 (t2277 (maybe-emit-clear-values arg1 arg2)))2300 (with-operand-accumulation 2301 ((compile-operand arg1 :int) 2302 (compile-operand arg2 :int) 2303 (when arg3-register 2304 (compile-operand arg3 :int)) 2305 (maybe-emit-clear-values arg1 arg2 arg3)) 2306 (when arg3-register 2307 (emit 'istore arg3-register)) 2308 (when arg2-register 2309 (emit 'dup) 2310 (emit 'istore arg2-register))) 2278 2311 ;; First test. 2279 2312 (emit test LABEL1) … … 2525 2558 (let* ((arg1 (%cadr form)) 2526 2559 (arg2 (%caddr form))) 2527 (compile-forms-and-maybe-emit-clear-values arg1 'stack :char 2528 arg2 'stack :char) 2560 (with-operand-accumulation 2561 ((compile-operand arg1 :char) 2562 (compile-operand arg2 :char) 2563 (maybe-emit-clear-values arg1 arg2))) 2529 2564 'if_icmpne))) 2530 2565 … … 2533 2568 (let ((arg1 (%cadr form)) 2534 2569 (arg2 (%caddr form))) 2535 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2536 arg2 'stack nil) 2570 (with-operand-accumulation 2571 ((compile-operand arg1 nil) 2572 (compile-operand arg2 nil) 2573 (maybe-emit-clear-values arg1 arg2))) 2537 2574 'if_acmpne))) 2538 2575 … … 2563 2600 (type2 (derive-compiler-type arg2))) 2564 2601 (cond ((and (fixnum-type-p type1) (fixnum-type-p type2)) 2565 (compile-forms-and-maybe-emit-clear-values arg1 'stack :int 2566 arg2 'stack :int) 2602 (with-operand-accumulation 2603 ((compile-operand arg1 :int) 2604 (compile-operand arg2 :int) 2605 (maybe-emit-clear-values arg1 arg2))) 2567 2606 'if_icmpne) 2568 2607 ((and (eq type1 'CHARACTER) (eq type2 'CHARACTER)) 2569 (compile-forms-and-maybe-emit-clear-values arg1 'stack :char 2570 arg2 'stack :char) 2608 (with-operand-accumulation 2609 ((compile-operand arg1 :char) 2610 (compile-operand arg2 :char) 2611 (maybe-emit-clear-values arg1 arg2))) 2571 2612 'if_icmpne) 2572 2613 ((eq type2 'CHARACTER) 2573 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2574 arg2 'stack :char) 2614 (with-operand-accumulation 2615 ((compile-operand arg1 nil) 2616 (compile-operand arg2 :char) 2617 (maybe-emit-clear-values arg1 arg2))) 2575 2618 (emit-invokevirtual +lisp-object+ "eql" '(:char) :boolean) 2576 2619 'ifeq) 2577 2620 ((eq type1 'CHARACTER) 2578 (compile-forms-and-maybe-emit-clear-values arg1 'stack :char 2579 arg2 'stack nil) 2621 (with-operand-accumulation 2622 ((compile-operand arg1 :char) 2623 (compile-operand arg2 nil) 2624 (maybe-emit-clear-values arg1 arg2))) 2580 2625 (emit 'swap) 2581 2626 (emit-invokevirtual +lisp-object+ "eql" '(:char) :boolean) 2582 2627 'ifeq) 2583 2628 ((fixnum-type-p type2) 2584 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2585 arg2 'stack :int) 2629 (with-operand-accumulation 2630 ((compile-operand arg1 nil) 2631 (compile-operand arg2 :int) 2632 (maybe-emit-clear-values arg1 arg2))) 2586 2633 (emit-invokevirtual +lisp-object+ "eql" '(:int) :boolean) 2587 2634 'ifeq) 2588 2635 ((fixnum-type-p type1) 2589 (compile-forms-and-maybe-emit-clear-values arg1 'stack :int 2590 arg2 'stack nil) 2636 (with-operand-accumulation 2637 ((compile-operand arg1 :int) 2638 (compile-operand arg2 nil) 2639 (maybe-emit-clear-values arg1 arg2))) 2591 2640 (emit 'swap) 2592 2641 (emit-invokevirtual +lisp-object+ "eql" '(:int) :boolean) 2593 2642 'ifeq) 2594 2643 (t 2595 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2596 arg2 'stack nil) 2644 (with-operand-accumulation 2645 ((compile-operand arg1 nil) 2646 (compile-operand arg2 nil) 2647 (maybe-emit-clear-values arg1 arg2))) 2597 2648 (emit-invokevirtual +lisp-object+ "eql" 2598 2649 (lisp-object-arg-types 1) :boolean) … … 2608 2659 (arg2 (%caddr form))) 2609 2660 (cond ((fixnum-type-p (derive-compiler-type arg2)) 2610 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2611 arg2 'stack :int) 2661 (with-operand-accumulation 2662 ((compile-operand arg1 nil) 2663 (compile-operand arg2 :int) 2664 (maybe-emit-clear-values arg1 arg2))) 2612 2665 (emit-invokevirtual +lisp-object+ 2613 2666 translated-op 2614 2667 '(:int) :boolean)) 2615 2668 (t 2616 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2617 arg2 'stack nil) 2669 (with-operand-accumulation 2670 ((compile-operand arg1 nil) 2671 (compile-operand arg2 nil) 2672 (maybe-emit-clear-values arg1 arg2))) 2618 2673 (emit-invokevirtual +lisp-object+ 2619 2674 translated-op … … 2625 2680 (let ((arg1 (%cadr form)) 2626 2681 (arg2 (%caddr form))) 2627 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2628 arg2 'stack nil) 2682 (with-operand-accumulation 2683 ((compile-operand arg1 nil) 2684 (compile-operand arg2 nil) 2685 (maybe-emit-clear-values arg1 arg2))) 2629 2686 (emit-invokevirtual +lisp-object+ "typep" 2630 2687 (lisp-object-arg-types 1) +lisp-object+) … … 2636 2693 (let ((arg1 (%cadr form)) 2637 2694 (arg2 (%caddr form))) 2638 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2639 arg2 'stack nil) 2695 (with-operand-accumulation 2696 ((compile-operand arg1 nil) 2697 (compile-operand arg2 nil) 2698 (maybe-emit-clear-values arg1 arg2))) 2640 2699 (emit-invokestatic +lisp+ "memq" 2641 2700 (lisp-object-arg-types 2) :boolean) … … 2646 2705 (let ((arg1 (%cadr form)) 2647 2706 (arg2 (%caddr form))) 2648 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2649 arg2 'stack nil) 2707 (with-operand-accumulation 2708 ((compile-operand arg1 nil) 2709 (compile-operand arg2 nil) 2710 (maybe-emit-clear-values arg1 arg2))) 2650 2711 (emit-invokestatic +lisp+ "memql" 2651 2712 (lisp-object-arg-types 2) :boolean) … … 2662 2723 ((and (fixnum-type-p type1) 2663 2724 (fixnum-type-p type2)) 2664 (compile-forms-and-maybe-emit-clear-values arg1 'stack :int 2665 arg2 'stack :int) 2725 (with-operand-accumulation 2726 ((compile-operand arg1 :int) 2727 (compile-operand arg2 :int) 2728 (maybe-emit-clear-values arg1 arg2))) 2666 2729 'if_icmpeq) 2667 2730 ((fixnum-type-p type2) 2668 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2669 arg2 'stack :int) 2731 (with-operand-accumulation 2732 ((compile-operand arg1 nil) 2733 (compile-operand arg2 :int) 2734 (maybe-emit-clear-values arg1 arg2))) 2670 2735 (emit-invokevirtual +lisp-object+ "isNotEqualTo" '(:int) :boolean) 2671 2736 'ifeq) … … 2673 2738 ;; FIXME Compile the args in reverse order and avoid the swap if 2674 2739 ;; either arg is a fixnum or a lexical variable. 2675 (compile-forms-and-maybe-emit-clear-values arg1 'stack :int 2676 arg2 'stack nil) 2740 (with-operand-accumulation 2741 ((compile-operand arg1 :int) 2742 (compile-operand arg2 nil) 2743 (maybe-emit-clear-values arg1 arg2))) 2677 2744 (emit 'swap) 2678 2745 (emit-invokevirtual +lisp-object+ "isNotEqualTo" '(:int) :boolean) 2679 2746 'ifeq) 2680 2747 (t 2681 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2682 arg2 'stack nil) 2748 (with-operand-accumulation 2749 ((compile-operand arg1 nil) 2750 (compile-operand arg2 nil) 2751 (maybe-emit-clear-values arg1 arg2))) 2683 2752 (emit-invokevirtual +lisp-object+ "isNotEqualTo" 2684 2753 (lisp-object-arg-types 1) :boolean) … … 2697 2766 (if (funcall op arg1 arg2) :consequent :alternate)) 2698 2767 ((and (fixnum-type-p type1) (fixnum-type-p type2)) 2699 (compile-forms-and-maybe-emit-clear-values arg1 'stack :int 2700 arg2 'stack :int) 2768 (with-operand-accumulation 2769 ((compile-operand arg1 :int) 2770 (compile-operand arg2 :int) 2771 (maybe-emit-clear-values arg1 arg2))) 2701 2772 (ecase op 2702 2773 (< 'if_icmpge) … … 2706 2777 (= 'if_icmpne))) 2707 2778 ((and (java-long-type-p type1) (java-long-type-p type2)) 2708 (compile-forms-and-maybe-emit-clear-values arg1 'stack :long 2709 arg2 'stack :long) 2779 (with-operand-accumulation 2780 ((compile-operand arg1 :long) 2781 (compile-operand arg2 :long) 2782 (maybe-emit-clear-values arg1 arg2))) 2710 2783 (emit 'lcmp) 2711 2784 (ecase op … … 2716 2789 (= 'ifne))) 2717 2790 ((fixnum-type-p type2) 2718 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2719 arg2 'stack :int) 2791 (with-operand-accumulation 2792 ((compile-operand arg1 nil) 2793 (compile-operand arg2 :int) 2794 (maybe-emit-clear-values arg1 arg2))) 2720 2795 (emit-invokevirtual +lisp-object+ 2721 2796 (ecase op … … 2730 2805 ;; FIXME We can compile the args in reverse order and avoid 2731 2806 ;; the swap if either arg is a fixnum or a lexical variable. 2732 (compile-forms-and-maybe-emit-clear-values arg1 'stack :int 2733 arg2 'stack nil) 2807 (with-operand-accumulation 2808 ((compile-operand arg1 :int) 2809 (compile-operand arg2 nil) 2810 (maybe-emit-clear-values arg1 arg2))) 2734 2811 (emit 'swap) 2735 2812 (emit-invokevirtual +lisp-object+ … … 2743 2820 'ifeq) 2744 2821 (t 2745 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2746 arg2 'stack nil) 2822 (with-operand-accumulation 2823 ((compile-operand arg1 nil) 2824 (compile-operand arg2 nil) 2825 (maybe-emit-clear-values arg1 arg2))) 2747 2826 (emit-invokevirtual +lisp-object+ 2748 2827 (ecase op … … 2775 2854 (let ((arg1 (second arg)) 2776 2855 (arg2 (third arg))) 2777 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 2778 arg2 'stack nil) 2856 (with-operand-accumulation 2857 ((compile-operand arg1 nil) 2858 (compile-operand arg2 nil) 2859 (maybe-emit-clear-values arg1 arg2))) 2779 2860 (emit 'if_acmpeq LABEL1))) 2780 2861 ((eq (derive-compiler-type arg) 'BOOLEAN) … … 5422 5503 (let ((index-form (second form)) 5423 5504 (list-form (third form))) 5424 (compile-forms-and-maybe-emit-clear-values index-form 'stack :int 5425 list-form 'stack nil) 5426 (emit 'swap) 5427 (emit-invokevirtual +lisp-object+ "NTH" '(:int) +lisp-object+) 5505 (with-operand-accumulation 5506 ((compile-operand index-form :int) 5507 (compile-operand list-form nil) 5508 (maybe-emit-clear-values index-form list-form)) 5509 (emit 'swap) 5510 (emit-invokevirtual +lisp-object+ "NTH" '(:int) +lisp-object+)) 5428 5511 (fix-boxing representation nil) ; FIXME use derived result type 5429 5512 (emit-move-from-stack target representation))) … … 5449 5532 (compile-constant value target representation)) 5450 5533 (result-rep 5451 (compile-forms-and-maybe-emit-clear-values 5452 arg1 'stack result-rep 5453 arg2 'stack result-rep) 5454 (emit (case result-rep 5455 (:int 'imul) 5456 (:long 'lmul) 5457 (:float 'fmul) 5458 (:double 'dmul) 5459 (t 5460 (sys::format t "p2-times: unsupported rep case")))) 5534 (with-operand-accumulation 5535 ((compile-operand arg1 result-rep) 5536 (compile-operand arg2 result-rep) 5537 (maybe-emit-clear-values arg1 arg2)) 5538 (emit (case result-rep 5539 (:int 'imul) 5540 (:long 'lmul) 5541 (:float 'fmul) 5542 (:double 'dmul) 5543 (t 5544 (sys::format t "p2-times: unsupported rep case"))))) 5461 5545 (convert-representation result-rep representation) 5462 5546 (emit-move-from-stack target representation)) … … 5555 5639 (emit-move-from-stack target representation)) 5556 5640 (result-rep 5557 (compile-forms-and-maybe-emit-clear-values 5558 arg1 'stack result-rep 5559 arg2 'stack result-rep) 5560 (emit (case result-rep 5561 (:int 'iadd) 5562 (:long 'ladd) 5563 (:float 'fadd) 5564 (:double 'dadd) 5565 (t 5566 (sys::format 5567 t "p2-plus: Unexpected result-rep ~S for form ~S." 5568 result-rep form) 5569 (assert nil)))) 5641 (with-operand-accumulation 5642 ((compile-operand arg1 result-rep) 5643 (compile-operand arg2 result-rep) 5644 (maybe-emit-clear-values arg1 arg2)) 5645 (emit (case result-rep 5646 (:int 'iadd) 5647 (:long 'ladd) 5648 (:float 'fadd) 5649 (:double 'dadd) 5650 (t 5651 (sys::format 5652 t "p2-plus: Unexpected result-rep ~S for form ~S." 5653 result-rep form) 5654 (assert nil))))) 5570 5655 (convert-representation result-rep representation) 5571 5656 (emit-move-from-stack target representation)) … … 5577 5662 (emit-invoke-method "incr" target representation)) 5578 5663 ((or (fixnum-type-p type1) (fixnum-type-p type2)) 5579 (compile-forms-and-maybe-emit-clear-values 5580 arg1 'stack (when (fixnum-type-p type1) :int) 5581 arg2 'stack (when (null (fixnum-type-p type1)) :int)) 5582 (when (fixnum-type-p type1) 5583 (emit 'swap)) 5584 (emit-invokevirtual +lisp-object+ "add" 5585 '(:int) +lisp-object+) 5664 (with-operand-accumulation 5665 ((compile-operand arg1 (when (fixnum-type-p type1) :int)) 5666 (compile-operand arg2 (when (null (fixnum-type-p type1)) 5667 :int)) 5668 (maybe-emit-clear-values arg1 arg2)) 5669 (when (fixnum-type-p type1) 5670 (emit 'swap)) 5671 (emit-invokevirtual +lisp-object+ "add" 5672 '(:int) +lisp-object+)) 5586 5673 (fix-boxing representation result-type) 5587 5674 (emit-move-from-stack target representation)) … … 5635 5722 (compile-constant (- arg1 arg2) target representation)) 5636 5723 (result-rep 5637 (compile-forms-and-maybe-emit-clear-values 5638 arg1 'stack result-rep 5639 arg2 'stack result-rep) 5640 (emit (case result-rep 5641 (:int 'isub) 5642 (:long 'lsub) 5643 (:float 'fsub) 5644 (:double 'dsub) 5645 (t 5646 (sys::%format t "p2-minus sub-instruction (rep: ~S); form: ~S~%" 5647 result-rep form) 5648 (assert nil)))) 5724 (with-operand-accumulation 5725 ((compile-operand arg1 result-rep) 5726 (compile-operand arg2 result-rep) 5727 (maybe-emit-clear-values arg1 arg2)) 5728 (emit (case result-rep 5729 (:int 'isub) 5730 (:long 'lsub) 5731 (:float 'fsub) 5732 (:double 'dsub) 5733 (t 5734 (sys::%format t "p2-minus sub-instruction (rep: ~S); form: ~S~%" 5735 result-rep form) 5736 (assert nil))))) 5649 5737 (convert-representation result-rep representation) 5650 5738 (emit-move-from-stack target representation)) 5651 5739 ((fixnum-type-p type2) 5652 (compile-forms-and-maybe-emit-clear-values 5653 arg1 'stack nil 5654 arg2 'stack :int) 5655 (emit-invokevirtual +lisp-object+ 5656 "subtract" 5657 '(:int) +lisp-object+) 5740 (with-operand-accumulation 5741 ((compile-operand arg1 nil) 5742 (compile-operand arg2 :int) 5743 (maybe-emit-clear-values arg1 arg2)) 5744 (emit-invokevirtual +lisp-object+ 5745 "subtract" 5746 '(:int) +lisp-object+)) 5658 5747 (fix-boxing representation result-type) 5659 5748 (emit-move-from-stack target representation)) … … 5820 5909 (arg2 (%caddr form)) 5821 5910 (type1 (derive-compiler-type arg1))) 5822 (ecase representation 5823 (:int 5824 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 5825 arg2 'stack :int) 5826 (emit-invokevirtual +lisp-object+ "aref" '(:int) :int)) 5827 (:long 5828 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 5829 arg2 'stack :int) 5830 (emit-invokevirtual +lisp-object+ "aref_long" '(:int) :long)) 5831 (:char 5832 (cond ((compiler-subtypep type1 'string) 5833 (compile-form arg1 'stack nil) ; array 5834 (emit-checkcast +lisp-abstract-string+) 5835 (compile-form arg2 'stack :int) ; index 5836 (maybe-emit-clear-values arg1 arg2) 5837 (emit-invokevirtual +lisp-abstract-string+ 5838 "charAt" '(:int) :char)) 5839 (t 5840 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 5841 arg2 'stack :int) 5842 (emit-invokevirtual +lisp-object+ "AREF" '(:int) +lisp-object+) 5843 (emit-unbox-character)))) 5844 ((nil :float :double :boolean) 5845 ;;###FIXME for float and double, we probably want 5846 ;; separate java methods to retrieve the values. 5847 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 5848 arg2 'stack :int) 5849 (emit-invokevirtual +lisp-object+ "AREF" '(:int) +lisp-object+) 5850 (convert-representation nil representation))) 5911 (with-operand-accumulation 5912 ((compile-operand arg1 nil 5913 (when (compiler-subtypep type1 'string) 5914 +lisp-abstract-string+)) 5915 (compile-operand arg2 :int) 5916 (maybe-emit-clear-values arg1 arg2)) 5917 (ecase representation 5918 (:int 5919 (emit-invokevirtual +lisp-object+ "aref" '(:int) :int)) 5920 (:long 5921 (emit-invokevirtual +lisp-object+ "aref_long" '(:int) :long)) 5922 (:char 5923 (cond ((compiler-subtypep type1 'string) 5924 (emit-invokevirtual +lisp-abstract-string+ 5925 "charAt" '(:int) :char)) 5926 (t 5927 (emit-invokevirtual +lisp-object+ 5928 "AREF" '(:int) +lisp-object+) 5929 (emit-unbox-character)))) 5930 ((nil :float :double :boolean) 5931 ;;###FIXME for float and double, we probably want 5932 ;; separate java methods to retrieve the values. 5933 (emit-invokevirtual +lisp-object+ "AREF" '(:int) +lisp-object+) 5934 (convert-representation nil representation)))) 5851 5935 (emit-move-from-stack target representation))) 5852 5936 (t
Note: See TracChangeset
for help on using the changeset viewer.