From 430444b10237abd37eb8157c3f84509a7d9636f8 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Fri, 19 Jun 2009 23:16:19 +0000 Subject: Fix a serious bug that would cause deadlock during abstract type refinement. The constant creation gets involved, and we end up trying to recursively acquire a writer lock. The fix for this is slightly horrible, and involves passing a boolean "locked" parameter around in Constants.cpp, but it's better than having locked and unlocked versions of most of the code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73790 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Constant.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/llvm/Constant.h') diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h index d4949d1a0f..613e24ca15 100644 --- a/include/llvm/Constant.h +++ b/include/llvm/Constant.h @@ -61,7 +61,7 @@ protected: public: /// Static constructor to get a '0' constant of arbitrary type... /// - static Constant *getNullValue(const Type *Ty); + static Constant *getNullValue(const Type *Ty, bool locked = true); /// Static constructor to get a '-1' constant. This supports integers and /// vectors. @@ -107,7 +107,9 @@ public: /// available cached constants. Implementations should call /// destroyConstantImpl as the last thing they do, to destroy all users and /// delete this. - virtual void destroyConstant() { assert(0 && "Not reached!"); } + virtual void destroyConstant(bool locked = true) { + assert(0 && "Not reached!"); + } //// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Constant *) { return true; } -- cgit v1.2.3