Skip to content

Commit a0ffc72

Browse files
committed
---
yaml --- r: 46975 b: refs/heads/try c: 5a9da65 h: refs/heads/master i: 46973: 48f1f31 46971: a92402a 46967: 5e01573 46959: f6608b0 46943: 08daad9 46911: a680374 46847: c4c9ecc v: v3
1 parent 1d5c5b9 commit a0ffc72

File tree

11 files changed

+13
-45
lines changed

11 files changed

+13
-45
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: 206757f8688bfe9958854952e7f1f21b5374a508
5+
refs/heads/try: 5a9da65dc9b3225e0278faedba71eb8b5cfb237d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/private/exchange_alloc.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use c_malloc = libc::malloc;
1414
use c_free = libc::free;
1515
use managed::raw::{BoxHeaderRepr, BoxRepr};
1616
use cast::transmute;
17-
use ptr::{set_memory, null};
17+
use ptr::null;
1818
use intrinsic::TyDesc;
1919

2020
pub unsafe fn malloc(td: *TypeDesc, size: uint) -> *c_void {
@@ -25,10 +25,6 @@ pub unsafe fn malloc(td: *TypeDesc, size: uint) -> *c_void {
2525
let p = c_malloc(total_size as size_t);
2626
assert p.is_not_null();
2727

28-
// FIXME #4761: Would be very nice to not memset all allocations
29-
let p: *mut u8 = transmute(p);
30-
set_memory(p, 0, total_size);
31-
3228
// FIXME #3475: Converting between our two different tydesc types
3329
let td: *TyDesc = transmute(td);
3430

branches/try/src/libstd/uv_ll.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ pub mod test {
12531253
as *request_wrapper;
12541254
let buf_base = get_base_from_buf(buf);
12551255
let buf_len = get_len_from_buf(buf);
1256-
let bytes = vec::from_buf(buf_base, buf_len as uint);
1256+
let bytes = vec::from_buf(buf_base, nread as uint);
12571257
let read_chan = (*client_data).read_chan.clone();
12581258
let msg_from_server = str::from_bytes(bytes);
12591259
read_chan.send(msg_from_server);
@@ -1445,15 +1445,15 @@ pub mod test {
14451445
buf_base as uint,
14461446
buf_len as uint,
14471447
nread));
1448-
let bytes = vec::from_buf(buf_base, buf_len);
1448+
let bytes = vec::from_buf(buf_base, nread as uint);
14491449
let request_str = str::from_bytes(bytes);
14501450

14511451
let client_data = get_data_for_uv_handle(
14521452
client_stream_ptr as *libc::c_void) as *tcp_server_data;
14531453

14541454
let server_kill_msg = (*client_data).server_kill_msg;
14551455
let write_req = (*client_data).server_write_req;
1456-
if (str::contains(request_str, server_kill_msg)) {
1456+
if str::contains(request_str, server_kill_msg) {
14571457
log(debug, ~"SERVER: client req contains kill_msg!");
14581458
log(debug, ~"SERVER: sending response to client");
14591459
read_stop(client_stream_ptr);

branches/try/src/rt/memory_region.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ memory_region::realloc(void *mem, size_t orig_size) {
121121
}
122122

123123
void *
124-
memory_region::malloc(size_t size, const char *tag, bool zero) {
124+
memory_region::malloc(size_t size, const char *tag) {
125+
# if RUSTRT_TRACK_ALLOCATIONS >= 1
125126
size_t old_size = size;
127+
# endif
126128
size += HEADER_SIZE;
127129
alloc_header *mem = (alloc_header *)::malloc(size);
128130
if (mem == NULL) {
@@ -143,18 +145,9 @@ memory_region::malloc(size_t size, const char *tag, bool zero) {
143145
void *data = get_data(mem);
144146
claim_alloc(data);
145147

146-
if(zero) {
147-
memset(data, 0, old_size);
148-
}
149-
150148
return data;
151149
}
152150

153-
void *
154-
memory_region::calloc(size_t size, const char *tag) {
155-
return malloc(size, tag, true);
156-
}
157-
158151
memory_region::~memory_region() {
159152
if (_synchronized) { _lock.lock(); }
160153
if (_live_allocations == 0 && !_detailed_leaks) {

branches/try/src/rt/memory_region.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ class memory_region {
7777
public:
7878
memory_region(rust_env *env, bool synchronized);
7979
memory_region(memory_region *parent);
80-
void *malloc(size_t size, const char *tag, bool zero = true);
81-
void *calloc(size_t size, const char *tag);
80+
void *malloc(size_t size, const char *tag);
8281
void *realloc(void *mem, size_t size);
8382
void free(void *mem);
8483
~memory_region();

branches/try/src/rt/rust_exchange_alloc.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,15 @@
1818
uintptr_t exchange_count = 0;
1919

2020
void *
21-
rust_exchange_alloc::malloc(size_t size, bool zero) {
21+
rust_exchange_alloc::malloc(size_t size) {
2222
void *value = ::malloc(size);
2323
assert(value);
24-
if (zero) {
25-
memset(value, 0, size);
26-
}
2724

2825
sync::increment(exchange_count);
2926

3027
return value;
3128
}
3229

33-
void *
34-
rust_exchange_alloc::calloc(size_t size) {
35-
return this->malloc(size);
36-
}
37-
3830
void *
3931
rust_exchange_alloc::realloc(void *ptr, size_t size) {
4032
void *new_ptr = ::realloc(ptr, size);

branches/try/src/rt/rust_exchange_alloc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
class rust_exchange_alloc {
1818
public:
19-
void *malloc(size_t size, bool zero = true);
20-
void *calloc(size_t size);
19+
void *malloc(size_t size);
2120
void *realloc(void *mem, size_t size);
2221
void free(void *mem);
2322
};

branches/try/src/rt/rust_kernel.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ rust_kernel::malloc(size_t size, const char *tag) {
7979
return exchange_alloc.malloc(size);
8080
}
8181

82-
void *
83-
rust_kernel::calloc(size_t size, const char *tag) {
84-
return exchange_alloc.calloc(size);
85-
}
86-
8782
void *
8883
rust_kernel::realloc(void *mem, size_t size) {
8984
return exchange_alloc.realloc(mem, size);

branches/try/src/rt/rust_kernel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ class rust_kernel {
133133
void fatal(char const *fmt, ...);
134134

135135
void *malloc(size_t size, const char *tag);
136-
void *calloc(size_t size, const char *tag);
137136
void *realloc(void *mem, size_t size);
138137
void free(void *mem);
139138
rust_exchange_alloc *region() { return &exchange_alloc; }

branches/try/src/rt/rust_stack.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ check_stack_canary(stk_seg *stk) {
5858
stk_seg *
5959
create_stack(memory_region *region, size_t sz) {
6060
size_t total_sz = sizeof(stk_seg) + sz;
61-
stk_seg *stk = (stk_seg *)region->malloc(total_sz, "stack", false);
61+
stk_seg *stk = (stk_seg *)region->malloc(total_sz, "stack");
6262
memset(stk, 0, sizeof(stk_seg));
6363
stk->end = (uintptr_t) &stk->data[sz];
6464
add_stack_canary(stk);
@@ -75,7 +75,7 @@ destroy_stack(memory_region *region, stk_seg *stk) {
7575
stk_seg *
7676
create_exchange_stack(rust_exchange_alloc *exchange, size_t sz) {
7777
size_t total_sz = sizeof(stk_seg) + sz;
78-
stk_seg *stk = (stk_seg *)exchange->malloc(total_sz, false);
78+
stk_seg *stk = (stk_seg *)exchange->malloc(total_sz);
7979
memset(stk, 0, sizeof(stk_seg));
8080
stk->end = (uintptr_t) &stk->data[sz];
8181
add_stack_canary(stk);

branches/try/src/rt/rust_task.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,6 @@ rust_task::backtrace() {
450450
#endif
451451
}
452452

453-
void *
454-
rust_task::calloc(size_t size, const char *tag) {
455-
return local_region.calloc(size, tag);
456-
}
457-
458453
size_t
459454
rust_task::get_next_stack_size(size_t min, size_t current, size_t requested) {
460455
LOG(this, mem, "calculating new stack size for 0x%" PRIxPTR, this);

0 commit comments

Comments
 (0)