Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
619:722630261d62 | 622:26fce59fe80a |
---|---|
74 return fn->getRVal(); | 74 return fn->getRVal(); |
75 } | 75 } |
76 else if (type->ty == Tdelegate) | 76 else if (type->ty == Tdelegate) |
77 { | 77 { |
78 LLValue* dg = fn->getRVal(); | 78 LLValue* dg = fn->getRVal(); |
79 Logger::cout() << "delegate: " << *dg << '\n'; | 79 if (Logger::enabled()) |
80 Logger::cout() << "delegate: " << *dg << '\n'; | |
80 LLValue* funcptr = DtoGEPi(dg, 0, 1); | 81 LLValue* funcptr = DtoGEPi(dg, 0, 1); |
81 return DtoLoad(funcptr); | 82 return DtoLoad(funcptr); |
82 } | 83 } |
83 else | 84 else |
84 { | 85 { |
124 size_t sz = getABITypeSize(vtypes.back()); | 125 size_t sz = getABITypeSize(vtypes.back()); |
125 if (sz < PTRSIZE) | 126 if (sz < PTRSIZE) |
126 vtypes.back() = DtoSize_t(); | 127 vtypes.back() = DtoSize_t(); |
127 } | 128 } |
128 const LLStructType* vtype = LLStructType::get(vtypes); | 129 const LLStructType* vtype = LLStructType::get(vtypes); |
129 Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n'; | 130 |
131 if (Logger::enabled()) | |
132 Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n'; | |
133 | |
130 LLValue* mem = DtoAlloca(vtype,"_argptr_storage"); | 134 LLValue* mem = DtoAlloca(vtype,"_argptr_storage"); |
131 | 135 |
132 // store arguments in the struct | 136 // store arguments in the struct |
133 for (int i=begin,k=0; i<n_arguments; i++,k++) | 137 for (int i=begin,k=0; i<n_arguments; i++,k++) |
134 { | 138 { |
145 const LLType* typeinfotype = DtoType(Type::typeinfo->type); | 149 const LLType* typeinfotype = DtoType(Type::typeinfo->type); |
146 const LLArrayType* typeinfoarraytype = LLArrayType::get(typeinfotype,vtype->getNumElements()); | 150 const LLArrayType* typeinfoarraytype = LLArrayType::get(typeinfotype,vtype->getNumElements()); |
147 | 151 |
148 llvm::GlobalVariable* typeinfomem = | 152 llvm::GlobalVariable* typeinfomem = |
149 new llvm::GlobalVariable(typeinfoarraytype, true, llvm::GlobalValue::InternalLinkage, NULL, "._arguments.storage", gIR->module); | 153 new llvm::GlobalVariable(typeinfoarraytype, true, llvm::GlobalValue::InternalLinkage, NULL, "._arguments.storage", gIR->module); |
150 Logger::cout() << "_arguments storage: " << *typeinfomem << '\n'; | 154 if (Logger::enabled()) |
155 Logger::cout() << "_arguments storage: " << *typeinfomem << '\n'; | |
151 | 156 |
152 std::vector<LLConstant*> vtypeinfos; | 157 std::vector<LLConstant*> vtypeinfos; |
153 for (int i=begin,k=0; i<n_arguments; i++,k++) | 158 for (int i=begin,k=0; i<n_arguments; i++,k++) |
154 { | 159 { |
155 Expression* argexp = (Expression*)arguments->data[i]; | 160 Expression* argexp = (Expression*)arguments->data[i]; |
312 Argument* fnarg = Argument::getNth(tf->parameters, i); | 317 Argument* fnarg = Argument::getNth(tf->parameters, i); |
313 DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); | 318 DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); |
314 LLValue* arg = argval->getRVal(); | 319 LLValue* arg = argval->getRVal(); |
315 if (fnarg) // can fnarg ever be null in this block? | 320 if (fnarg) // can fnarg ever be null in this block? |
316 { | 321 { |
317 Logger::cout() << "arg: " << *arg << '\n'; | 322 // if (Logger::enabled()) |
318 Logger::cout() << "expects: " << *callableTy->getParamType(j) << '\n'; | 323 // { |
324 // Logger::cout() << "arg: " << *arg << '\n'; | |
325 // Logger::cout() << "expects: " << *callableTy->getParamType(j) << '\n'; | |
326 // } | |
319 if (arg->getType() != callableTy->getParamType(j)) | 327 if (arg->getType() != callableTy->getParamType(j)) |
320 arg = DtoBitCast(arg, callableTy->getParamType(j)); | 328 arg = DtoBitCast(arg, callableTy->getParamType(j)); |
321 if (fnarg->llvmAttrs) | 329 if (fnarg->llvmAttrs) |
322 palist = palist.addAttr(j+1, fnarg->llvmAttrs); | 330 palist = palist.addAttr(j+1, fnarg->llvmAttrs); |
323 } | 331 } |