diff tango/tango/text/convert/Layout.d @ 213:7816aafeea3c trunk

[svn r229] Updated the object.d implementation to the latest Tango. Fixed a bunch of the built-in typeinfos for arrays, they did not inherit TypeInfo_Array. Applied patch to tango/text/convert/Layout.d by fvbommel, closes #47 . Cleaned up some type code. Replaced uses of llvm::Type with LLType (a typedef), same for Value and Constant. Fixed a few cases where typeinfo for user structs could be emitted multiple times, seems to still be some cases of this :/
author lindquist
date Fri, 30 May 2008 19:32:04 +0200
parents a8cd9bc1021a
children a9dae3da4e87
line wrap: on
line diff
--- a/tango/tango/text/convert/Layout.d	Tue May 27 22:14:24 2008 +0200
+++ b/tango/tango/text/convert/Layout.d	Fri May 30 19:32:04 2008 +0200
@@ -193,8 +193,26 @@
                 assert (formatStr, "null format specifier");
                 assert (arguments.length < 64, "too many args in Layout.convert");
 
-        version (X86_64)
+        version (LLVMDC)
+                {
+                static va_list get_va_arg(TypeInfo ti, ref va_list vp)
                 {
+                    auto tisize = ti.tsize;
+                    size_t size = tisize > size_t.sizeof ? size_t.sizeof : tisize;
+                    va_list vptmp = cast(va_list)((cast(size_t)vp + size - 1) &  ~(size - 1));
+                    vp = vptmp + tisize;
+                    return vptmp;
+                }
+
+                Arg[64] arglist = void;
+                foreach (i, arg; arguments)
+                        {
+                        arglist[i] = get_va_arg(arg, args);
+                        }
+                }
+             else version (X86_64)
+                {
+                // code for x86-64 GDC
                 Arg[64] arglist = void;
                 int[64] intargs = void;
                 byte[64] byteargs = void;
@@ -265,25 +283,9 @@
                            }
                         }
                 }
-             else version (LLVMDC)
-                {
-                static va_list get_va_arg(TypeInfo ti, ref va_list vp)
-                {
-                    auto tisize = ti.tsize;
-                    size_t size = tisize > size_t.sizeof ? size_t.sizeof : tisize;
-                    va_list vptmp = cast(va_list)((cast(size_t)vp + size - 1) &  ~(size - 1));
-                    vp = vptmp + tisize;
-                    return vptmp;
-                }
-
-                Arg[64] arglist = void;
-                foreach (i, arg; arguments)
-                        {
-                        arglist[i] = get_va_arg(arg, args);
-                        }
-                }
              else
                 {
+                // code for DMD & x86 GDC (may also work on other 32-bit targets)
                 Arg[64] arglist = void;
                 foreach (i, arg; arguments)
                         {