MAINT-1503 Disable tcmalloc and fix remaining alignment issues.

master
Dave Parks 2012-08-31 14:11:46 -05:00
parent b7555a3309
commit de1d297dea
9 changed files with 104 additions and 25 deletions

View File

@ -3,7 +3,7 @@ include(Prebuilt)
# If you want to enable or disable TCMALLOC in viewer builds, this is the place.
# set ON or OFF as desired.
set (USE_TCMALLOC ON)
set (USE_TCMALLOC OFF)
if (STANDALONE)
include(FindGooglePerfTools)

View File

@ -89,6 +89,7 @@ protected:
// An interface class for a generalized parametric modification of the avatar mesh
// Contains data that is specific to each Avatar
//-----------------------------------------------------------------------------
LL_ALIGN_PREFIX(16)
class LLVisualParam
{
public:
@ -160,6 +161,6 @@ protected:
S32 mID; // id for storing weight/morphtarget compares compactly
LLVisualParamInfo *mInfo;
};
} LL_ALIGN_POSTFIX(16);
#endif // LL_LLVisualParam_H

View File

@ -254,9 +254,17 @@ S32 LLDrawable::findReferences(LLDrawable *drawablep)
return count;
}
static LLFastTimer::DeclareTimer FTM_ALLOCATE_FACE("Allocate Face", true);
LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep)
{
LLFace *face = new LLFace(this, mVObjp);
LLFace *face;
{
LLFastTimer t(FTM_ALLOCATE_FACE);
face = new LLFace(this, mVObjp);
}
if (!face) llerrs << "Allocating new Face: " << mFaces.size() << llendl;
if (face)
@ -279,7 +287,11 @@ LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep)
LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep)
{
LLFace *face;
face = new LLFace(this, mVObjp);
{
LLFastTimer t(FTM_ALLOCATE_FACE);
face = new LLFace(this, mVObjp);
}
face->setTEOffset(mFaces.size());
face->setTexture(texturep);

View File

@ -75,6 +75,7 @@ protected:
//-----------------------------------------------------------------------------
LL_ALIGN_PREFIX(16)
class LLDriverParam : public LLViewerVisualParam
{
friend class LLPhysicsMotion; // physics motion needs to access driven params directly.
@ -83,6 +84,16 @@ public:
LLDriverParam(LLWearable *wearablep);
~LLDriverParam();
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
// Special: These functions are overridden by child classes
LLDriverParamInfo* getInfo() const { return (LLDriverParamInfo*)mInfo; }
// This sets mInfo and calls initialization functions
@ -116,13 +127,13 @@ protected:
void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
LLVector4a mDefaultVec; // temp holder
LL_ALIGN_16(LLVector4a mDefaultVec); // temp holder
typedef std::vector<LLDrivenEntry> entry_list_t;
entry_list_t mDriven;
LLViewerVisualParam* mCurrentDistortionParam;
// Backlink only; don't make this an LLPointer.
LLVOAvatar* mAvatarp;
LLWearable* mWearablep;
};
} LL_ALIGN_POSTFIX(16);
#endif // LL_LLDRIVERPARAM_H

View File

@ -400,12 +400,24 @@ protected:
// LLPolySkeletalDeformation
// A set of joint scale data for deforming the avatar mesh
//-----------------------------------------------------------------------------
LL_ALIGN_PREFIX(16)
class LLPolySkeletalDistortion : public LLViewerVisualParam
{
public:
LLPolySkeletalDistortion(LLVOAvatar *avatarp);
~LLPolySkeletalDistortion();
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
// Special: These functions are overridden by child classes
LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
// This sets mInfo and calls initialization functions
@ -426,13 +438,14 @@ public:
/*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};
protected:
LL_ALIGN_16(LLVector4a mDefaultVec);
typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
joint_vec_map_t mJointScales;
joint_vec_map_t mJointOffsets;
LLVector4a mDefaultVec;
// Backlink only; don't make this an LLPointer.
LLVOAvatar *mAvatar;
};
} LL_ALIGN_POSTFIX(16);
#endif // LL_LLPOLYMESH_H

View File

@ -73,9 +73,11 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
{
const S32 numVertices = mNumIndices;
mCoords = new LLVector4a[numVertices];
mNormals = new LLVector4a[numVertices];
mBinormals = new LLVector4a[numVertices];
U32 size = sizeof(LLVector4a)*numVertices;
mCoords = (LLVector4a*) ll_aligned_malloc_16(size);
mNormals = (LLVector4a*) ll_aligned_malloc_16(size);
mBinormals = (LLVector4a*) ll_aligned_malloc_16(size);
mTexCoords = new LLVector2[numVertices];
mVertexIndices = new U32[numVertices];
@ -95,11 +97,12 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
//-----------------------------------------------------------------------------
LLPolyMorphData::~LLPolyMorphData()
{
delete [] mVertexIndices;
delete [] mCoords;
delete [] mNormals;
delete [] mBinormals;
ll_aligned_free_16(mCoords);
ll_aligned_free_16(mNormals);
ll_aligned_free_16(mBinormals);
delete [] mTexCoords;
delete [] mVertexIndices;
}
//-----------------------------------------------------------------------------
@ -121,9 +124,12 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
//-------------------------------------------------------------------------
// allocate vertices
//-------------------------------------------------------------------------
mCoords = new LLVector4a[numVertices];
mNormals = new LLVector4a[numVertices];
mBinormals = new LLVector4a[numVertices];
U32 size = sizeof(LLVector4a)*numVertices;
mCoords = (LLVector4a*) ll_aligned_malloc_16(size);
mNormals = (LLVector4a*) ll_aligned_malloc_16(size);
mBinormals = (LLVector4a*) ll_aligned_malloc_16(size);
mTexCoords = new LLVector2[numVertices];
// Actually, we are allocating more space than we need for the skiplist
mVertexIndices = new U32[numVertices];

View File

@ -41,6 +41,7 @@ class LLWearable;
//-----------------------------------------------------------------------------
// LLPolyMorphData()
//-----------------------------------------------------------------------------
LL_ALIGN_PREFIX(16)
class LLPolyMorphData
{
public:
@ -48,6 +49,16 @@ public:
~LLPolyMorphData();
LLPolyMorphData(const LLPolyMorphData &rhs);
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
BOOL loadBinary(LLFILE* fp, LLPolyMeshSharedData *mesh);
const std::string& getName() { return mName; }
@ -65,9 +76,9 @@ public:
F32 mTotalDistortion; // vertex distortion summed over entire morph
F32 mMaxDistortion; // maximum single vertex distortion in a given morph
LLVector4a mAvgDistortion; // average vertex distortion, to infer directionality of the morph
LL_ALIGN_16(LLVector4a mAvgDistortion); // average vertex distortion, to infer directionality of the morph
LLPolyMeshSharedData* mMesh;
};
} LL_ALIGN_POSTFIX(16);
//-----------------------------------------------------------------------------
// LLPolyVertexMask()

View File

@ -58,6 +58,7 @@ protected:
// LLTexLayerParamAlpha
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL_ALIGN_PREFIX(16)
class LLTexLayerParamAlpha : public LLTexLayerParam
{
public:
@ -65,6 +66,16 @@ public:
LLTexLayerParamAlpha( LLVOAvatar* avatar );
/*virtual*/ ~LLTexLayerParamAlpha();
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
// LLVisualParam Virtual functions
@ -94,7 +105,7 @@ private:
LLPointer<LLImageRaw> mStaticImageRaw;
BOOL mNeedsCreateTexture;
BOOL mStaticImageInvalid;
LLVector4a mAvgDistortionVec;
LL_ALIGN_16(LLVector4a mAvgDistortionVec);
F32 mCachedEffectiveWeight;
public:
@ -104,7 +115,7 @@ public:
typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t;
static param_alpha_ptr_list_t sInstances;
};
} LL_ALIGN_POSTFIX(16);
class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo
{
friend class LLTexLayerParamAlpha;
@ -128,6 +139,8 @@ private:
// LLTexLayerParamColor
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL_ALIGN_PREFIX(16)
class LLTexLayerParamColor : public LLTexLayerParam
{
public:
@ -141,6 +154,17 @@ public:
LLTexLayerParamColor( LLTexLayerInterface* layer );
LLTexLayerParamColor( LLVOAvatar* avatar );
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
/* virtual */ ~LLTexLayerParamColor();
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
@ -166,8 +190,8 @@ public:
protected:
virtual void onGlobalColorChanged(bool upload_bake) {}
private:
LLVector4a mAvgDistortionVec;
};
LL_ALIGN_16(LLVector4a mAvgDistortionVec);
} LL_ALIGN_POSTFIX(16);
class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo
{

View File

@ -65,6 +65,7 @@ protected:
// VIRTUAL CLASS
// a viewer side interface class for a generalized parametric modification of the avatar mesh
//-----------------------------------------------------------------------------
LL_ALIGN_PREFIX(16)
class LLViewerVisualParam : public LLVisualParam
{
public:
@ -104,6 +105,6 @@ public:
BOOL getCrossWearable() const { return getInfo()->mCrossWearable; }
};
} LL_ALIGN_POSTFIX(16);
#endif // LL_LLViewerVisualParam_H