Cyclone Scheme  0.28.0

◆ alloc_bytevector

#define alloc_bytevector (   _data,
  _bv,
  _len 
)
Value:
if (_len >= MAX_STACK_OBJ) { \
int heap_grown; \
_bv = gc_alloc(((gc_thread_data *)data)->heap, \
sizeof(bytevector_type) + _len, \
boolean_f, /* OK to populate manually over here */ \
(gc_thread_data *)data, \
&heap_grown); \
((bytevector) _bv)->hdr.mark = ((gc_thread_data *)data)->gc_alloc_color; \
((bytevector) _bv)->hdr.grayed = 0; \
((bytevector) _bv)->hdr.immutable = 0; \
((bytevector) _bv)->tag = bytevector_tag; \
((bytevector) _bv)->len = _len; \
((bytevector) _bv)->data = (char *)(((char *)_bv) + sizeof(bytevector_type)); \
} else { \
_bv = alloca(sizeof(bytevector_type)); \
((bytevector) _bv)->hdr.mark = gc_color_red; \
((bytevector) _bv)->hdr.grayed = 0; \
((bytevector) _bv)->hdr.immutable = 0; \
((bytevector) _bv)->tag = bytevector_tag; \
((bytevector) _bv)->len = _len; \
((bytevector) _bv)->data = alloca(sizeof(char) * _len); \
}

Allocate a new bytevector, either on the stack or heap depending upon size

gc_alloc
void * gc_alloc(gc_heap_root *h, size_t size, char *obj, gc_thread_data *thd, int *heap_grown)
Allocate memory on the heap for an object.
Definition: gc.c:1360
bytevector
bytevector_type * bytevector
Definition: types.h:1215
gc_color_red
#define gc_color_red
Definition: types.h:297
gc_thread_data_t
Definition: types.h:322
bytevector_type
Bytevector type.
Definition: types.h:1209
MAX_STACK_OBJ
#define MAX_STACK_OBJ
Definition: types.h:513
boolean_f
const object boolean_f
Definition: runtime.c:397
bytevector_tag
@ bytevector_tag
Definition: types.h:54