changeset 1436:59c527d44303

merging
author Kelly Wilson <wilsonk cpsc.ucalgary.ca>
date Sat, 30 May 2009 14:36:00 -0600
parents 171ef89dd3ee (current diff) 5d0c043ff131 (diff)
children efa34a3bb8fc
files
diffstat 5 files changed, 17 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/lexer.c	Sat May 30 14:35:03 2009 -0600
+++ b/dmd/lexer.c	Sat May 30 14:36:00 2009 -0600
@@ -8,6 +8,10 @@
 // in artistic.txt, or the GNU General Public License in gnu.txt.
 // See the included readme.txt for details.
 
+#if __sun && __SVR4
+#define __C99FEATURES__ 1       // Needed on Solaris for NaN and more, LDC#313
+#endif
+
 #if IN_LLVM
 #include <cmath>
 #endif
--- a/gen/classes.cpp	Sat May 30 14:35:03 2009 -0600
+++ b/gen/classes.cpp	Sat May 30 14:36:00 2009 -0600
@@ -514,7 +514,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl)
+LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl, char* name)
 {
     // sanity checks
     assert(fdecl->isVirtual());
@@ -533,7 +533,9 @@
     // load vtbl ptr
     funcval = DtoLoad(funcval);
     // index vtbl
-    funcval = DtoGEPi(funcval, 0, fdecl->vtblIndex, fdecl->toChars());
+    std::string vtblname = name;
+    vtblname.append("@vtbl");
+    funcval = DtoGEPi(funcval, 0, fdecl->vtblIndex, vtblname.c_str());
     // load funcptr
     funcval = DtoAlignedLoad(funcval);
 
@@ -542,6 +544,10 @@
 
     // cast to final funcptr type
     funcval = DtoBitCast(funcval, getPtrToType(DtoType(fdecl->type)));
+
+    // postpone naming until after casting to get the name in call instructions
+    funcval->setName(name);
+
     if (Logger::enabled())
         Logger::cout() << "funcval casted: " << *funcval << '\n';
 
--- a/gen/classes.h	Sat May 30 14:35:03 2009 -0600
+++ b/gen/classes.h	Sat May 30 14:36:00 2009 -0600
@@ -32,6 +32,6 @@
 
 LLValue* DtoIndexClass(LLValue* src, ClassDeclaration* sd, VarDeclaration* vd);
 
-LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl);
+LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl, char* name);
 
 #endif
--- a/gen/main.cpp	Sat May 30 14:35:03 2009 -0600
+++ b/gen/main.cpp	Sat May 30 14:36:00 2009 -0600
@@ -369,7 +369,7 @@
     }
     else
     {
-        if (global.params.objname && files.dim > 1)
+        if (global.params.objname && files.dim > 1 && !singleObj)
         {
             error("multiple source files, but only one .obj name");
             fatal();
--- a/gen/toir.cpp	Sat May 30 14:35:03 2009 -0600
+++ b/gen/toir.cpp	Sat May 30 14:36:00 2009 -0600
@@ -1134,22 +1134,8 @@
             assert(funcval);
         }
         else {
-            assert(fdecl->vtblIndex > 0);
-            assert(e1type->ty == Tclass);
-
-            LLValue* zero = DtoConstUint(0);
-            size_t vtblidx = fdecl->vtblIndex;
-            if (Logger::enabled())
-                Logger::cout() << "vthis: " << *vthis << '\n';
-            funcval = DtoGEP(vthis, zero, zero);
-            funcval = DtoLoad(funcval);
-            Logger::println("vtblidx = %lu", vtblidx);
-            funcval = DtoGEP(funcval, zero, DtoConstUint(vtblidx), toChars());
-            funcval = DtoLoad(funcval);
-
-            funcval = DtoBitCast(funcval, getPtrToType(DtoType(fdecl->type)));
-            if (Logger::enabled())
-                Logger::cout() << "funcval casted: " << *funcval << '\n';
+            DImValue vthis3(e1type, vthis);
+            funcval = DtoVirtualFunctionPointer(&vthis3, fdecl, toChars());
         }
 
         return new DFuncValue(fdecl, funcval, vthis2);
@@ -2031,7 +2017,7 @@
 
     LLValue* castfptr;
     if (func->isVirtual() && !func->isFinal())
-        castfptr = DtoVirtualFunctionPointer(u, func);
+        castfptr = DtoVirtualFunctionPointer(u, func, toChars());
     else if (func->isAbstract())
         assert(0 && "TODO delegate to abstract method");
     else if (func->toParent()->isInterfaceDeclaration())