commit c1f532881cb95602cd305a9987f2582eb62d31a4
parent 147d9a52aa9dbd440cb057a28eb4e266d6f326ba
Author: Andres Navarro <canavarro82@gmail.com>
Date: Fri, 8 Jul 2011 18:19:41 -0300
Added GC support for blobs.
Diffstat:
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/kgc.c b/src/kgc.c
@@ -320,6 +320,11 @@ static int32_t propagatemark (klisp_State *K) {
markvalue(K, e->irritants);
return sizeof(Error);
}
+ case K_TBLOB: {
+ Blob *b = cast(Blob *, o);
+ markvalue(K, b->mark);
+ return sizeof(String) + b->size * sizeof(uint8_t);
+ }
default:
fprintf(stderr, "Unknown GCObject type (in GC propagate): %d\n",
type);
@@ -450,6 +455,9 @@ static void freeobj (klisp_State *K, GCObject *o) {
case K_TERROR:
klispE_free(K, (Error *)o);
break;
+ case K_TBLOB:
+ klispM_freemem(K, o, sizeof(Blob)+o->blob.size);
+ break;
default:
/* shouldn't happen */
fprintf(stderr, "Unknown GCObject type (in GC free): %d\n",
diff --git a/src/kobject.h b/src/kobject.h
@@ -548,6 +548,7 @@ union GCObject {
Promise prom;
Port port;
Table table;
+ Blob blob;
};