Changeset 14807 for trunk/source/level-1


Ignore:
Timestamp:
May 23, 2011, 12:25:45 PM (8 years ago)
Author:
gb
Message:

Define and export the functions ALLOW-HEAP-ALLOCATION and
HEAP-ALLOCATION-ALLOWED-P and the condition type ALLOCATION-DISABLED.

(ALLOW-HEAP-ALLOCATION arg) : when ARG is NIL, causes any subsequent
attempts to heap-allocate lisp memory to signal (as if by CERROR)
an ALLOCATION-DISABLED condition. (Allocaton is enabled globally at
the point where the error is signaled.) Continuing from the CERROR
restarts the allocation attempt.

This is intended to help verify that code that's not expected to
cons doesn't do so.

(This is only implemented on the ARM at the moment, but the intent
is that it be supported on all platforms.)

Note that calling (ALLOW-HEAP-ALLOCATION NIL) in the REPL CERRORs
immediately, since the REPL will cons to create the new value of CL:/.

Location:
trunk/source/level-1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/arm-error-signal.lisp

    r14119 r14807  
    285285               :format-arguments (list (if (eql arg arm::vsp) "value" "control")))
    286286              nil frame-ptr))
     287            ((eql error-number arch::error-allocation-disabled)
     288             (restart-case (%error 'allocation-disabled nil frame-ptr)
     289               (continue ()
     290                         :report (lambda (stream)
     291                                   (format stream "retry the heap allocation.")))))
    287292            (t
    288293             (error "%errdisp callback: error-number = ~d, arg = #x~x, fnreg = ~d, rpc = ~d"
  • trunk/source/level-1/l1-error-system.lisp

    r13878 r14807  
    143143    (when instruction
    144144      (format s "~&Faulting instruction: ~s" instruction))))
     145
     146(define-condition allocation-disabled (storage-condition)
     147  ()
     148  (:report (lambda (c s) (declare (ignore c)) (format s "Attempt to heap-allocate a lisp object when heap allocation is disabled."))))
     149 
    145150
    146151(define-condition type-error (error)
Note: See TracChangeset for help on using the changeset viewer.