We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c3bf7d0 commit 355c417Copy full SHA for 355c417
src/rt/rust_upcall.cpp
@@ -585,12 +585,23 @@ upcall_ivec_resize(rust_task *task,
585
task->fail(4);
586
}
587
588
+/**
589
+ * Spills an interior vector to the heap.
590
+ */
591
extern "C" CDECL void
592
upcall_ivec_spill(rust_task *task,
593
rust_ivec *v,
594
size_t newsz) {
- // TODO
- task->fail(4);
595
+ size_t new_alloc = next_power_of_two(newsz);
596
+
597
+ rust_ivec_heap *heap_part = (rust_ivec_heap *)
598
+ task->malloc(new_alloc + sizeof(size_t));
599
+ heap_part->fill = newsz;
600
+ memcpy(&heap_part->data, v->payload.data, v->fill);
601
602
+ v->fill = 0;
603
+ v->alloc = new_alloc;
604
+ v->payload.ptr = heap_part;
605
606
607
//
0 commit comments