Skip to content

Commit a307586

Browse files
committed
---
yaml --- r: 4807 b: refs/heads/master c: 0467fa6 h: refs/heads/master i: 4805: 85791cf 4803: 5681f56 4799: f747cd9 v: v3
1 parent 2b122b9 commit a307586

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
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: 1739200b02d0714c6caaf47d7a09cab037a40682
2+
refs/heads/master: 0467fa6a009e620a1a7486938f5ffd25730d4df5

trunk/src/rt/intrinsics/intrinsics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ upcall_fail(rust_task *task, char const *expr, char const *file, size_t line);
1010

1111
extern "C" void
1212
rust_intrinsic_vec_len(rust_task *task, size_t *retptr, type_desc *ty,
13-
rust_vec *v)
13+
rust_evec *v)
1414
{
1515
*retptr = v->fill / ty->size;
1616
}

trunk/src/rt/rust_builtin.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,17 @@ unsupervise(rust_task *task) {
127127
}
128128

129129
/* Helper for str_alloc and str_from_vec. Returns NULL as failure. */
130-
static rust_vec*
130+
static rust_evec*
131131
vec_alloc_with_data(rust_task *task,
132132
size_t n_elts,
133133
size_t fill,
134134
size_t elt_size,
135135
void *d)
136136
{
137-
size_t alloc = next_power_of_two(sizeof(rust_vec) + (n_elts * elt_size));
138-
void *mem = task->malloc(alloc, "rust_vec (with data)");
137+
size_t alloc = next_power_of_two(sizeof(rust_evec) + (n_elts * elt_size));
138+
void *mem = task->malloc(alloc, "rust_evec (with data)");
139139
if (!mem) return NULL;
140-
return new (mem) rust_vec(alloc, fill * elt_size, (uint8_t*)d);
140+
return new (mem) rust_evec(alloc, fill * elt_size, (uint8_t*)d);
141141
}
142142

143143
extern "C" CDECL rust_str*
@@ -158,7 +158,7 @@ extern "C" CDECL rust_str*
158158
str_push_byte(rust_task* task, rust_str* v, size_t byte)
159159
{
160160
size_t fill = v->fill;
161-
size_t alloc = next_power_of_two(sizeof(rust_vec) + fill + 1);
161+
size_t alloc = next_power_of_two(sizeof(rust_evec) + fill + 1);
162162
if (v->ref_count > 1 || v->alloc < alloc) {
163163
v = vec_alloc_with_data(task, fill + 1, fill, 1, (void*)&v->data[0]);
164164
if (!v) {

trunk/src/rt/rust_shape.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ data<T,U>::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id) {
968968
template<typename T,typename U>
969969
std::pair<uint8_t *,uint8_t *>
970970
data<T,U>::get_evec_data_range(ptr dp) {
971-
rust_vec *vp = bump_dp<rust_vec *>(dp);
971+
rust_evec *vp = bump_dp<rust_evec *>(dp);
972972
return std::make_pair(vp->data, vp->data + vp->fill);
973973
}
974974

trunk/src/rt/rust_upcall.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ upcall_new_str(rust_task *task, char const *s, size_t fill) {
222222
return make_str(task, s, fill);
223223
}
224224

225-
static rust_vec *
225+
static rust_evec *
226226
vec_grow(rust_task *task,
227-
rust_vec *v,
227+
rust_evec *v,
228228
size_t n_bytes,
229229
uintptr_t *need_copy,
230230
type_desc *td)
@@ -237,7 +237,7 @@ vec_grow(rust_task *task,
237237
v, n_bytes, v->ref_count, v->alloc, v->fill, need_copy);
238238

239239
*need_copy = 0;
240-
size_t alloc = next_power_of_two(sizeof(rust_vec) + v->fill + n_bytes);
240+
size_t alloc = next_power_of_two(sizeof(rust_evec) + v->fill + n_bytes);
241241

242242
if (v->ref_count == 1) {
243243

@@ -249,7 +249,7 @@ vec_grow(rust_task *task,
249249

250250
// Second-fastest path: can at least realloc.
251251
LOG(task, mem, "realloc path");
252-
v = (rust_vec*) task->realloc(v, alloc, td->is_stateful);
252+
v = (rust_evec*) task->realloc(v, alloc, td->is_stateful);
253253
if (!v) {
254254
task->fail();
255255
return NULL;
@@ -260,9 +260,9 @@ vec_grow(rust_task *task,
260260
/**
261261
* Slowest path: make a new vec.
262262
*
263-
* 1. Allocate a new rust_vec with desired additional space.
264-
* 2. Down-ref the shared rust_vec, point to the new one instead.
265-
* 3. Copy existing elements into the new rust_vec.
263+
* 1. Allocate a new rust_evec with desired additional space.
264+
* 2. Down-ref the shared rust_evec, point to the new one instead.
265+
* 3. Copy existing elements into the new rust_evec.
266266
*
267267
* Step 3 is a bit tricky. We don't know how to properly copy the
268268
* elements in the runtime (all we have are bits in a buffer; no
@@ -271,7 +271,7 @@ vec_grow(rust_task *task,
271271
* that we need the copies performed for us.
272272
*/
273273
LOG(task, mem, "new vec path");
274-
void *mem = task->malloc(alloc, "rust_vec (vec_grow)", td);
274+
void *mem = task->malloc(alloc, "rust_evec (vec_grow)", td);
275275
if (!mem) {
276276
task->fail();
277277
return NULL;
@@ -280,10 +280,10 @@ vec_grow(rust_task *task,
280280
if (v->ref_count != CONST_REFCOUNT)
281281
v->deref();
282282

283-
v = new (mem) rust_vec(alloc, 0, NULL);
283+
v = new (mem) rust_evec(alloc, 0, NULL);
284284
*need_copy = 1;
285285
}
286-
I(sched, sizeof(rust_vec) + v->fill <= v->alloc);
286+
I(sched, sizeof(rust_evec) + v->fill <= v->alloc);
287287
return v;
288288
}
289289

@@ -309,14 +309,14 @@ copy_elements(rust_task *task, type_desc *elem_t,
309309

310310
extern "C" CDECL void
311311
upcall_evec_append(rust_task *task, type_desc *t, type_desc *elem_t,
312-
rust_vec **dst_ptr, rust_vec *src, bool skip_null)
312+
rust_evec **dst_ptr, rust_evec *src, bool skip_null)
313313
{
314314
LOG_UPCALL_ENTRY(task);
315-
rust_vec *dst = *dst_ptr;
315+
rust_evec *dst = *dst_ptr;
316316
uintptr_t need_copy;
317317
size_t n_src_bytes = skip_null ? src->fill - 1 : src->fill;
318318
size_t n_dst_bytes = skip_null ? dst->fill - 1 : dst->fill;
319-
rust_vec *new_vec = vec_grow(task, dst, n_src_bytes, &need_copy, t);
319+
rust_evec *new_vec = vec_grow(task, dst, n_src_bytes, &need_copy, t);
320320

321321
// If src and dst are the same (due to "v += v"), then dst getting
322322
// resized causes src to move as well.
@@ -341,7 +341,7 @@ upcall_evec_append(rust_task *task, type_desc *t, type_desc *elem_t,
341341
// FIXME: Transitional. Please remove.
342342
extern "C" CDECL void
343343
upcall_vec_append(rust_task *task, type_desc *t, type_desc *elem_t,
344-
rust_vec **dst_ptr, rust_vec *src, bool skip_null) {
344+
rust_evec **dst_ptr, rust_evec *src, bool skip_null) {
345345
upcall_evec_append(task, t, elem_t, dst_ptr, src, skip_null);
346346
}
347347

trunk/src/rt/rust_util.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,29 +181,29 @@ isaac_init(sched_or_kernel *sched, randctx *rctx)
181181
// Vectors (rust-user-code level).
182182

183183
struct
184-
rust_vec : public rc_base<rust_vec>
184+
rust_evec : public rc_base<rust_evec>
185185
{
186186
size_t alloc;
187187
size_t fill;
188188
size_t pad; // Pad to align data[0] to 16 bytes.
189189
uint8_t data[];
190-
rust_vec(size_t alloc, size_t fill,
190+
rust_evec(size_t alloc, size_t fill,
191191
uint8_t const *d)
192192
: alloc(alloc),
193193
fill(fill)
194194
{
195195
if (d)
196196
memcpy(&data[0], d, fill);
197197
}
198-
~rust_vec() {}
198+
~rust_evec() {}
199199

200200
inline void *operator new(size_t size, void *mem) {
201201
return mem;
202202
}
203203
};
204204

205-
// Rust types vec and str look identical from our perspective.
206-
typedef rust_vec rust_str;
205+
// Strings are just exterior vecs
206+
typedef rust_evec rust_str;
207207

208208
// Interior vectors (rust-user-code level).
209209

0 commit comments

Comments
 (0)