progress towards thread support

This includes support for using the least significant bits of the class
pointer to indicate object state, which we'll use to indicate the
presence of a monitor pointer, among other things.
This commit is contained in:
Joel Dice
2007-07-01 15:34:22 -06:00
parent 051e3bc7a8
commit 38cea04322
9 changed files with 282 additions and 103 deletions

View File

@ -26,6 +26,9 @@ typedef void* object;
const unsigned BytesPerWord = sizeof(uintptr_t);
const unsigned BitsPerWord = BytesPerWord * 8;
const uintptr_t PointerMask
= ((~static_cast<uintptr_t>(0)) / BytesPerWord) * BytesPerWord;
const unsigned LikelyPageSizeInBytes = 4 * 1024;
inline unsigned
@ -109,6 +112,13 @@ cast(object p, unsigned offset)
return *reinterpret_cast<T*>(static_cast<uint8_t*>(p) + offset);
}
template <class T>
inline T*
mask(T* p)
{
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & PointerMask);
}
}
#endif//COMMON_H