Skip to content

Commit 1e0c22c

Browse files
committed
---
yaml --- r: 3060 b: refs/heads/master c: 355c417 h: refs/heads/master v: v3
1 parent da430d3 commit 1e0c22c

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: c3bf7d07e98109a1143567a3c658cadf387febeb
2+
refs/heads/master: 355c417267371293f48333388fed7eb56c3a8b1f

trunk/src/rt/rust_upcall.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,12 +585,23 @@ upcall_ivec_resize(rust_task *task,
585585
task->fail(4);
586586
}
587587

588+
/**
589+
* Spills an interior vector to the heap.
590+
*/
588591
extern "C" CDECL void
589592
upcall_ivec_spill(rust_task *task,
590593
rust_ivec *v,
591594
size_t newsz) {
592-
// TODO
593-
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;
594605
}
595606

596607
//

0 commit comments

Comments
 (0)