Changeset 12620


Ignore:
Timestamp:
04/16/10 13:41:21 (14 years ago)
Author:
Mark Evenson
Message:

Use interpreted form in a FASL if compliation fails.

INTERNAL-COMPILER-ERROR now signals that the form being compiled
should be written to the init FASL to be interpreted rather than being
the object of a SYSTEm:PROXY-PRELOADED-FUNCTION. A further
optimization of this strategy would be to actually not include the
failed compilation unit in the packed FASL.

This patches behavior for stack inconsistencies such as present in
ticket #89.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
1 added
6 edited

Legend:

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

    r12583 r12620  
    495495  public static final StandardClass COMPILER_ERROR =
    496496    addStandardClass(Symbol.COMPILER_ERROR, list(CONDITION));
     497   
     498  public static final StandardClass INTERNAL_COMPILER_ERROR =
     499    addStandardClass(Symbol.INTERNAL_COMPILER_ERROR, list(CONDITION));
    497500
    498501  public static final StandardClass COMPILER_UNSUPPORTED_FEATURE_ERROR =
     
    554557    COMPILER_ERROR.setCPL(COMPILER_ERROR, CONDITION, STANDARD_OBJECT,
    555558                          BuiltInClass.CLASS_T);
     559    INTERNAL_COMPILER_ERROR.setCPL(INTERNAL_COMPILER_ERROR, CONDITION, STANDARD_OBJECT,
     560                                   BuiltInClass.CLASS_T);
    556561    COMPILER_UNSUPPORTED_FEATURE_ERROR.setCPL(COMPILER_UNSUPPORTED_FEATURE_ERROR,
    557562                                              CONDITION, STANDARD_OBJECT,
     
    676681    CELL_ERROR.finalizeClass();
    677682    COMPILER_ERROR.finalizeClass();
     683    INTERNAL_COMPILER_ERROR.finalizeClass();
    678684    COMPILER_UNSUPPORTED_FEATURE_ERROR.finalizeClass();
    679685    CONDITION.finalizeClass();
  • trunk/abcl/src/org/armedbear/lisp/Symbol.java

    r12617 r12620  
    28932893  public static final Symbol COMPILER_ERROR =
    28942894    PACKAGE_EXT.addExternalSymbol("COMPILER-ERROR");
     2895  public static final Symbol INTERNAL_COMPILER_ERROR =
     2896    PACKAGE_EXT.addExternalSymbol("INTERNAL-COMPILER-ERROR");
    28952897  public static final Symbol COMPILER_UNSUPPORTED_FEATURE_ERROR =
    28962898    PACKAGE_EXT.addExternalSymbol("COMPILER-UNSUPPORTED-FEATURE-ERROR");
  • trunk/abcl/src/org/armedbear/lisp/compile-file.lisp

    r12619 r12620  
    146146                                 ,@decls (block ,block-name ,@body)))
    147147                        (classfile (next-classfile-name))
     148                        (compilation-failure-p nil)
    148149                        (result (with-open-file
    149150            (f classfile
     
    151152               :element-type '(unsigned-byte 8)
    152153               :if-exists :supersede)
    153           (report-error
    154            (jvm:compile-defun name expr nil
    155                   classfile f nil))))
    156                         (compiled-function (verify-load classfile)))
     154                                  (handler-bind
     155                                      ((internal-compiler-error
     156                                        #'(lambda (e)
     157                                            (setf compilation-failure-p e)
     158                                            (continue))))
     159                                    (report-error
     160                                     (jvm:compile-defun name expr nil
     161                                                        classfile f nil)))))
     162                        (compiled-function (and (not compilation-failure-p)
     163                                                (verify-load classfile))))
    157164       (declare (ignore result))
    158165                   (cond
    159                      (compiled-function
     166                     ((and (not compilation-failure-p)
     167                           compiled-function)
    160168                      (setf form
    161169                            `(fset ',name
     
    170178                      (format *error-output*
    171179                              "; Unable to compile function ~A~%" name)
     180                      (when compilation-failure-p
     181                        (format *error-output*
     182                                "; ~A~%" compilation-failure-p))
    172183                      (let ((precompiled-function
    173184                             (precompiler:precompile-form expr nil
     
    514525                  *forms-for-output*)
    515526              (jvm::with-saved-compiler-policy
    516                   (jvm::with-file-compilation
    517                     (handler-bind ((style-warning #'(lambda (c)
    518                                                       (setf warnings-p t)
    519                                                       ;; let outer handlers
    520                                                       ;; do their thing
    521                                                       (signal c)
    522                                                       ;; prevent the next
    523                                                       ;; handler from running:
    524                                                       ;; we're a WARNING subclass
    525                                                       (continue)))
    526                                    ((or warning
    527                                         compiler-error) #'(lambda (c)
     527                (jvm::with-file-compilation
     528                    (handler-bind ((style-warning
     529                                    #'(lambda (c)
     530                                        (setf warnings-p t)
     531                                        ;; let outer handlers do their thing
     532                                        (signal c)
     533                                        ;; prevent the next handler
     534                                        ;; from running: we're a
     535                                        ;; WARNING subclass
     536                                        (continue)))
     537                                   ((or warning
     538                                        compiler-error)
     539                                    #'(lambda (c)
    528540                                        (declare (ignore c))
    529541                                        (setf warnings-p t
  • trunk/abcl/src/org/armedbear/lisp/compiler-error.lisp

    r11391 r12620  
    3636          compiler-warn
    3737          compiler-error
     38          internal-compiler-error
    3839          compiler-unsupported))
    3940
     
    5556         :format-arguments format-arguments))
    5657
     58(defun internal-compiler-error (format-control &rest format-arguments)
     59  (signal 'internal-compiler-error
     60         :format-control format-control
     61         :format-arguments format-arguments))
     62
    5763(defun compiler-unsupported (format-control &rest format-arguments)
    5864  (error 'compiler-unsupported-feature-error
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r12581 r12620  
    13431343        (unless (= (the fixnum instruction-depth) (the fixnum (+ depth instruction-stack)))
    13441344          (format t "~&Stack inconsistency at index ~D: found ~S, expected ~S.~%"
    1345                    i instruction-depth (+ depth instruction-stack)))
     1345                   i instruction-depth (+ depth instruction-stack))
     1346          (internal-compiler-error "Stack inconsistency detected in ~A."
     1347                                   (compiland-name *current-compiland*)))
    13461348        (return-from walk-code))
    13471349      (let ((opcode (instruction-opcode instruction)))
  • trunk/abcl/src/org/armedbear/lisp/make_condition.java

    r12481 r12620  
    122122        if (symbol == Symbol.COMPILER_ERROR)
    123123            return new CompilerError(initArgs);
     124        if (symbol == Symbol.INTERNAL_COMPILER_ERROR)
     125            return new InternalCompilerError(initArgs);
    124126        if (symbol == Symbol.COMPILER_UNSUPPORTED_FEATURE_ERROR)
    125127            return new CompilerUnsupportedFeatureError(initArgs);
Note: See TracChangeset for help on using the changeset viewer.