Skip to content

Commit 1f12d1b

Browse files
committed
---
yaml --- r: 61305 b: refs/heads/try c: 204e3d8 h: refs/heads/master i: 61303: e201b8e v: v3
1 parent 0dec19c commit 1f12d1b

File tree

5 files changed

+49
-7
lines changed

5 files changed

+49
-7
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: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
5-
refs/heads/try: f934fa73aca85cded967420ef2ab0dd9f14a6638
5+
refs/heads/try: 204e3d82ccf5015e39f847aafea148d5180ab951
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/rt/io/net/tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ mod test {
122122
use rt::io::net::ip::Ipv4;
123123
use rt::io::*;
124124

125-
#[test]
125+
#[test] #[ignore]
126126
fn bind_error() {
127127
do run_in_newsched_task {
128128
let mut called = false;

branches/try/src/libcore/rt/stack.rs

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,36 @@
99
// except according to those terms.
1010

1111
use vec;
12+
use ops::Drop;
13+
use libc::{c_uint, uintptr_t};
1214

1315
pub struct StackSegment {
14-
buf: ~[u8]
16+
buf: ~[u8],
17+
valgrind_id: c_uint
1518
}
1619

1720
pub impl StackSegment {
1821
fn new(size: uint) -> StackSegment {
19-
// Crate a block of uninitialized values
20-
let mut stack = vec::with_capacity(size);
2122
unsafe {
23+
// Crate a block of uninitialized values
24+
let mut stack = vec::with_capacity(size);
2225
vec::raw::set_len(&mut stack, size);
26+
27+
let mut stk = StackSegment {
28+
buf: stack,
29+
valgrind_id: 0
30+
};
31+
32+
// XXX: Using the FFI to call a C macro. Slow
33+
stk.valgrind_id = rust_valgrind_stack_register(stk.start(), stk.end());
34+
return stk;
2335
}
36+
}
2437

25-
StackSegment {
26-
buf: stack
38+
/// Point to the low end of the allocated stack
39+
fn start(&self) -> *uint {
40+
unsafe {
41+
vec::raw::to_ptr(self.buf) as *uint
2742
}
2843
}
2944

@@ -35,6 +50,15 @@ pub impl StackSegment {
3550
}
3651
}
3752

53+
impl Drop for StackSegment {
54+
fn finalize(&self) {
55+
unsafe {
56+
// XXX: Using the FFI to call a C macro. Slow
57+
rust_valgrind_stack_deregister(self.valgrind_id);
58+
}
59+
}
60+
}
61+
3862
pub struct StackPool(());
3963

4064
impl StackPool {
@@ -47,3 +71,8 @@ impl StackPool {
4771
fn give_segment(&self, _stack: StackSegment) {
4872
}
4973
}
74+
75+
extern {
76+
fn rust_valgrind_stack_register(start: *uintptr_t, end: *uintptr_t) -> c_uint;
77+
fn rust_valgrind_stack_deregister(id: c_uint);
78+
}

branches/try/src/rt/rust_stack.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,14 @@ destroy_exchange_stack(rust_exchange_alloc *exchange, stk_seg *stk) {
9292
deregister_valgrind_stack(stk);
9393
exchange->free(stk);
9494
}
95+
96+
97+
extern "C" CDECL unsigned int
98+
rust_valgrind_stack_register(void *start, void *end) {
99+
return VALGRIND_STACK_REGISTER(start, end);
100+
}
101+
102+
extern "C" CDECL void
103+
rust_valgrind_stack_deregister(unsigned int id) {
104+
VALGRIND_STACK_DEREGISTER(id);
105+
}

branches/try/src/rt/rustrt.def.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,5 @@ rust_try
234234
rust_begin_unwind
235235
rust_take_task_borrow_list
236236
rust_set_task_borrow_list
237+
rust_valgrind_stack_register
238+
rust_valgrind_stack_deregister

0 commit comments

Comments
 (0)