Inlined several VMCache methods.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34837 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1021fd2826
commit
355dc6bef4
|
@ -10,6 +10,7 @@
|
|||
#define _KERNEL_VM_VM_CACHE_H
|
||||
|
||||
|
||||
#include <debug.h>
|
||||
#include <kernel.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_types.h>
|
||||
|
@ -69,23 +70,17 @@ public:
|
|||
|
||||
virtual void Delete();
|
||||
|
||||
bool Lock()
|
||||
{ return mutex_lock(&fLock) == B_OK; }
|
||||
bool TryLock()
|
||||
{ return mutex_trylock(&fLock) == B_OK; }
|
||||
bool SwitchLock(mutex* from)
|
||||
{ return mutex_switch_lock(from, &fLock)
|
||||
== B_OK; }
|
||||
inline bool Lock();
|
||||
inline bool TryLock();
|
||||
inline bool SwitchLock(mutex* from);
|
||||
void Unlock();
|
||||
void AssertLocked()
|
||||
{ ASSERT_LOCKED_MUTEX(&fLock); }
|
||||
inline void AssertLocked();
|
||||
|
||||
void AcquireRefLocked();
|
||||
void AcquireRef();
|
||||
void ReleaseRefLocked();
|
||||
void ReleaseRef();
|
||||
void ReleaseRefAndUnlock()
|
||||
{ ReleaseRefLocked(); Unlock(); }
|
||||
inline void AcquireRefLocked();
|
||||
inline void AcquireRef();
|
||||
inline void ReleaseRefLocked();
|
||||
inline void ReleaseRef();
|
||||
inline void ReleaseRefAndUnlock();
|
||||
|
||||
void WaitForPageEvents(vm_page* page, uint32 events,
|
||||
bool relock);
|
||||
|
@ -203,6 +198,79 @@ public:
|
|||
};
|
||||
|
||||
|
||||
|
||||
bool
|
||||
VMCache::Lock()
|
||||
{
|
||||
return mutex_lock(&fLock) == B_OK;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
VMCache::TryLock()
|
||||
{
|
||||
return mutex_trylock(&fLock) == B_OK;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
VMCache::SwitchLock(mutex* from)
|
||||
{
|
||||
return mutex_switch_lock(from, &fLock) == B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::AssertLocked()
|
||||
{
|
||||
ASSERT_LOCKED_MUTEX(&fLock);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::AcquireRefLocked()
|
||||
{
|
||||
ASSERT_LOCKED_MUTEX(&fLock);
|
||||
|
||||
fRefCount++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::AcquireRef()
|
||||
{
|
||||
Lock();
|
||||
fRefCount++;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::ReleaseRefLocked()
|
||||
{
|
||||
ASSERT_LOCKED_MUTEX(&fLock);
|
||||
|
||||
fRefCount--;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::ReleaseRef()
|
||||
{
|
||||
Lock();
|
||||
fRefCount--;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::ReleaseRefAndUnlock()
|
||||
{
|
||||
ReleaseRefLocked();
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include <arch/cpu.h>
|
||||
#include <condition_variable.h>
|
||||
#include <debug.h>
|
||||
#include <heap.h>
|
||||
#include <int.h>
|
||||
#include <kernel.h>
|
||||
|
@ -679,44 +678,6 @@ VMCache::Unlock()
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::AcquireRefLocked()
|
||||
{
|
||||
// TODO: Inline!
|
||||
ASSERT_LOCKED_MUTEX(&fLock);
|
||||
|
||||
fRefCount++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::AcquireRef()
|
||||
{
|
||||
Lock();
|
||||
fRefCount++;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::ReleaseRefLocked()
|
||||
{
|
||||
// TODO: Inline!
|
||||
ASSERT_LOCKED_MUTEX(&fLock);
|
||||
|
||||
fRefCount--;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VMCache::ReleaseRef()
|
||||
{
|
||||
Lock();
|
||||
fRefCount--;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
vm_page*
|
||||
VMCache::LookupPage(off_t offset)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue