[armedbear-cvs] r11814 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Sat May 2 20:14:17 UTC 2009


Author: ehuelsmann
Date: Sat May  2 16:14:16 2009
New Revision: 11814

Log:
Resolve part 1 of ticket #21: Don't use JSR and RET JVM instructions.

Note: This solution inlines the cleanup twice. Since our own build
  only increases by a few bytes, we'll go with this solution until
  there's a real issue for someone.

Modified:
   trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

Modified: trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp	(original)
+++ trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp	Sat May  2 16:14:16 2009
@@ -7864,12 +7864,10 @@
            (exception-register (allocate-register))
            (result-register (allocate-register))
            (values-register (allocate-register))
-           (return-address-register (allocate-register))
            (BEGIN-PROTECTED-RANGE (gensym))
            (END-PROTECTED-RANGE (gensym))
            (HANDLER (gensym))
-           (EXIT (gensym))
-           (CLEANUP (gensym)))
+           (EXIT (gensym)))
       ;; Make sure there are no leftover multiple return values from previous calls.
       (emit-clear-values)
 
@@ -7880,21 +7878,17 @@
         (emit 'getfield +lisp-thread-class+ "_values" +lisp-object-array+)
         (astore values-register)
         (label END-PROTECTED-RANGE))
-      (emit 'jsr CLEANUP)
+      (dolist (subform cleanup-forms)
+        (compile-form subform nil nil))
       (emit 'goto EXIT) ; Jump over handler.
       (label HANDLER) ; Start of exception handler.
       ;; The Throwable object is on the runtime stack. Stack depth is 1.
       (astore exception-register)
-      (emit 'jsr CLEANUP) ; Call cleanup forms.
+      (dolist (subform cleanup-forms)
+        (compile-form subform nil nil))
       (emit-clear-values)
       (aload exception-register)
       (emit 'athrow) ; Re-throw exception.
-      (label CLEANUP) ; Cleanup forms.
-      ;; Return address is on stack here.
-      (astore return-address-register)
-      (dolist (subform cleanup-forms)
-        (compile-form subform nil nil))
-      (emit 'ret return-address-register)
       (label EXIT)
       ;; Restore multiple values returned by protected form.
       (emit-push-current-thread)




More information about the armedbear-cvs mailing list