1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 #![feature(allocator, core_intrinsics, libc)]
15 #![crate_type = "rlib"]
20 pub static mut HITS: usize = 0;
23 pub extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
26 libc::malloc(size as libc::size_t) as *mut u8
31 pub extern fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize) {
34 libc::free(ptr as *mut _)
39 pub extern fn __rust_reallocate(ptr: *mut u8, old_size: usize, size: usize,
40 align: usize) -> *mut u8 {
42 libc::realloc(ptr as *mut _, size as libc::size_t) as *mut u8
47 pub extern fn __rust_reallocate_inplace(ptr: *mut u8, old_size: usize,
48 size: usize, align: usize) -> usize {
49 unsafe { core::intrinsics::abort() }
53 pub extern fn __rust_usable_size(size: usize, align: usize) -> usize {
54 unsafe { core::intrinsics::abort() }