From 40bcf2d5dc7d5f9b74ab10d0f12893f53bf2b72f Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Sun, 17 Jan 2016 00:09:01 -0500 Subject: [PATCH] Added comments --- runtime.c | 2 ++ srfi/18.sld | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/runtime.c b/runtime.c index 6b6c4f44..df5d476b 100644 --- a/runtime.c +++ b/runtime.c @@ -2866,6 +2866,8 @@ object Cyc_thread_sleep(void *data, object timeout) return boolean_t; } +// Copy given object to the heap, if it is from the stack. +// This function is intended to be called directly from application code object copy2heap(void *data, object obj) { char stack_pos; diff --git a/srfi/18.sld b/srfi/18.sld index 8fd37b75..8a5234a5 100644 --- a/srfi/18.sld +++ b/srfi/18.sld @@ -10,6 +10,9 @@ thread-yield! ; thread-terminate! ; For now, these are built-ins. No need for them here: make-mutex mutex-lock! mutex-unlock! + ;; TODO: consolidate built-ins, and convert them from primitives to FFI functions + ;; in this module. + ;; Non-standard functions: ->heap ) (begin @@ -46,6 +49,11 @@ (define (thread-yield!) (thread-sleep! 1)) ; (define (thread-terminate!) (Cyc-end-thread!)) ;; TODO: thread-join! + + ;; Take a single object and if it is on the stack, return a copy + ;; of it that is allocated on the heap. NOTE the original object + ;; will still live on the stack, and will eventually be moved + ;; itself to the heap if it is referenced during minor GC. (define-c ->heap "(void *data, int argc, closure _, object k, object obj)" " object heap_obj = copy2heap(data, obj);