mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
eliminate conditional when calculating object size
This commit is contained in:
parent
38cea04322
commit
f698d347ac
17
src/vm.cpp
17
src/vm.cpp
@ -492,15 +492,11 @@ collect(Machine* m, Heap::CollectionType type)
|
|||||||
p = m->heap->follow(mask(p));
|
p = m->heap->follow(mask(p));
|
||||||
object class_ = m->heap->follow(objectClass(t, p));
|
object class_ = m->heap->follow(objectClass(t, p));
|
||||||
|
|
||||||
unsigned n = divide(classFixedSize(t, class_), BytesPerWord);
|
return divide(classFixedSize(t, class_), BytesPerWord)
|
||||||
|
+ divide(classArrayElementSize(t, class_)
|
||||||
if (classArrayElementSize(t, class_)) {
|
|
||||||
n += divide(classArrayElementSize(t, class_)
|
|
||||||
* cast<uint32_t>(p, classFixedSize(t, class_) - 4),
|
* cast<uint32_t>(p, classFixedSize(t, class_) - 4),
|
||||||
BytesPerWord);
|
BytesPerWord);
|
||||||
}
|
}
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void walk(void* p, Heap::Walker* w) {
|
virtual void walk(void* p, Heap::Walker* w) {
|
||||||
Thread* t = m->rootThread;
|
Thread* t = m->rootThread;
|
||||||
@ -764,15 +760,10 @@ objectSize(Thread* t, object o)
|
|||||||
{
|
{
|
||||||
object class_ = objectClass(t, o);
|
object class_ = objectClass(t, o);
|
||||||
|
|
||||||
unsigned n = divide(classFixedSize(t, class_), BytesPerWord);
|
return divide(classFixedSize(t, class_), BytesPerWord)
|
||||||
|
+ divide(classArrayElementSize(t, class_)
|
||||||
if (classArrayElementSize(t, class_)) {
|
|
||||||
n += divide(classArrayElementSize(t, class_)
|
|
||||||
* cast<uint32_t>(o, classFixedSize(t, class_) - 4),
|
* cast<uint32_t>(o, classFixedSize(t, class_) - 4),
|
||||||
BytesPerWord);
|
BytesPerWord);
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object
|
object
|
||||||
|
Loading…
Reference in New Issue
Block a user