@@ -43,6 +43,27 @@ pub unsafe fn malloc_raw(size: uint) -> *c_void {
4343}
4444
4545// 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) ) ]
4667#[ lang="exchange_malloc" ]
4768#[ inline]
4869pub 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 {
5576 let p = malloc_raw ( total_size as uint ) ;
5677
5778 let box: * mut BoxRepr = p as * mut BoxRepr ;
58- ( * box) . header . ref_count = -1 ; // Exchange values not ref counted
5979 ( * box) . header . type_desc = td;
6080
6181 box as * c_char
0 commit comments