2007-10-25 16:27:34 -04:00
|
|
|
;;; Ikarus Scheme -- A compiler for R6RS Scheme.
|
2008-01-29 00:34:34 -05:00
|
|
|
;;; Copyright (C) 2006,2007,2008 Abdulaziz Ghuloum
|
2007-10-25 16:27:34 -04:00
|
|
|
;;;
|
|
|
|
;;; This program is free software: you can redistribute it and/or modify
|
|
|
|
;;; it under the terms of the GNU General Public License version 3 as
|
|
|
|
;;; published by the Free Software Foundation.
|
|
|
|
;;;
|
|
|
|
;;; This program is distributed in the hope that it will be useful, but
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
;;; General Public License for more details.
|
|
|
|
;;;
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2006-11-23 19:42:39 -05:00
|
|
|
|
2007-04-30 00:50:10 -04:00
|
|
|
(library (ikarus collect)
|
2007-05-05 02:07:50 -04:00
|
|
|
(export do-overflow do-overflow-words do-vararg-overflow collect
|
2007-08-30 22:09:13 -04:00
|
|
|
do-stack-overflow collect-key)
|
2007-05-06 18:00:49 -04:00
|
|
|
(import
|
2007-08-30 22:09:13 -04:00
|
|
|
(except (ikarus) collect collect-key)
|
|
|
|
(ikarus system $fx)
|
|
|
|
(ikarus system $arg-list))
|
2006-11-23 19:42:39 -05:00
|
|
|
|
2007-04-30 00:50:10 -04:00
|
|
|
(define do-overflow
|
2006-11-23 19:42:39 -05:00
|
|
|
(lambda (n)
|
|
|
|
(foreign-call "ik_collect" n)
|
|
|
|
(void)))
|
|
|
|
|
2007-05-05 02:07:50 -04:00
|
|
|
(define do-overflow-words
|
2006-11-23 19:42:39 -05:00
|
|
|
(lambda (n)
|
|
|
|
(foreign-call "ik_collect" ($fxsll n 2))
|
|
|
|
(void)))
|
|
|
|
|
2007-05-05 02:07:50 -04:00
|
|
|
(define do-vararg-overflow
|
2006-11-23 19:42:39 -05:00
|
|
|
(lambda (n)
|
|
|
|
(foreign-call "ik_collect_vararg" n)
|
|
|
|
(void)))
|
|
|
|
|
2007-05-05 02:07:50 -04:00
|
|
|
(define collect
|
2006-11-23 19:42:39 -05:00
|
|
|
(lambda ()
|
|
|
|
(do-overflow 4096)))
|
|
|
|
|
2007-05-05 02:07:50 -04:00
|
|
|
(define do-stack-overflow
|
2006-11-23 19:42:39 -05:00
|
|
|
(lambda ()
|
|
|
|
(foreign-call "ik_stack_overflow")))
|
|
|
|
|
2007-05-05 02:07:50 -04:00
|
|
|
(define dump-metatable
|
2006-11-23 19:42:39 -05:00
|
|
|
(lambda ()
|
|
|
|
(foreign-call "ik_dump_metatable")))
|
|
|
|
|
2007-05-05 02:07:50 -04:00
|
|
|
(define dump-dirty-vector
|
2006-11-23 19:42:39 -05:00
|
|
|
(lambda ()
|
|
|
|
(foreign-call "ik_dump_dirty_vector")))
|
2007-08-30 22:09:13 -04:00
|
|
|
|
|
|
|
(define (collect-key)
|
|
|
|
(or ($collect-key)
|
|
|
|
(begin
|
2007-09-01 16:09:56 -04:00
|
|
|
($collect-key (gensym))
|
2007-08-30 22:09:13 -04:00
|
|
|
(collect-key))))
|
|
|
|
|
2007-04-30 00:50:10 -04:00
|
|
|
)
|