-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.
Description
It doesn't like that our libc
signatures don't quite match, and we also currently have to mark all of the wrappers as inline(never)
to prevent fixed_stack_segment
from being too aggressively bubbled up.
Specifically, I really want dead-store-elimination working on unique pointers like it does with runtimeless Rust:
#[no_std];
#[allow(ctypes, cstack)];
extern {
fn malloc(size: uint) -> *mut u8;
fn free(ptr: *mut u8);
fn abort() -> !;
}
#[lang = "exchange_malloc"]
#[inline(always)]
unsafe fn exchange_malloc(size: uint) -> *mut u8 {
let ptr = malloc(size);
if ptr == 0 as *mut u8 {
abort()
}
ptr
}
#[lang = "exchange_free"]
#[inline(always)]
unsafe fn exchange_free(ptr: *mut u8) {
free(ptr)
}
#[start]
fn main(_: int, _: **u8) -> int {
let mut _a = ~5;
0
}
LLVM eliminates the allocation here.
Metadata
Metadata
Assignees
Labels
I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.