Skip to content

Commit d764105

Browse files
committed
---
yaml --- r: 14492 b: refs/heads/try c: 7d1e36a h: refs/heads/master v: v3
1 parent 7e8b977 commit d764105

File tree

3 files changed

+1
-120
lines changed

3 files changed

+1
-120
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 4d03e4b711c8aadb829ce8b26237c917ee04bbb7
5+
refs/heads/try: 7d1e36a31582f45b532823ff37bca5cf2019792d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust_internal.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -152,34 +152,6 @@ template <typename T> struct region_owned {
152152

153153
struct rust_cond { };
154154

155-
// Helper class used regularly elsewhere.
156-
157-
template <typename T> class ptr_vec : public task_owned<ptr_vec<T> > {
158-
static const size_t INIT_SIZE = 8;
159-
rust_task *task;
160-
size_t alloc;
161-
size_t fill;
162-
T **data;
163-
public:
164-
ptr_vec(rust_task *task);
165-
~ptr_vec();
166-
167-
size_t length() {
168-
return fill;
169-
}
170-
171-
bool is_empty() {
172-
return fill == 0;
173-
}
174-
175-
T *& operator[](size_t offset);
176-
void push(T *p);
177-
T *pop();
178-
T *peek();
179-
void trim(size_t fill);
180-
void swap_delete(T* p);
181-
};
182-
183155
#include "memory_region.h"
184156
#include "rust_srv.h"
185157
#include "rust_log.h"

branches/try/src/rt/rust_util.h

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -4,97 +4,6 @@
44
#include "rust_task.h"
55
#include <limits.h>
66

7-
// Utility type: pointer-vector.
8-
9-
template <typename T>
10-
ptr_vec<T>::ptr_vec(rust_task *task) :
11-
task(task),
12-
alloc(INIT_SIZE),
13-
fill(0),
14-
data(new (task, "ptr_vec<T>") T*[alloc])
15-
{
16-
I(task->thread, data);
17-
DLOG(task->thread, mem, "new ptr_vec(data=0x%" PRIxPTR ") -> 0x%" PRIxPTR,
18-
(uintptr_t)data, (uintptr_t)this);
19-
}
20-
21-
template <typename T>
22-
ptr_vec<T>::~ptr_vec()
23-
{
24-
I(task->thread, data);
25-
DLOG(task->thread, mem, "~ptr_vec 0x%" PRIxPTR ", data=0x%" PRIxPTR,
26-
(uintptr_t)this, (uintptr_t)data);
27-
I(task->thread, fill == 0);
28-
task->free(data);
29-
}
30-
31-
template <typename T> T *&
32-
ptr_vec<T>::operator[](size_t offset) {
33-
I(task->thread, data[offset]->idx == offset);
34-
return data[offset];
35-
}
36-
37-
template <typename T>
38-
void
39-
ptr_vec<T>::push(T *p)
40-
{
41-
I(task->thread, data);
42-
I(task->thread, fill <= alloc);
43-
if (fill == alloc) {
44-
alloc *= 2;
45-
data = (T **)task->realloc(data, alloc * sizeof(T*));
46-
I(task->thread, data);
47-
}
48-
I(task->thread, fill < alloc);
49-
p->idx = fill;
50-
data[fill++] = p;
51-
}
52-
53-
template <typename T>
54-
T *
55-
ptr_vec<T>::pop()
56-
{
57-
return data[--fill];
58-
}
59-
60-
template <typename T>
61-
T *
62-
ptr_vec<T>::peek()
63-
{
64-
return data[fill - 1];
65-
}
66-
67-
template <typename T>
68-
void
69-
ptr_vec<T>::trim(size_t sz)
70-
{
71-
I(task->thread, data);
72-
if (sz <= (alloc / 4) &&
73-
(alloc / 2) >= INIT_SIZE) {
74-
alloc /= 2;
75-
I(task->thread, alloc >= fill);
76-
data = (T **)task->realloc(data, alloc * sizeof(T*));
77-
I(task->thread, data);
78-
}
79-
}
80-
81-
template <typename T>
82-
void
83-
ptr_vec<T>::swap_delete(T *item)
84-
{
85-
/* Swap the endpoint into i and decr fill. */
86-
I(task->thread, data);
87-
I(task->thread, fill > 0);
88-
I(task->thread, item->idx < fill);
89-
fill--;
90-
if (fill > 0) {
91-
T *subst = data[fill];
92-
size_t idx = item->idx;
93-
data[idx] = subst;
94-
subst->idx = idx;
95-
}
96-
}
97-
987
// Inline fn used regularly elsewhere.
998

1009
static inline size_t

0 commit comments

Comments
 (0)