Changeset 12314


Ignore:
Timestamp:
12/30/09 22:04:55 (11 years ago)
Author:
ehuelsmann
Message:

Upon OutOfMemoryError? or StackOverflowError?, unwind the stack

to the first enclosing HANDLER-BIND, allowing it to bind a
handler to STORAGE-CONDITION.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Java.java

    r12304 r12314  
    931931        }
    932932    };
    933    
     933
     934
     935    private static final Primitive JRUN_EXCEPTION_PROTECTED =
     936        new Primitive("jrun-exception-protected", PACKAGE_JAVA, true,
     937                      "closure") {
     938
     939      @Override
     940      public LispObject execute(LispObject closure) {
     941          Function fun = checkFunction(closure);
     942
     943          try {
     944              return LispThread.currentThread().execute(closure);
     945          }
     946          catch (OutOfMemoryError oom) {
     947              return error(new StorageCondition("Out of memory."));
     948          }
     949          catch (StackOverflowError oos) {
     950              return error(new StorageCondition("Stack overflow."));
     951          }
     952      }
     953    };
     954
    934955    private static PropertyDescriptor getPropertyDescriptor(Object obj, LispObject propertyName) throws IntrospectionException {
    935956        String prop = ((AbstractString) propertyName).getStringValue();
  • trunk/abcl/src/org/armedbear/lisp/signal.lisp

    r12105 r12314  
    106106                                bindings))
    107107                *handler-clusters*)))
    108      (progn
    109        ,@forms)))
     108     (java:jrun-exception-protected
     109      (lambda ()
     110        (progn
     111          ,@forms)))))
    110112
    111113(defmacro handler-case (form &rest cases)
Note: See TracChangeset for help on using the changeset viewer.