mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
rename mask -> maskAlignedPointer
This commit is contained in:
parent
d26d8fdb9f
commit
2a1834e48a
@ -483,7 +483,7 @@ cast(void* p, unsigned offset)
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T*
|
inline T*
|
||||||
mask(T* p)
|
maskAlignedPointer(T* p)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & PointerMask);
|
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & PointerMask);
|
||||||
}
|
}
|
||||||
|
22
src/heap.cpp
22
src/heap.cpp
@ -80,7 +80,7 @@ markBitAtomic(uintptr_t* map, unsigned i)
|
|||||||
inline void*
|
inline void*
|
||||||
get(void* o, unsigned offsetInWords)
|
get(void* o, unsigned offsetInWords)
|
||||||
{
|
{
|
||||||
return mask(cast<void*>(o, offsetInWords * BytesPerWord));
|
return maskAlignedPointer(cast<void*>(o, offsetInWords * BytesPerWord));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void**
|
inline void**
|
||||||
@ -1179,12 +1179,12 @@ updateHeapMap(Context* c, void* p, void* target, unsigned offset, void* result)
|
|||||||
void*
|
void*
|
||||||
update(Context* c, void** p, void* target, unsigned offset, bool* needsVisit)
|
update(Context* c, void** p, void* target, unsigned offset, bool* needsVisit)
|
||||||
{
|
{
|
||||||
if (mask(*p) == 0) {
|
if (maskAlignedPointer(*p) == 0) {
|
||||||
*needsVisit = false;
|
*needsVisit = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* result = update2(c, mask(*p), needsVisit);
|
void* result = update2(c, maskAlignedPointer(*p), needsVisit);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
updateHeapMap(c, p, target, offset, result);
|
updateHeapMap(c, p, target, offset, result);
|
||||||
@ -1297,20 +1297,20 @@ bitsetNext(Context* c, uintptr_t* p)
|
|||||||
void
|
void
|
||||||
collect(Context* c, void** p, void* target, unsigned offset)
|
collect(Context* c, void** p, void* target, unsigned offset)
|
||||||
{
|
{
|
||||||
void* original = mask(*p);
|
void* original = maskAlignedPointer(*p);
|
||||||
void* parent_ = 0;
|
void* parent_ = 0;
|
||||||
|
|
||||||
if (Debug) {
|
if (Debug) {
|
||||||
fprintf(stderr, "update %p (%s) at %p (%s)\n",
|
fprintf(stderr, "update %p (%s) at %p (%s)\n",
|
||||||
mask(*p), segment(c, *p), p, segment(c, p));
|
maskAlignedPointer(*p), segment(c, *p), p, segment(c, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needsVisit;
|
bool needsVisit;
|
||||||
local::set(p, update(c, mask(p), target, offset, &needsVisit));
|
local::set(p, update(c, maskAlignedPointer(p), target, offset, &needsVisit));
|
||||||
|
|
||||||
if (Debug) {
|
if (Debug) {
|
||||||
fprintf(stderr, " result: %p (%s) (visit? %d)\n",
|
fprintf(stderr, " result: %p (%s) (visit? %d)\n",
|
||||||
mask(*p), segment(c, *p), needsVisit);
|
maskAlignedPointer(*p), segment(c, *p), needsVisit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not needsVisit) return;
|
if (not needsVisit) return;
|
||||||
@ -1966,10 +1966,10 @@ class MyHeap: public Heap {
|
|||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
for (unsigned i = 0; i < count; ++i) {
|
for (unsigned i = 0; i < count; ++i) {
|
||||||
void** target = static_cast<void**>(p) + offset + i;
|
void** target = static_cast<void**>(p) + offset + i;
|
||||||
if (targetNeedsMark(mask(*target))) {
|
if (targetNeedsMark(maskAlignedPointer(*target))) {
|
||||||
if (DebugFixies) {
|
if (DebugFixies) {
|
||||||
fprintf(stderr, "dirty fixie %p at %d (%p): %p\n",
|
fprintf(stderr, "dirty fixie %p at %d (%p): %p\n",
|
||||||
f, offset, f->body() + offset, mask(*target));
|
f, offset, f->body() + offset, maskAlignedPointer(*target));
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = true;
|
dirty = true;
|
||||||
@ -1994,7 +1994,7 @@ class MyHeap: public Heap {
|
|||||||
|
|
||||||
for (unsigned i = 0; i < count; ++i) {
|
for (unsigned i = 0; i < count; ++i) {
|
||||||
void** target = static_cast<void**>(p) + offset + i;
|
void** target = static_cast<void**>(p) + offset + i;
|
||||||
if (targetNeedsMark(mask(*target))) {
|
if (targetNeedsMark(maskAlignedPointer(*target))) {
|
||||||
#ifdef USE_ATOMIC_OPERATIONS
|
#ifdef USE_ATOMIC_OPERATIONS
|
||||||
map->markAtomic(target);
|
map->markAtomic(target);
|
||||||
#else
|
#else
|
||||||
@ -2041,7 +2041,7 @@ class MyHeap: public Heap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual Status status(void* p) {
|
virtual Status status(void* p) {
|
||||||
p = mask(p);
|
p = maskAlignedPointer(p);
|
||||||
|
|
||||||
if (p == 0) {
|
if (p == 0) {
|
||||||
return Null;
|
return Null;
|
||||||
|
@ -2763,7 +2763,7 @@ class HeapClient: public Heap::Client {
|
|||||||
virtual unsigned sizeInWords(void* p) {
|
virtual unsigned sizeInWords(void* p) {
|
||||||
Thread* t = m->rootThread;
|
Thread* t = m->rootThread;
|
||||||
|
|
||||||
object o = static_cast<object>(m->heap->follow(mask(p)));
|
object o = static_cast<object>(m->heap->follow(maskAlignedPointer(p)));
|
||||||
|
|
||||||
unsigned n = baseSize(t, o, static_cast<object>
|
unsigned n = baseSize(t, o, static_cast<object>
|
||||||
(m->heap->follow(objectClass(t, o))));
|
(m->heap->follow(objectClass(t, o))));
|
||||||
@ -2778,7 +2778,7 @@ class HeapClient: public Heap::Client {
|
|||||||
virtual unsigned copiedSizeInWords(void* p) {
|
virtual unsigned copiedSizeInWords(void* p) {
|
||||||
Thread* t = m->rootThread;
|
Thread* t = m->rootThread;
|
||||||
|
|
||||||
object o = static_cast<object>(m->heap->follow(mask(p)));
|
object o = static_cast<object>(m->heap->follow(maskAlignedPointer(p)));
|
||||||
assert(t, not objectFixed(t, o));
|
assert(t, not objectFixed(t, o));
|
||||||
|
|
||||||
unsigned n = baseSize(t, o, static_cast<object>
|
unsigned n = baseSize(t, o, static_cast<object>
|
||||||
@ -2794,7 +2794,7 @@ class HeapClient: public Heap::Client {
|
|||||||
virtual void copy(void* srcp, void* dstp) {
|
virtual void copy(void* srcp, void* dstp) {
|
||||||
Thread* t = m->rootThread;
|
Thread* t = m->rootThread;
|
||||||
|
|
||||||
object src = static_cast<object>(m->heap->follow(mask(srcp)));
|
object src = static_cast<object>(m->heap->follow(maskAlignedPointer(srcp)));
|
||||||
assert(t, not objectFixed(t, src));
|
assert(t, not objectFixed(t, src));
|
||||||
|
|
||||||
object class_ = static_cast<object>
|
object class_ = static_cast<object>
|
||||||
@ -2815,7 +2815,7 @@ class HeapClient: public Heap::Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void walk(void* p, Heap::Walker* w) {
|
virtual void walk(void* p, Heap::Walker* w) {
|
||||||
object o = static_cast<object>(m->heap->follow(mask(p)));
|
object o = static_cast<object>(m->heap->follow(maskAlignedPointer(p)));
|
||||||
::walk(m->rootThread, w, o, 0);
|
::walk(m->rootThread, w, o, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1611,7 +1611,7 @@ typedef uint64_t (JNICALL *FastNativeFunction)(Thread*, object, uintptr_t*);
|
|||||||
inline object
|
inline object
|
||||||
objectClass(Thread*, object o)
|
objectClass(Thread*, object o)
|
||||||
{
|
{
|
||||||
return mask(cast<object>(o, 0));
|
return maskAlignedPointer(cast<object>(o, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned
|
inline unsigned
|
||||||
|
Loading…
Reference in New Issue
Block a user