summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorPhilipp Brüschweiler <blei42@gmail.com>2013-06-22 21:36:00 +0200
committerPhilipp Brüschweiler <blei42@gmail.com>2013-06-23 13:02:00 +0200
commite2f1049bd5f041f1f219d683e4e29e32ca30cd1c (patch)
tree509134d12c4aa0c9bdaee4fecebe95a39036fdb9 /src/libextra
parent1b76bac41de9f52295a99db21abdd1ad5b0fc231 (diff)
downloadrust-e2f1049bd5f041f1f219d683e4e29e32ca30cd1c.tar.gz
rust-e2f1049bd5f041f1f219d683e4e29e32ca30cd1c.zip
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).
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/arena.rs16
1 files changed, 14 insertions, 2 deletions
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