94%, core1/memory.c _heap_sortEmptyBlock() done

This commit is contained in:
Banjo Kazooie
2022-11-09 15:29:21 -06:00
parent 486b0b532c
commit d9ef3648ca
4 changed files with 8 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
# banjo (93.9924%) # banjo (94.0107%)
<img src="./progress/progress_total.svg"> <img src="./progress/progress_total.svg">

View File

@@ -17,7 +17,7 @@
<text x="22.0" y="14">core1</text> <text x="22.0" y="14">core1</text>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="78.5" y="15" fill="#010101" fill-opacity=".3">88.5362%</text> <text x="78.5" y="15" fill="#010101" fill-opacity=".3">88.6623%</text>
<text x="77.5" y="14">88.5362%</text> <text x="77.5" y="14">88.6623%</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -17,7 +17,7 @@
<text x="75.0" y="14">Banjo-Kazooie (us.v10)</text> <text x="75.0" y="14">Banjo-Kazooie (us.v10)</text>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="184.5" y="15" fill="#010101" fill-opacity=".3">93.9924%</text> <text x="184.5" y="15" fill="#010101" fill-opacity=".3">94.0107%</text>
<text x="183.5" y="14">93.9924%</text> <text x="183.5" y="14">94.0107%</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -430,17 +430,13 @@ void func_80254F90(void){
} }
} }
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core1/memory/_heap_sortEmptyBlock.s")
#else
//moves empty block (arg0) to keep empty block list sorted by size
void _heap_sortEmptyBlock(EmptyHeapBlock * arg0){ void _heap_sortEmptyBlock(EmptyHeapBlock * arg0){
EmptyHeapBlock *v0 = arg0; EmptyHeapBlock *v0 = arg0;
EmptyHeapBlock *v1; EmptyHeapBlock *v1;
EmptyHeapBlock *a2 = &D_8002D500[LAST_HEAP_BLOCK]; EmptyHeapBlock *a2 = &D_8002D500[LAST_HEAP_BLOCK];
//move arg0 back while larger than next //move arg0 back while larger than next
while( arg0->next_free < a2 while( arg0->next_free < &D_8002D500[LAST_HEAP_BLOCK]
&& (s32)chunkSize(&v0->next_free->hdr) + 0x10 < (s32)chunkSize(&v0->hdr) + 0x10 && (s32)chunkSize(&v0->next_free->hdr) + 0x10 < (s32)chunkSize(&v0->hdr) + 0x10
){ ){
v1 = arg0->next_free; v1 = arg0->next_free;
@@ -453,10 +449,11 @@ void _heap_sortEmptyBlock(EmptyHeapBlock * arg0){
} }
//move arg0 foward while smaller prev //move arg0 foward while smaller prev
while( ( arg0->prev_free >= (EmptyHeapBlock *)((u8*)D_8002D500 + 1)) while( ( (v1 = arg0->prev_free) > &D_8002D500[0])
&& (s32)chunkSize(&v0->hdr) + 0x10 < (s32)chunkSize(&v0->prev_free->hdr) + 0x10 && (s32)chunkSize(&v0->hdr) + 0x10 < (s32)chunkSize(&v0->prev_free->hdr) + 0x10
){ ){
a2 = arg0->prev_free; a2 = arg0->prev_free;
arg0->next_free->prev_free = a2; arg0->next_free->prev_free = a2;
a2->next_free = arg0->next_free; a2->next_free = arg0->next_free;
arg0->next_free = a2; arg0->next_free = a2;
@@ -465,7 +462,6 @@ void _heap_sortEmptyBlock(EmptyHeapBlock * arg0){
a2->prev_free = arg0; a2->prev_free = arg0;
} }
} }
#endif
void free(void * ptr){ void free(void * ptr){
HeapHeader *sPtr; //stack_ptr HeapHeader *sPtr; //stack_ptr