* Added procedure-annotation primitive that returns the annotation

object stored in the closure's code.
This commit is contained in:
Abdulaziz Ghuloum 2007-09-04 20:18:11 -04:00
parent ad118623ec
commit 2c2b3eb1f1
8 changed files with 12 additions and 4 deletions

Binary file not shown.

View File

@ -281,6 +281,7 @@ static ikp do_read(ikpcb* pcb, fasl_port* p){
ref(code, 0) = code_tag; ref(code, 0) = code_tag;
ref(code, disp_code_code_size) = fix(code_size); ref(code, disp_code_code_size) = fix(code_size);
ref(code, disp_code_freevars) = freevars; ref(code, disp_code_freevars) = freevars;
ref(code, disp_code_annotation) = false_object;
fasl_read_buf(p, code+disp_code_data, code_size); fasl_read_buf(p, code+disp_code_data, code_size);
if(put_mark_index){ if(put_mark_index){
p->marks[put_mark_index] = code+vector_tag; p->marks[put_mark_index] = code+vector_tag;

Binary file not shown.

View File

@ -3,13 +3,14 @@
(export (export
make-code code-reloc-vector code-freevars make-code code-reloc-vector code-freevars
code-size code-ref code-set! set-code-reloc-vector! code-size code-ref code-set! set-code-reloc-vector!
set-code-annotation! set-code-annotation! procedure-annotation
code->thunk) code->thunk)
(import (import
(ikarus system $fx) (ikarus system $fx)
(ikarus system $codes) (ikarus system $codes)
(except (ikarus) make-code code-reloc-vector code-freevars (except (ikarus) make-code code-reloc-vector code-freevars
code-size code-ref code-set! set-code-reloc-vector! code-size code-ref code-set! set-code-reloc-vector!
procedure-annotation
set-code-annotation!)) set-code-annotation!))
(define make-code (define make-code
@ -80,5 +81,10 @@
(error 'code->thunk "~s has free variables" x)) (error 'code->thunk "~s has free variables" x))
($code->closure x))) ($code->closure x)))
(define (procedure-annotation x)
(if (procedure? x)
($code-annotation ($closure-code x))
(error 'procedure-annotation "~s is not a procedure" x)))
) )

View File

@ -41,7 +41,7 @@
(library (ikarus fasl read) (library (ikarus fasl read)
(export fasl-read) (export fasl-read)
(import (ikarus) (import (ikarus)
(ikarus code-objects) (except (ikarus code-objects) procedure-annotation)
(ikarus system $codes) (ikarus system $codes)
(ikarus system $records)) (ikarus system $records))

View File

@ -12,7 +12,7 @@
(ikarus system $strings) (ikarus system $strings)
(ikarus system $flonums) (ikarus system $flonums)
(ikarus system $bignums) (ikarus system $bignums)
(ikarus code-objects) (except (ikarus code-objects) procedure-annotation)
(except (ikarus) fasl-write)) (except (ikarus) fasl-write))
(define write-fixnum (define write-fixnum

View File

@ -4,7 +4,7 @@
(export assemble-sources code-entry-adjustment) (export assemble-sources code-entry-adjustment)
(import (import
(ikarus) (ikarus)
(ikarus code-objects) (except (ikarus code-objects) procedure-annotation)
(ikarus system $pairs)) (ikarus system $pairs))
(define fold (define fold

View File

@ -779,6 +779,7 @@
[$code-ref $codes] [$code-ref $codes]
[$code-set! $codes] [$code-set! $codes]
[$set-code-annotation! $codes] [$set-code-annotation! $codes]
[procedure-annotation i]
[$make-tcbucket $tcbuckets] [$make-tcbucket $tcbuckets]
[$tcbucket-key $tcbuckets] [$tcbucket-key $tcbuckets]