public:
Thread(const PlatformThread& platThread, void* base)
: platformThread(platThread)
public:
Thread(const PlatformThread& platThread, void* base)
: platformThread(platThread)
- if (m_threadSpecific) {
- int error = pthread_key_delete(m_threadSpecific);
- ASSERT_UNUSED(error, !error);
- }
+ if (m_threadSpecific)
+ threadSpecificKeyDelete(m_threadSpecific);
MutexLocker registeredThreadsLock(m_registeredThreadsMutex);
for (Thread* t = m_registeredThreads; t;) {
MutexLocker registeredThreadsLock(m_registeredThreadsMutex);
for (Thread* t = m_registeredThreads; t;) {
Thread* thread = new Thread(getCurrentPlatformThread(), wtfThreadData().stack().origin());
MutexLocker lock(m_registeredThreadsMutex);
Thread* thread = new Thread(getCurrentPlatformThread(), wtfThreadData().stack().origin());
MutexLocker lock(m_registeredThreadsMutex);
typedef ppc_thread_state64_t PlatformThreadRegisters;
#elif CPU(ARM)
typedef arm_thread_state_t PlatformThreadRegisters;
typedef ppc_thread_state64_t PlatformThreadRegisters;
#elif CPU(ARM)
typedef arm_thread_state_t PlatformThreadRegisters;
- regs.tid = pthread_self();
- int fd = open("/proc/self", O_RDONLY);
+ regs.tid = platformThread;
+ // FIXME: If we find this hurts performance, we can consider caching the fd and keeping it open.
+ int fd = open("/proc/self/as", O_RDONLY);
- LOG_ERROR("Unable to open /proc/self (errno: %d)", errno);
+ LOG_ERROR("Unable to open /proc/self/as (errno: %d)", errno);
+ CRASH();
+ }
+ int rc = devctl(fd, DCMD_PROC_TIDSTATUS, ®s, sizeof(regs), 0);
+ if (rc != EOK) {
+ LOG_ERROR("devctl(DCMD_PROC_TIDSTATUS) failed (error: %d)", rc);
PlatformThreadRegisters regs;
size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs);
PlatformThreadRegisters regs;
size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs);
swapIfBackwards(stackPointer, stackBase);
conservativeRoots.add(stackPointer, stackBase);
swapIfBackwards(stackPointer, stackBase);
conservativeRoots.add(stackPointer, stackBase);
// It is safe to access the registeredThreads list, because we earlier asserted that locks are being held,
// and since this is a shared heap, they are real locks.
for (Thread* thread = m_registeredThreads; thread; thread = thread->next) {
if (!equalThread(thread->platformThread, currentPlatformThread))
gatherFromOtherThread(conservativeRoots, thread);
}
// It is safe to access the registeredThreads list, because we earlier asserted that locks are being held,
// and since this is a shared heap, they are real locks.
for (Thread* thread = m_registeredThreads; thread; thread = thread->next) {
if (!equalThread(thread->platformThread, currentPlatformThread))
gatherFromOtherThread(conservativeRoots, thread);
}