From e2f1049bd5f041f1f219d683e4e29e32ca30cd1c Mon Sep 17 00:00:00 2001 From: Philipp Brüschweiler Date: Sat, 22 Jun 2013 21:36:00 +0200 Subject: Remove unused TyDesc parameter from the glue functions To remove the environment pointer, support for function pointers without an environment argument is needed (i.e. a fixed version of #6661). --- src/libextra/arena.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/libextra') diff --git a/src/libextra/arena.rs b/src/libextra/arena.rs index 3766af04656..cec3a2c1e95 100644 --- a/src/libextra/arena.rs +++ b/src/libextra/arena.rs @@ -115,6 +115,19 @@ fn round_up_to(base: uint, align: uint) -> uint { (base + (align - 1)) & !(align - 1) } +#[inline] +#[cfg(not(stage0))] +unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) { + // This function should be inlined when stage0 is gone + ((*tydesc).drop_glue)(data); +} + +#[inline] +#[cfg(stage0)] +unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) { + ((*tydesc).drop_glue)(0 as **TyDesc, data); +} + // Walk down a chunk, running the destructors for any objects stored // in it. unsafe fn destroy_chunk(chunk: &Chunk) { @@ -134,8 +147,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) { //debug!("freeing object: idx = %u, size = %u, align = %u, done = %b", // start, size, align, is_done); if is_done { - ((*tydesc).drop_glue)(&tydesc as **TyDesc, - ptr::offset(buf, start) as *i8); + call_drop_glue(tydesc, ptr::offset(buf, start) as *i8); } // Find where the next tydesc lives -- cgit 1.4.1-3-g733a5