mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
optimize common case of setting a single object field so we don't acquire the heap lock unnecessarily
This commit is contained in:
parent
1d7b00baff
commit
18d25468fe
@ -1709,6 +1709,11 @@ class MyHeap: public Heap {
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool needsMark(void* p, unsigned offset) {
|
||||
return needsMark(p) and targetNeedsMark
|
||||
(mask(*(static_cast<void**>(p) + offset)));
|
||||
}
|
||||
|
||||
bool targetNeedsMark(void* target) {
|
||||
return target
|
||||
and not c.gen2.contains(target)
|
||||
|
@ -62,6 +62,7 @@ class Heap: public Allocator {
|
||||
virtual void* allocateImmortal(Allocator* allocator, unsigned sizeInWords,
|
||||
bool objectMask, unsigned* totalInBytes) = 0;
|
||||
virtual bool needsMark(void* p) = 0;
|
||||
virtual bool needsMark(void* p, unsigned offset) = 0;
|
||||
virtual void mark(void* p, unsigned offset, unsigned count) = 0;
|
||||
virtual void pad(void* p) = 0;
|
||||
virtual void* follow(void* p) = 0;
|
||||
|
@ -1487,7 +1487,10 @@ mark(Thread* t, object o, unsigned offset, unsigned count)
|
||||
inline void
|
||||
mark(Thread* t, object o, unsigned offset)
|
||||
{
|
||||
mark(t, o, offset, 1);
|
||||
if (t->m->heap->needsMark(o, offset / BytesPerWord)) {
|
||||
ACQUIRE_RAW(t, t->m->heapLock);
|
||||
t->m->heap->mark(o, offset / BytesPerWord, 1);
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
|
Loading…
Reference in New Issue
Block a user