From 2532856f1c1267fcb5f937003f3c008e3c0879b0 Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Thu, 4 Dec 2008 16:11:09 +0100 Subject: [PATCH] Commented some logging that could be '''very''' long, cuts -vv output size of a gtkd gl sample down 1.2GB by 3/4. Fixed wrong pointer type for multidimension "deep" slicing. --- gen/arrays.cpp | 7 +++++++ gen/classes.cpp | 20 ++++++++++---------- gen/toir.cpp | 3 +++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gen/arrays.cpp b/gen/arrays.cpp index 4d6e2171..916b6a30 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -189,6 +189,13 @@ void DtoArrayInit(Loc& loc, DValue* array, DValue* value) assert(0 && "unhandled array init"); } + if (Logger::enabled()) + { + Logger::cout() << "ptr = " << *args[0] << std::endl; + Logger::cout() << "dim = " << *args[1] << std::endl; + Logger::cout() << "val = " << *args[2] << std::endl; + } + LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, funcname); assert(fn); if (Logger::enabled()) diff --git a/gen/classes.cpp b/gen/classes.cpp index 3d67abcb..db0e5339 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -255,8 +255,8 @@ void DtoResolveClass(ClassDeclaration* cd) llvm::cast(irstruct->vtblTy.get())->refineAbstractTypeTo(LLArrayType::get(getVoidPtrType(), cd->vtbl.dim)); // log - if (Logger::enabled()) - Logger::cout() << "final class type: " << *ts->ir.type->get() << '\n'; +// if (Logger::enabled()) +// Logger::cout() << "final class type: " << *ts->ir.type->get() << '\n'; // pop state gIR->structs.pop_back(); @@ -582,8 +582,8 @@ static void init_class_vtbl_initializer(ClassDeclaration* cd) // refine type llvm::cast(irstruct->vtblInitTy.get())->refineAbstractTypeTo(irstruct->constVtbl->getType()); - if (Logger::enabled()) - Logger::cout() << "vtbl initializer: " << *irstruct->constVtbl << std::endl; +// if (Logger::enabled()) +// Logger::cout() << "vtbl initializer: " << *irstruct->constVtbl << std::endl; } ////////////////////////////////////////////////////////////////////////////// @@ -760,12 +760,12 @@ void DtoConstInitClass(ClassDeclaration* cd) // refine __initZ global type to the one of the initializer llvm::cast(irstruct->initOpaque.get())->refineAbstractTypeTo(irstruct->constInit->getType()); - if (Logger::enabled()) - { - Logger::cout() << "class " << cd->toChars() << std::endl; - Logger::cout() << "type " << *cd->type->ir.type->get() << std::endl; - Logger::cout() << "initializer " << *irstruct->constInit << std::endl; - } +// if (Logger::enabled()) +// { +// Logger::cout() << "class " << cd->toChars() << std::endl; +// Logger::cout() << "type " << *cd->type->ir.type->get() << std::endl; +// Logger::cout() << "initializer " << *irstruct->constInit << std::endl; +// } gIR->structs.pop_back(); } diff --git a/gen/toir.cpp b/gen/toir.cpp index b64d315c..1e5e987c 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -1240,6 +1240,9 @@ DValue* SliceExp::toElem(IRState* p) { TypeSArray* tsa = (TypeSArray*)etype; elen = DtoConstSize_t(tsa->dim->toUInteger()); + + // in this case, we also need to make sure the pointer is cast to the innermost element type + eptr = DtoBitCast(eptr, DtoType(tsa->nextOf()->pointerTo())); } // for normal code the actual array length is what we want! else