mirror of
https://github.com/corda/corda.git
synced 2024-12-28 16:58:55 +00:00
eliminate conditional when calculating object size
This commit is contained in:
parent
38cea04322
commit
f698d347ac
25
src/vm.cpp
25
src/vm.cpp
@ -492,14 +492,10 @@ 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_)) {
|
* cast<uint32_t>(p, classFixedSize(t, class_) - 4),
|
||||||
n += divide(classArrayElementSize(t, class_)
|
BytesPerWord);
|
||||||
* cast<uint32_t>(p, classFixedSize(t, class_) - 4),
|
|
||||||
BytesPerWord);
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void walk(void* p, Heap::Walker* w) {
|
virtual void walk(void* p, Heap::Walker* w) {
|
||||||
@ -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_)) {
|
* cast<uint32_t>(o, classFixedSize(t, class_) - 4),
|
||||||
n += divide(classArrayElementSize(t, class_)
|
BytesPerWord);
|
||||||
* cast<uint32_t>(o, classFixedSize(t, class_) - 4),
|
|
||||||
BytesPerWord);
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object
|
object
|
||||||
|
Loading…
Reference in New Issue
Block a user