diff gen/tocall.cpp @ 622:26fce59fe80a

Wrapped all the most potentially expensive logging calls in a conditional to only do work when actually requested. Commented some logging calls that could potentially write out many megabytes of type dumps.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 01 Oct 2008 18:32:31 +0200
parents fbb1a366cfbc
children df196c8dea26
line wrap: on
line diff
--- a/gen/tocall.cpp	Sun Sep 28 21:09:21 2008 +0200
+++ b/gen/tocall.cpp	Wed Oct 01 18:32:31 2008 +0200
@@ -76,7 +76,8 @@
     else if (type->ty == Tdelegate)
     {
         LLValue* dg = fn->getRVal();
-        Logger::cout() << "delegate: " << *dg << '\n';
+        if (Logger::enabled())
+            Logger::cout() << "delegate: " << *dg << '\n';
         LLValue* funcptr = DtoGEPi(dg, 0, 1);
         return DtoLoad(funcptr);
     }
@@ -126,7 +127,10 @@
             vtypes.back() = DtoSize_t();
     }
     const LLStructType* vtype = LLStructType::get(vtypes);
-    Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n';
+
+    if (Logger::enabled())
+        Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n';
+
     LLValue* mem = DtoAlloca(vtype,"_argptr_storage");
 
     // store arguments in the struct
@@ -147,7 +151,8 @@
 
     llvm::GlobalVariable* typeinfomem =
         new llvm::GlobalVariable(typeinfoarraytype, true, llvm::GlobalValue::InternalLinkage, NULL, "._arguments.storage", gIR->module);
-    Logger::cout() << "_arguments storage: " << *typeinfomem << '\n';
+    if (Logger::enabled())
+        Logger::cout() << "_arguments storage: " << *typeinfomem << '\n';
 
     std::vector<LLConstant*> vtypeinfos;
     for (int i=begin,k=0; i<n_arguments; i++,k++)
@@ -314,8 +319,11 @@
             LLValue* arg = argval->getRVal();
             if (fnarg) // can fnarg ever be null in this block?
             {
-                Logger::cout() << "arg:     " << *arg << '\n';
-                Logger::cout() << "expects: " << *callableTy->getParamType(j) << '\n';
+//                 if (Logger::enabled())
+//                 {
+//                     Logger::cout() << "arg:     " << *arg << '\n';
+//                     Logger::cout() << "expects: " << *callableTy->getParamType(j) << '\n';
+//                 }
                 if (arg->getType() != callableTy->getParamType(j))
                     arg = DtoBitCast(arg, callableTy->getParamType(j));
                 if (fnarg->llvmAttrs)