- Timestamp:
- 05/15/09 09:20:17 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/closure-fixes/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r11864 r11865 2992 2992 (emit-move-from-stack target)) 2993 2993 2994 (defun save-variables (variables)2995 (let ((saved-vars '()))2996 (dolist (variable variables)2997 (when (variable-closure-index variable)2998 (let ((register (allocate-register)))2999 (aload (compiland-closure-register *current-compiland*))3000 (emit-push-constant-int (variable-closure-index variable))3001 (emit 'aaload)3002 (astore register)3003 (push (cons variable register) saved-vars))))3004 saved-vars))3005 3006 (defun restore-variables (saved-vars)3007 (dolist (saved-var saved-vars)3008 (let ((variable (car saved-var))3009 (register (cdr saved-var)))3010 (aload (compiland-closure-register *current-compiland*))3011 (emit-push-constant-int (variable-closure-index variable))3012 (aload register)3013 (emit 'aastore))))3014 2994 3015 2995 (defun duplicate-closure-array (compiland) … … 3026 3006 (emit-invokestatic "java/lang/System" "arraycopy" 3027 3007 (list "Ljava/lang/Object;" "I" 3028 "Ljava/lang/Object;" "I" "I") "V")3008 "Ljava/lang/Object;" "I" "I") nil) 3029 3009 (aload register))) ;; reload dest value 3030 3010 … … 3041 3021 (args (cdr form)) 3042 3022 (local-function (find-local-function op)) 3043 (*register* *register*) 3044 (saved-vars '()) 3045 (label-START (gensym)) 3046 (label-END (gensym)) 3047 (label-EXIT (gensym))) 3023 (*register* *register*)) 3048 3024 (cond ((local-function-variable local-function) 3049 3025 ;; LABELS 3050 3026 (dformat t "compile-local-function-call LABELS case variable = ~S~%" 3051 3027 (variable-name (local-function-variable local-function))) 3052 (unless (null (compiland-parent compiland))3053 (setf saved-vars3054 (save-variables (intersection3055 (compiland-arg-vars (local-function-compiland local-function))3056 *visible-variables*))))3057 ;; (emit 'var-ref (local-function-variable local-function) 'stack)3058 (when saved-vars3059 (label label-START))3060 3028 (compile-var-ref (make-var-ref (local-function-variable local-function)) 'stack nil)) 3061 3029 (t … … 3067 3035 (when *closure-variables* 3068 3036 (emit 'checkcast +lisp-ctf-class+) 3069 ( aload (compiland-closure-register compiland))3037 (duplicate-closure-array compiland) 3070 3038 (emit-invokestatic +lisp-class+ "makeCompiledClosure" 3071 3039 (list +lisp-object+ +closure-binding-array+) … … 3074 3042 (emit-call-execute (length args)) 3075 3043 (fix-boxing representation nil) 3076 (emit-move-from-stack target representation) 3077 (when saved-vars 3078 (emit 'goto label-EXIT) 3079 (label label-END) 3080 (restore-variables saved-vars) 3081 (emit 'athrow) 3082 (label label-EXIT) 3083 (restore-variables saved-vars) 3084 (push (make-handler :from label-START 3085 :to label-END 3086 :code label-END 3087 :catch-type 0) *handlers*))) 3044 (emit-move-from-stack target representation)) 3088 3045 t) 3089 3046 … … 4899 4856 (compiland-closure-register parent)) 4900 4857 (emit 'checkcast +lisp-ctf-class+) 4901 ( aload (compiland-closure-register parent))4858 (duplicate-closure-array parent) 4902 4859 (emit-invokestatic +lisp-class+ "makeCompiledClosure" 4903 4860 (list +lisp-object+ +closure-binding-array+) … … 5047 5004 (cond ((null *closure-variables*)) ; Nothing to do. 5048 5005 ((compiland-closure-register *current-compiland*) 5049 ( aload (compiland-closure-register *current-compiland*))5006 (duplicate-closure-array *current-compiland*) 5050 5007 (emit-invokestatic +lisp-class+ "makeCompiledClosure" 5051 5008 (list +lisp-object+ +closure-binding-array+) … … 5079 5036 (when (compiland-closure-register *current-compiland*) 5080 5037 (emit 'checkcast +lisp-ctf-class+) 5081 ( aload (compiland-closure-register *current-compiland*))5038 (duplicate-closure-array *current-compiland*) 5082 5039 (emit-invokestatic +lisp-class+ "makeCompiledClosure" 5083 5040 (list +lisp-object+ +closure-binding-array+)
Note: See TracChangeset
for help on using the changeset viewer.