@@ -43,6 +43,27 @@ pub unsafe fn malloc_raw(size: uint) -> *c_void {
43
43
}
44
44
45
45
// FIXME #4942: Make these signatures agree with exchange_alloc's signatures
46
+ #[ cfg( stage0, not( test) ) ]
47
+ #[ lang="exchange_malloc" ]
48
+ #[ inline]
49
+ pub unsafe fn exchange_malloc ( td : * c_char , size : uintptr_t ) -> * c_char {
50
+ let td = td as * TyDesc ;
51
+ let size = size as uint ;
52
+
53
+ assert ! ( td. is_not_null( ) ) ;
54
+
55
+ let total_size = get_box_size ( size, ( * td) . align ) ;
56
+ let p = malloc_raw ( total_size as uint ) ;
57
+
58
+ let box: * mut BoxRepr = p as * mut BoxRepr ;
59
+ ( * box) . header . ref_count = -1 ;
60
+ ( * box) . header . type_desc = td;
61
+
62
+ box as * c_char
63
+ }
64
+
65
+ // FIXME #4942: Make these signatures agree with exchange_alloc's signatures
66
+ #[ cfg( not( stage0) , not( test) ) ]
46
67
#[ lang="exchange_malloc" ]
47
68
#[ inline]
48
69
pub unsafe fn exchange_malloc ( td : * c_char , size : uintptr_t ) -> * c_char {
@@ -55,7 +76,6 @@ pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
55
76
let p = malloc_raw ( total_size as uint ) ;
56
77
57
78
let box: * mut BoxRepr = p as * mut BoxRepr ;
58
- ( * box) . header . ref_count = -1 ; // Exchange values not ref counted
59
79
( * box) . header . type_desc = td;
60
80
61
81
box as * c_char
0 commit comments