MCPcopy Create free account
hub / github.com/Samsung/rlottie / allocObjectWithFooter

Method allocObjectWithFooter

src/vector/varenaalloc.cpp:140–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140char* VArenaAlloc::allocObjectWithFooter(uint32_t sizeIncludingFooter, uint32_t alignment) {
141 uintptr_t mask = alignment - 1;
142
143restart:
144 uint32_t skipOverhead = 0;
145 bool needsSkipFooter = fCursor != fDtorCursor;
146 if (needsSkipFooter) {
147 skipOverhead = sizeof(Footer) + sizeof(uint32_t);
148 }
149 char* objStart = (char*)((uintptr_t)(fCursor + skipOverhead + mask) & ~mask);
150 uint32_t totalSize = sizeIncludingFooter + skipOverhead;
151 //std::cout<<"non POD object size = "<<totalSize<<"\n";
152 if ((ptrdiff_t)totalSize > fEnd - objStart) {
153 this->ensureSpace(totalSize, alignment);
154 goto restart;
155 }
156
157 AssertRelease((ptrdiff_t)totalSize <= fEnd - objStart);
158
159 // Install a skip footer if needed, thus terminating a run of POD data. The calling code is
160 // responsible for installing the footer after the object.
161 if (needsSkipFooter) {
162 this->installUint32Footer(SkipPod, ToU32(fCursor - fDtorCursor), 0);
163 }
164
165 return objStart;
166}

Callers 2

makeMethod · 0.95
commonArrayAllocMethod · 0.95

Calls 2

ensureSpaceMethod · 0.95
installUint32FooterMethod · 0.95

Tested by

no test coverage detected