Skip to content

Commit 3bfc66f

Browse files
committed
---
yaml --- r: 46963 b: refs/heads/try c: 1a41b48 h: refs/heads/master i: 46961: 2f14ca3 46959: f6608b0 v: v3
1 parent 48c5445 commit 3bfc66f

File tree

5 files changed

+6
-19
lines changed

5 files changed

+6
-19
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: 2e0614750c398c9aac2f4064addb2fa95ba32282
5+
refs/heads/try: 1a41b484bf05514f469e69efd56fcd7039d34db9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

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_stack.cpp

Lines changed: 1 addition & 1 deletion
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);

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)