def f(): buf = newbuffer(frame_t, 2) frame1 = buf.pointer() frame1[0].prev = NULL frame2 = buf.pointer() + 1 frame2[0].prev = frame1 roots = newbuffer(Pointer[void], 5) roots[0] = root1 roots[1] = NULL roots[2] = root2 roots[3] = root3 roots[4] = NULL frame1[0].trace_funcs = cast(roots.pointer(), Pointer[void]) frame2[0].trace_funcs = cast(roots.pointer() + 2, Pointer[void]) tracers = newbuffer(Pointer[void], 5) roots[0] = tracer1 roots[1] = NULL roots[2] = tracer2 roots[3] = tracer3 roots[4] = NULL frame1[0].trace_funcs = cast(tracers.pointer(), Pointer[void]) frame2[0].trace_funcs = cast(tracers.pointer() + 2, Pointer[void])
def __init__(self, initial_size=1024**2): self.heap = newbuffer(int8, initial_size) self.offset = self.bottom() self._top = self.bottom() + initial_size
def __init__(self, n): self.buf = newbuffer(types.int8, int(math.ceil(n / 8.0))) self.clear()