changeset 1440:d7ec997de427

Adjust runtime for recent ABI change on x86-64, since member functions are no longer equivalent to regular functions with `this` as their first argument. (They weren't anyway, but it happened to work as long as there was no `sret` parameter)
author Frits van Bommel <fvbommel wxs.nl>
date Sun, 31 May 2009 14:27:01 +0200
parents 679ac907c82f
children a3af393d1936
files runtime/internal/genobj.d runtime/internal/invariant.d runtime/internal/lifetime.d
diffstat 3 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/internal/genobj.d	Sun May 31 10:41:20 2009 +0200
+++ b/runtime/internal/genobj.d	Sun May 31 14:27:01 2009 +0200
@@ -153,7 +153,7 @@
     Interface[] interfaces;     /// interfaces this class implements
     ClassInfo   base;           /// base class
     void*       destructor;
-    void function(Object) classInvariant;
+    void*       classInvariant;
     uint        flags;
     //  1:                      // IUnknown
     //  2:                      // has no possible pointers into GC memory
@@ -198,8 +198,10 @@
 
         if (flags & 8 && defaultConstructor)
         {
-            auto ctor = cast(Object function(Object))defaultConstructor;
-            return ctor(o);
+            Object delegate() ctor;
+            ctor.ptr = cast(void*)o;
+            ctor.funcptr = cast(Object function())defaultConstructor;
+            return ctor();
         }
         return o;
     }
--- a/runtime/internal/invariant.d	Sun May 31 10:41:20 2009 +0200
+++ b/runtime/internal/invariant.d	Sun May 31 14:27:01 2009 +0200
@@ -18,7 +18,10 @@
     {
 	if (c.classInvariant)
 	{
-	    (*c.classInvariant)(o);
+	    void delegate() inv;
+	    inv.ptr = cast(void*) o;
+	    inv.funcptr = c.classInvariant;
+	    inv();
 	}
 	c = c.base;
     } while (c);
--- a/runtime/internal/lifetime.d	Sun May 31 10:41:20 2009 +0200
+++ b/runtime/internal/lifetime.d	Sun May 31 14:27:01 2009 +0200
@@ -560,8 +560,10 @@
                         if (c.destructor)
                         {
                             debug(PRINTF) printf("calling dtor of %.*s\n", c.name.length, c.name.ptr);
-                            fp_t fp = cast(fp_t)c.destructor;
-                            (*fp)(cast(Object)p); // call destructor
+                            void delegate() dg;
+                            dg.ptr = p;
+                            dg.funcptr = cast(void function()) c.destructor;
+                            dg(); // call destructor
                         }
                         c = c.base;
                     } while (c);