forked from OSchip/llvm-project
Change size of reference count field in __libcpp_nmstr from 32 bits to 64 bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2.
llvm-svn: 161497
This commit is contained in:
parent
2c2b55f27f
commit
d79842c2bf
|
@ -34,7 +34,7 @@ private:
|
||||||
const char* str_;
|
const char* str_;
|
||||||
|
|
||||||
typedef std::size_t unused_t;
|
typedef std::size_t unused_t;
|
||||||
typedef std::int32_t count_t;
|
typedef std::ptrdiff_t count_t;
|
||||||
|
|
||||||
static const std::ptrdiff_t offset = static_cast<std::ptrdiff_t>(2*sizeof(unused_t) +
|
static const std::ptrdiff_t offset = static_cast<std::ptrdiff_t>(2*sizeof(unused_t) +
|
||||||
sizeof(count_t));
|
sizeof(count_t));
|
||||||
|
@ -72,7 +72,7 @@ __libcpp_nmstr::operator=(const __libcpp_nmstr& s)
|
||||||
const char* p = str_;
|
const char* p = str_;
|
||||||
str_ = s.str_;
|
str_ = s.str_;
|
||||||
__sync_add_and_fetch(&count(), 1);
|
__sync_add_and_fetch(&count(), 1);
|
||||||
if (__sync_add_and_fetch((count_t*)(p-sizeof(count_t)), -1) < 0)
|
if (__sync_add_and_fetch((count_t*)(p-sizeof(count_t)), count_t(-1)) < 0)
|
||||||
delete [] (p-offset);
|
delete [] (p-offset);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ __libcpp_nmstr::operator=(const __libcpp_nmstr& s)
|
||||||
inline
|
inline
|
||||||
__libcpp_nmstr::~__libcpp_nmstr()
|
__libcpp_nmstr::~__libcpp_nmstr()
|
||||||
{
|
{
|
||||||
if (__sync_add_and_fetch(&count(), -1) < 0)
|
if (__sync_add_and_fetch(&count(), count_t(-1)) < 0)
|
||||||
delete [] (str_ - offset);
|
delete [] (str_ - offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue