about summary refs log tree commit diff
path: root/src/libstd/gc.rs
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/libstd/gc.rs
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/libstd/gc.rs')
-rw-r--r--src/libstd/gc.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libstd/gc.rs b/src/libstd/gc.rs
index 2a211484e73..c9e33219fa5 100644
--- a/src/libstd/gc.rs
+++ b/src/libstd/gc.rs
@@ -316,6 +316,19 @@ fn expect_sentinel() -> bool { true }
 #[cfg(nogc)]
 fn expect_sentinel() -> bool { false }
 
+#[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);
+}
+
 // Entry point for GC-based cleanup. Walks stack looking for exchange
 // heap and stack allocations requiring drop, and runs all
 // destructors.
@@ -359,7 +372,7 @@ pub fn cleanup_stack_for_failure() {
                 // FIXME #4420: Destroy this box
                 // FIXME #4330: Destroy this box
             } else {
-                ((*tydesc).drop_glue)(&tydesc as **TyDesc, *root as *i8);
+                call_drop_glue(tydesc, *root as *i8);
             }
         }
     }