[K/N] Reduce frame size by removing unused arena field.
This commit is contained in:
+1
-2
@@ -289,7 +289,6 @@ internal class CAdapterApiExporter(
|
|||||||
|} // extern "C"
|
|} // extern "C"
|
||||||
|
|
|
|
||||||
|struct ${prefix}_FrameOverlay {
|
|struct ${prefix}_FrameOverlay {
|
||||||
| void* arena;
|
|
||||||
| ${prefix}_FrameOverlay* previous;
|
| ${prefix}_FrameOverlay* previous;
|
||||||
| ${prefix}_KInt parameters;
|
| ${prefix}_KInt parameters;
|
||||||
| ${prefix}_KInt count;
|
| ${prefix}_KInt count;
|
||||||
@@ -406,4 +405,4 @@ private operator fun String.times(count: Int): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val KotlinType.shortNameForPredefinedType
|
private val KotlinType.shortNameForPredefinedType
|
||||||
get() = this.toString().split('.').last()
|
get() = this.toString().split('.').last()
|
||||||
|
|||||||
@@ -1022,10 +1022,6 @@ inline void traverseContainerReferredObjects(ContainerHeader* container, func pr
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
inline FrameOverlay* asFrameOverlay(ObjHeader** slot) {
|
|
||||||
return reinterpret_cast<FrameOverlay*>(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void lock(KInt* spinlock) {
|
inline void lock(KInt* spinlock) {
|
||||||
while (compareAndSwap(spinlock, 0, 1) != 0) {}
|
while (compareAndSwap(spinlock, 0, 1) != 0) {}
|
||||||
}
|
}
|
||||||
@@ -1763,39 +1759,6 @@ inline void releaseHeapRef(const ObjHeader* header) {
|
|||||||
releaseHeapRef<Strict, CanCollect>(const_cast<ContainerHeader*>(container));
|
releaseHeapRef<Strict, CanCollect>(const_cast<ContainerHeader*>(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: Consider removing this unused stuff.
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wunused-function"
|
|
||||||
|
|
||||||
// We use first slot as place to store frame-local arena container.
|
|
||||||
// TODO: create ArenaContainer object on the stack, so that we don't
|
|
||||||
// do two allocations per frame (ArenaContainer + actual container).
|
|
||||||
inline ArenaContainer* initedArena(ObjHeader** auxSlot) {
|
|
||||||
auto frame = asFrameOverlay(auxSlot);
|
|
||||||
auto arena = reinterpret_cast<ArenaContainer*>(frame->arena);
|
|
||||||
if (!arena) {
|
|
||||||
arena = std_support::allocator_new<ArenaContainer>(objectAllocator);
|
|
||||||
MEMORY_LOG("Initializing arena in %p\n", frame)
|
|
||||||
arena->Init();
|
|
||||||
frame->arena = arena;
|
|
||||||
}
|
|
||||||
return arena;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline container_size_t containerSize(const ContainerHeader* container) {
|
|
||||||
container_size_t result = 0;
|
|
||||||
const ObjHeader* obj = reinterpret_cast<const ObjHeader*>(container + 1);
|
|
||||||
for (uint32_t object = 0; object < container->objectCount(); object++) {
|
|
||||||
container_size_t size = objectSize(obj);
|
|
||||||
result += size;
|
|
||||||
obj = reinterpret_cast<ObjHeader*>(reinterpret_cast<uintptr_t>(obj) + size);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
||||||
#if USE_GC
|
#if USE_GC
|
||||||
void incrementStack(MemoryState* state) {
|
void incrementStack(MemoryState* state) {
|
||||||
FrameOverlay* frame = currentFrame;
|
FrameOverlay* frame = currentFrame;
|
||||||
|
|||||||
@@ -362,7 +362,6 @@ RUNTIME_NOTHROW void DisposeRegularWeakReferenceImpl(ObjHeader* counter);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct FrameOverlay {
|
struct FrameOverlay {
|
||||||
void* arena;
|
|
||||||
FrameOverlay* previous;
|
FrameOverlay* previous;
|
||||||
// As they go in pair, sizeof(FrameOverlay) % sizeof(void*) == 0 is always held.
|
// As they go in pair, sizeof(FrameOverlay) % sizeof(void*) == 0 is always held.
|
||||||
int32_t parameters;
|
int32_t parameters;
|
||||||
|
|||||||
Reference in New Issue
Block a user