Ignore:
Timestamp:
08/01/10 18:05:04 (13 years ago)
Author:
ehuelsmann
Message:

Centralize exception-handler registration/accumulation;
while at it, remove a utility function from jvm-class-file.lisp
which should have been in compiler-pass2.lisp.

Location:
branches/generic-class-file/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r12841 r12844  
    198198  (u2 (if (< n 0) (1+ (logxor (- n) #xFFFF))
    199199          n)))
     200
     201
     202(defun add-exception-handler (start end handler type)
     203  (if (null *current-code-attribute*)
     204      (push (make-handler :from start
     205                          :to end
     206                          :code handler
     207                          :catch-type (if (null type)
     208                                          0
     209                                          (pool-class (!class-name type))))
     210            *handlers*)
     211      (code-add-exception-handler *current-code-attribute*
     212                                  start end handler type)))
    200213
    201214
     
    39723985    (label label-EXIT)
    39733986    (restore-dynamic-environment register)
    3974     (push (make-handler :from label-START
    3975       :to label-END
    3976       :code label-END
    3977       :catch-type 0) *handlers*)))
     3987    (add-exception-handler label-START label-END label-END nil)))
    39783988
    39793989(defun p2-m-v-b-node (block target)
     
    45074517        (emit 'athrow)
    45084518        ;; Finally...
    4509         (push (make-handler :from BEGIN-BLOCK
    4510                             :to END-BLOCK
    4511                             :code HANDLER
    4512                             :catch-type (pool-class (!class-name +lisp-go+)))
    4513               *handlers*)
    4514         (push (make-handler :from BEGIN-BLOCK
    4515                             :to END-BLOCK
    4516                             :code EXTENT-EXIT-HANDLER
    4517                             :catch-type 0)
    4518               *handlers*)))
     4519        (add-exception-handler BEGIN-BLOCK END-BLOCK HANDLER +lisp-go+)
     4520        (add-exception-handler BEGIN-BLOCK END-BLOCK EXTENT-EXIT-HANDLER nil)))
    45194521    (label EXIT)
    45204522    (when (tagbody-non-local-go-p block)
     
    46784680        (emit-move-from-stack target) ; Stack depth is 0.
    46794681        ;; Finally...
    4680         (push (make-handler :from BEGIN-BLOCK
    4681                             :to END-BLOCK
    4682                             :code HANDLER
    4683                             :catch-type (pool-class (!class-name +lisp-return+)))
    4684               *handlers*)
    4685         (push (make-handler :from BEGIN-BLOCK
    4686                             :to END-BLOCK
    4687                             :code EXTENT-EXIT-HANDLER
    4688                             :catch-type 0)
    4689               *handlers*)))
     4682        (add-exception-handler BEGIN-BLOCK END-BLOCK HANDLER +lisp-return+)
     4683        (add-exception-handler BEGIN-BLOCK END-BLOCK EXTENT-EXIT-HANDLER nil)))
    46904684    (label BLOCK-EXIT)
    46914685    (when (block-id-variable block)
     
    76237617    (aload object-register)
    76247618    (emit 'monitorexit)
    7625     (push (make-handler :from BEGIN-PROTECTED-RANGE
    7626                         :to END-PROTECTED-RANGE
    7627                         :code END-PROTECTED-RANGE
    7628                         :catch-type 0) *handlers*)))
     7619    (add-exception-handler BEGIN-PROTECTED-RANGE
     7620                           END-PROTECTED-RANGE
     7621                           END-PROTECTED-RANGE nil)))
    76297622
    76307623
     
    76777670      (emit-push-current-thread)
    76787671      (emit-invokevirtual +lisp-thread+ "popCatchTag" nil nil)
    7679       (let ((handler1 (make-handler :from BEGIN-PROTECTED-RANGE
    7680                                     :to END-PROTECTED-RANGE
    7681                                     :code THROW-HANDLER
    7682                                     :catch-type (pool-class (!class-name +lisp-throw+))))
    7683             (handler2 (make-handler :from BEGIN-PROTECTED-RANGE
    7684                                     :to END-PROTECTED-RANGE
    7685                                     :code DEFAULT-HANDLER
    7686                                     :catch-type 0)))
    7687         (push handler1 *handlers*)
    7688         (push handler2 *handlers*))))
     7672      (add-exception-handler BEGIN-PROTECTED-RANGE
     7673                             END-PROTECTED-RANGE
     7674                             THROW-HANDLER +lisp-throw+)
     7675      (add-exception-handler BEGIN-PROTECTED-RANGE
     7676                             END-PROTECTED-RANGE
     7677                             DEFAULT-HANDLER nil)))
    76897678  t)
    76907679
     
    77727761      (aload result-register)
    77737762      (emit-move-from-stack target)
    7774       (let ((handler (make-handler :from BEGIN-PROTECTED-RANGE
    7775                                    :to END-PROTECTED-RANGE
    7776                                    :code HANDLER
    7777                                    :catch-type 0)))
    7778         (push handler *handlers*)))))
     7763      (add-exception-handler BEGIN-PROTECTED-RANGE
     7764                             END-PROTECTED-RANGE HANDLER nil))))
    77797765
    77807766(defknown compile-form (t t t) t)
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/jvm-class-file.lisp

    r12842 r12844  
    865865        (code-exception-handlers code)))
    866866
    867 (defun add-exception-handler (start end handler type)
    868   (code-add-exception-handler *current-code-attribute* start end handler type))
    869 
    870867(defstruct exception
    871868  start-pc    ;; label target
Note: See TracChangeset for help on using the changeset viewer.