Changeset 13158
- Timestamp:
- 01/19/11 21:07:53 (12 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
r13157 r13158 1154 1154 '( 1155 1155 1156 char1157 1156 char-code 1158 1157 java:jclass … … 1192 1191 or 1193 1192 puthash 1194 quote1195 1193 read-line 1196 rplacd1197 schar1198 set1199 set-car1200 set-cdr1201 set-char1202 set-schar1203 set-std-slot-value1204 setq1205 std-slot-value1206 1194 stream-element-type 1207 structure-ref1208 structure-set1209 svref1210 svset1211 1195 sxhash 1212 1196 symbol-name -
branches/unsafe-p-removal/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r13157 r13158 4031 4031 (define-inlined-function p2-rplacd (form target representation) 4032 4032 ((check-arg-count form 2)) 4033 (let ((args (cdr form))) 4034 (compile-form (first args) 'stack nil) 4035 (when target 4036 (emit 'dup)) 4037 (compile-form (second args) 'stack nil) 4033 (let* ((args (cdr form)) 4034 (*register* *register*) 4035 (target-register (allocate-register nil))) 4036 (with-operand-accumulation 4037 ((accumulate-operand (nil 4038 :unsafe-p (some-nested-block 4039 #'node-opstack-unsafe-p 4040 (find-enclosed-blocks (first args)))) 4041 (compile-form (first args) 'stack nil) 4042 (when target-register 4043 (emit 'dup) 4044 (astore target-register))) 4045 (compile-operand (second args) nil))) 4046 (maybe-emit-clear-values (car args) (cadr args)) 4038 4047 (emit-invokevirtual +lisp-object+ 4039 4048 "setCdr" 4040 4049 (lisp-object-arg-types 1) 4041 4050 nil) 4042 (when target 4051 (when target-register 4052 (aload target-register) 4043 4053 (fix-boxing representation nil) 4044 4054 (emit-move-from-stack target representation)))) … … 4046 4056 (define-inlined-function p2-set-car/cdr (form target representation) 4047 4057 ((check-arg-count form 2)) 4048 (let ((op (%car form)) 4049 (args (%cdr form))) 4050 (compile-form (%car args) 'stack nil) 4051 (compile-form (%cadr args) 'stack nil) 4052 (when target 4053 (emit-dup nil :past nil)) 4058 (let* ((op (%car form)) 4059 (args (%cdr form)) 4060 (*register* *register*) 4061 (target-register (when target (allocate-register nil)))) 4062 (with-operand-accumulation 4063 ((compile-operand (%car args) nil) 4064 (accumulate-operand (nil 4065 :unsafe-p (some-nested-block 4066 #'node-opstack-unsafe-p 4067 (find-enclosed-blocks (cadr args)))) 4068 (compile-form (%cadr args) 'stack nil) 4069 (when target-register 4070 (emit 'dup) 4071 (astore target-register))) 4072 (maybe-emit-clear-values (car args) (cadr args)))) 4054 4073 (emit-invokevirtual +lisp-object+ 4055 4074 (if (eq op 'sys:set-car) "setCar" "setCdr") 4056 4075 (lisp-object-arg-types 1) 4057 4076 nil) 4058 (when target 4077 (when target-register 4078 (aload target-register) 4059 4079 (fix-boxing representation nil) 4060 4080 (emit-move-from-stack target representation)))) … … 4811 4831 (arg1 (first args)) 4812 4832 (arg2 (second args))) 4813 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 4814 arg2 'stack nil) 4833 (with-operand-accumulation 4834 ((compile-operand arg1 nil) 4835 (compile-operand arg2 nil))) 4836 (maybe-emit-clear-values arg1 arg2) 4815 4837 (emit-invokevirtual +lisp-object+ "SLOT_VALUE" 4816 4838 (lisp-object-arg-types 1) +lisp-object+) … … 4828 4850 (*register* *register*) 4829 4851 (value-register (when target (allocate-register nil)))) 4830 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 4831 arg2 'stack nil 4832 arg3 'stack nil) 4852 (with-operand-accumulation 4853 ((compile-operand arg1 nil) 4854 (compile-operand arg2 nil) 4855 (compile-operand arg3 nil))) 4833 4856 (when value-register 4834 4857 (emit 'dup) 4835 4858 (astore value-register)) 4859 (maybe-emit-clear-values arg1 arg2 arg3) 4836 4860 (emit-invokevirtual +lisp-object+ "setSlotValue" 4837 4861 (lisp-object-arg-types 2) nil) … … 5793 5817 (type1 (derive-compiler-type arg1)) 5794 5818 (type2 (derive-compiler-type arg2))) 5795 (cond ((and (eq representation :char) 5796 (zerop *safety*)) 5797 (compile-form arg1 'stack nil) 5798 (emit-checkcast +lisp-abstract-string+) 5799 (compile-form arg2 'stack :int) 5800 (maybe-emit-clear-values arg1 arg2) 5801 (emit-invokevirtual +lisp-abstract-string+ "charAt" 5802 '(:int) :char) 5803 (emit-move-from-stack target representation)) 5804 ((and (eq representation :char) 5819 (cond ((or (and (eq representation :char) 5820 (zerop *safety*)) 5821 (and (eq representation :char) 5805 5822 (or (eq op 'CHAR) (< *safety* 3)) 5806 5823 (compiler-subtypep type1 'STRING) 5807 (fixnum-type-p type2)) 5808 ( compile-form arg1 'stack nil)5809 (emit-checkcast+lisp-abstract-string+)5810 (compile-form arg2 'stack :int)5824 (fixnum-type-p type2))) 5825 (with-operand-accumulation 5826 ((compile-operand arg1 nil +lisp-abstract-string+) 5827 (compile-operand arg2 :int))) 5811 5828 (maybe-emit-clear-values arg1 arg2) 5812 5829 (emit-invokevirtual +lisp-abstract-string+ "charAt" … … 5814 5831 (emit-move-from-stack target representation)) 5815 5832 ((fixnum-type-p type2) 5816 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 5817 arg2 'stack :int) 5833 (with-operand-accumulation 5834 ((compile-operand arg1 nil) 5835 (compile-operand arg2 :int) 5836 (maybe-emit-clear-values arg1 arg2))) 5818 5837 (emit-invokevirtual +lisp-object+ 5819 5838 (symbol-name op) ;; "CHAR" or "SCHAR" … … 5847 5866 +lisp-simple-string+ 5848 5867 +lisp-abstract-string+))) 5849 (compile-form arg1 'stack nil) 5850 (emit-checkcast class) 5851 (compile-form arg2 'stack :int) 5852 (compile-form arg3 'stack :char) 5853 (when target 5854 (emit 'dup) 5855 (emit-move-from-stack value-register :char)) 5868 (with-operand-accumulation 5869 ((compile-operand arg1 nil class) 5870 (compile-operand arg2 :int) 5871 (accumulate-operand (:char 5872 :unsafe-p (some-nested-block 5873 #'node-opstack-unsafe-p 5874 (find-enclosed-blocks arg3))) 5875 (compile-form arg3 'stack :char) 5876 (when target 5877 (emit 'dup) 5878 (emit-move-from-stack value-register :char))))) 5856 5879 (maybe-emit-clear-values arg1 arg2 arg3) 5857 5880 (emit-invokevirtual class "setCharAt" '(:int :char) nil) … … 5869 5892 (let ((arg1 (%cadr form)) 5870 5893 (arg2 (%caddr form))) 5871 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 5872 arg2 'stack :int) 5894 (with-operand-accumulation 5895 ((compile-operand arg1 nil) 5896 (compile-operand arg2 :int))) 5897 (maybe-emit-clear-values arg1 arg2) 5873 5898 (emit-invokevirtual +lisp-object+ "SVREF" '(:int) +lisp-object+) 5874 5899 (fix-boxing representation nil) … … 5884 5909 (*register* *register*) 5885 5910 (value-register (when target (allocate-register nil)))) 5886 (compile-form arg1 'stack nil) ;; vector 5887 (compile-form arg2 'stack :int) ;; index 5888 (compile-form arg3 'stack nil) ;; new value 5911 (with-operand-accumulation 5912 ((compile-operand arg1 nil) ;; vector 5913 (compile-operand arg2 :int) ;; intex 5914 (compile-operand arg3 nil) ;; new value 5915 )) 5889 5916 (when value-register 5890 5917 (emit 'dup) … … 6073 6100 (let* ((*register* *register*) 6074 6101 (value-register (when target (allocate-register nil)))) 6075 (compile-forms-and-maybe-emit-clear-values arg1 'stack nil 6076 arg3 'stack nil) 6102 (with-operand-accumulation 6103 ((compile-operand arg1 nil) 6104 (compile-operand arg3 nil))) 6077 6105 (when value-register 6078 6106 (emit 'dup) 6079 6107 (astore value-register)) 6108 (maybe-emit-clear-values arg1 arg3) 6080 6109 (emit-invokevirtual +lisp-object+ 6081 6110 (format nil "setSlotValue_~D" arg2) … … 6088 6117 (let* ((*register* *register*) 6089 6118 (value-register (when target (allocate-register nil)))) 6090 ( compile-form arg1 'stack nil)6091 (emit-push-constant-int arg2)6092 (compile-form arg3 'stack nil)6119 (with-operand-accumulation 6120 ((compile-operand arg1 nil) 6121 (compile-operand arg3 nil))) 6093 6122 (maybe-emit-clear-values arg1 arg3) 6094 6123 (when value-register 6095 6124 (emit 'dup) 6096 6125 (astore value-register)) 6126 (emit-push-constant-int arg2) 6127 (emit 'swap) ;; prevent the integer 6128 ;; from being pushed, saved and restored 6097 6129 (emit-invokevirtual +lisp-object+ "setSlotValue" 6098 6130 (list :int +lisp-object+) nil) … … 6336 6368 (cond ((and (check-arg-count form 2) 6337 6369 (eq (derive-type (%cadr form)) 'SYMBOL)) 6338 ( emit-push-current-thread)6339 (compile-form (%cadr form) 'stack nil)6340 (emit-checkcast+lisp-symbol+)6341 (compile-form (%caddr form) 'stack nil)6370 (with-operand-accumulation 6371 ((emit-thread-operand) 6372 (compile-operand (%cadr form) nil +lisp-symbol+) 6373 (compile-operand (%caddr form) nil))) 6342 6374 (maybe-emit-clear-values (%cadr form) (%caddr form)) 6343 6375 (emit-invokevirtual +lisp-thread+ "setSpecialVariable" … … 6356 6388 (value-form (%caddr form))) 6357 6389 (when (or (null variable) 6358 6390 (variable-special-p variable)) 6359 6391 ;; We're setting a special variable. 6360 6392 (cond ((and variable … … 6363 6395 (not (enclosed-by-runtime-bindings-creating-block-p 6364 6396 (variable-block variable)))) 6365 ;; ###choose this compilation order to prevent6366 6397 ;; choose this compilation order to prevent 6398 ;; with-operand-accumulation 6367 6399 (compile-forms-and-maybe-emit-clear-values value-form 'stack nil) 6368 6400 (emit 'dup) 6369 6401 (aload (variable-binding-register variable)) 6370 6402 (emit 'swap) … … 6376 6408 (var-ref-p (third value-form)) 6377 6409 (eq (variable-name (var-ref-variable (third value-form))) 6378 6379 6380 6381 6382 6383 6384 6385 6386 6410 name)) 6411 (with-operand-accumulation 6412 ((emit-thread-operand) 6413 (emit-load-externalized-object-operand name) 6414 (compile-operand (second value-form) nil) 6415 (maybe-emit-clear-values (second value-form))) 6416 (emit-invokevirtual +lisp-thread+ "pushSpecial" 6417 (list +lisp-symbol+ +lisp-object+) 6418 +lisp-object+))) 6387 6419 (t 6388 6389 6390 6391 6392 6393 6394 6395 6420 (with-operand-accumulation 6421 ((emit-thread-operand) 6422 (emit-load-externalized-object-operand name) 6423 (compile-operand value-form nil) 6424 (maybe-emit-clear-values value-form)) 6425 (emit-invokevirtual +lisp-thread+ "setSpecialVariable" 6426 (list +lisp-symbol+ +lisp-object+) 6427 +lisp-object+)))) 6396 6428 (fix-boxing representation nil) 6397 6429 (emit-move-from-stack target representation)
Note: See TracChangeset
for help on using the changeset viewer.