diff --git a/gc.c b/gc.c index c1b402c6..ea6148bc 100644 --- a/gc.c +++ b/gc.c @@ -278,6 +278,16 @@ char *gc_copy_obj(object dest, char *obj, gc_thread_data *thd) } return (char *)hp; } + case bytevector_tag: { + int i; + bytevector_type *hp = dest; + mark(hp) = thd->gc_alloc_color; + type_of(hp) = bytevector_tag; + hp->len = ((bytevector) obj)->len; + hp->data = (((char *)hp) + sizeof(bytevector_type)); + memcpy(hp->data, ((bytevector) obj)->data, hp->len); + return (char *)hp; + } case string_tag: { char *s; string_type *hp = dest; @@ -449,6 +459,9 @@ size_t gc_allocated_bytes(object obj, gc_free_list *q, gc_free_list *r) if (t == vector_tag){ return gc_heap_align(sizeof(vector_type) + sizeof(object) * ((vector_type *)obj)->num_elt); } + if (t == bytevector_tag) { + return gc_heap_align(sizeof(bytevector_type) + sizeof(char) * ((bytevector)obj)->len); + } if (t == string_tag){ return gc_heap_align(sizeof(string_type) + string_len(obj) + 1); } diff --git a/runtime.c b/runtime.c index e65d21a2..4843d312 100644 --- a/runtime.c +++ b/runtime.c @@ -2366,6 +2366,12 @@ char *gc_move(char *obj, gc_thread_data *thd, int *alloci, int *heap_grown) { obj, thd, heap_grown); return gc_fixup_moved_obj(thd, alloci, obj, hp); } + case bytevector_tag: { + bytevector_type *hp = gc_alloc(Cyc_heap, + sizeof(bytevector_type) + sizeof(char) * (((bytevector) obj)->len), + obj, thd, heap_grown); + return gc_fixup_moved_obj(thd, alloci, obj, hp); + } case string_tag: { string_type *hp = gc_alloc(Cyc_heap, sizeof(string_type) + ((string_len(obj) + 1)), @@ -2510,6 +2516,7 @@ int gc_minor(void *data, object low_limit, object high_limit, closure cont, obje // No child objects to move case closure0_tag: case macro_tag: + case bytevector_tag: case string_tag: case integer_tag: case double_tag: