some small JKRExpHeap progress

This commit is contained in:
Joshua Andrew 2023-08-01 23:05:00 -04:00
parent 0dca950d00
commit 7fc41269ab
7 changed files with 79 additions and 9 deletions

View File

@ -50,10 +50,10 @@ __pp__30JSUListIterator<11JKRDisposer>Fi,JKRHeap.o,JKernel.a,true
createRoot__10JKRExpHeapFib,JKRExpHeap.o,JKernel.a,true
create__10JKRExpHeapFUlP7JKRHeapb,JKRExpHeap.o,JKernel.a,false
create__10JKRExpHeapFPvUlP7JKRHeapb,JKRExpHeap.o,JKernel.a,false
do_destroy__10JKRExpHeapFv,JKRExpHeap.o,JKernel.a,false
do_destroy__10JKRExpHeapFv,JKRExpHeap.o,JKernel.a,true
__ct__10JKRExpHeapFPvUlP7JKRHeapb,JKRExpHeap.o,JKernel.a,true
__dt__10JKRExpHeapFv,JKRExpHeap.o,JKernel.a,false
do_alloc__10JKRExpHeapFUli,JKRExpHeap.o,JKernel.a,false
do_alloc__10JKRExpHeapFUli,JKRExpHeap.o,JKernel.a,true
allocFromHead__10JKRExpHeapFUli,JKRExpHeap.o,JKernel.a,false
allocFromHead__10JKRExpHeapFUl,JKRExpHeap.o,JKernel.a,false
allocFromTail__10JKRExpHeapFUli,JKRExpHeap.o,JKernel.a,false

1 Symbol Name Object File Library Archive Matching
50 createRoot__10JKRExpHeapFib JKRExpHeap.o JKernel.a true
51 create__10JKRExpHeapFUlP7JKRHeapb JKRExpHeap.o JKernel.a false
52 create__10JKRExpHeapFPvUlP7JKRHeapb JKRExpHeap.o JKernel.a false
53 do_destroy__10JKRExpHeapFv JKRExpHeap.o JKernel.a false true
54 __ct__10JKRExpHeapFPvUlP7JKRHeapb JKRExpHeap.o JKernel.a true
55 __dt__10JKRExpHeapFv JKRExpHeap.o JKernel.a false
56 do_alloc__10JKRExpHeapFUli JKRExpHeap.o JKernel.a false true
57 allocFromHead__10JKRExpHeapFUli JKRExpHeap.o JKernel.a false
58 allocFromHead__10JKRExpHeapFUl JKRExpHeap.o JKernel.a false
59 allocFromTail__10JKRExpHeapFUli JKRExpHeap.o JKernel.a false

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "JSystem",
"message": "3.352%",
"message": "3.461%",
"color": "blue"
}

View File

@ -6,7 +6,7 @@
| [J3DGraphLoader](https://github.com/shibbo/Petari/blob/master/libs/JSystem/docs/lib/J3DGraphLoader.md) | 0.0% |
| [JAudio2](https://github.com/shibbo/Petari/blob/master/libs/JSystem/docs/lib/JAudio2.md) | 0.0% |
| [JGadget](https://github.com/shibbo/Petari/blob/master/libs/JSystem/docs/lib/JGadget.md) | 0.0% |
| [JKernel](https://github.com/shibbo/Petari/blob/master/libs/JSystem/docs/lib/JKernel.md) | 19.501442770118626% |
| [JKernel](https://github.com/shibbo/Petari/blob/master/libs/JSystem/docs/lib/JKernel.md) | 20.2949663353639% |
| [JMath](https://github.com/shibbo/Petari/blob/master/libs/JSystem/docs/lib/JMath.md) | 0.0% |
| [JParticle](https://github.com/shibbo/Petari/blob/master/libs/JSystem/docs/lib/JParticle.md) | 0.0% |
| [JSupport](https://github.com/shibbo/Petari/blob/master/libs/JSystem/docs/lib/JSupport.md) | 57.63411279229711% |

View File

@ -9,7 +9,7 @@
| Object | Percentage (of Bytes) | Functions Done / Total Functions | Percentage (Functions) | Status
| ------------- | ------------- | ------------- | ------------- | -------------
| JKRHeap.o | 65.04065040650406% | 43 / 48 | 89.58333333333334% | :eight_pointed_black_star:
| JKRExpHeap.o | 6.845407872219053% | 6 / 40 | 15.0% | :eight_pointed_black_star:
| JKRExpHeap.o | 12.492869366799772% | 8 / 40 | 20.0% | :eight_pointed_black_star:
| JKRSolidHeap.o | 0.0% | 0 / 20 | 0.0% | :x:
| JKRUnitHeap.o | 0.0% | 0 / 26 | 0.0% | :x:
| JKRDisposer.o | 100.0% | 3 / 3 | 100.0% | :white_check_mark:
@ -92,10 +92,10 @@
| createRoot__10JKRExpHeapFib | :white_check_mark: |
| create__10JKRExpHeapFUlP7JKRHeapb | :x: |
| create__10JKRExpHeapFPvUlP7JKRHeapb | :x: |
| do_destroy__10JKRExpHeapFv | :x: |
| do_destroy__10JKRExpHeapFv | :white_check_mark: |
| __ct__10JKRExpHeapFPvUlP7JKRHeapb | :white_check_mark: |
| __dt__10JKRExpHeapFv | :x: |
| do_alloc__10JKRExpHeapFUli | :x: |
| do_alloc__10JKRExpHeapFUli | :white_check_mark: |
| allocFromHead__10JKRExpHeapFUli | :x: |
| allocFromHead__10JKRExpHeapFUl | :x: |
| allocFromTail__10JKRExpHeapFUli | :x: |

View File

@ -44,6 +44,11 @@ public:
virtual void state_register(TState *, u32) const;
virtual bool state_compare(const TState &, const TState &) const;
void* allocFromHead(u32);
void* allocFromHead(u32, int);
void* allocFromTail(u32);
void* allocFromTail(u32, int);
static JKRExpHeap* create(void *, u32, JKRHeap *, bool);
static JKRExpHeap* create(u32, JKRHeap *, bool);

View File

@ -0,0 +1,8 @@
#pragma once
void JUTWarningConsole_f(const char *, ...);
class JUTConsole {
public:
static void print_f(const char *, ...);
};

View File

@ -1,8 +1,7 @@
#include "JSystem/JKernel/JKRExpHeap.h"
#include "JSystem/JUtility/JUTConsole.h"
#include <new>
JKRExpHeap* JKRExpHeap::createRoot(int heapNum, bool a2) {
JKRExpHeap* heap = nullptr;
@ -20,6 +19,64 @@ JKRExpHeap* JKRExpHeap::createRoot(int heapNum, bool a2) {
return heap;
}
void JKRExpHeap::do_destroy() {
if (_6E) {
JKRHeap* heap = mChildTree.getParent()->getObject();
if (heap != nullptr) {
this->~JKRExpHeap();
JKRHeap::free(this, heap);
}
}
else {
this->~JKRExpHeap();
}
}
void* JKRExpHeap::do_alloc(u32 size, int align) {
void* ptr;
OSLockMutex(&mMutex);
if (size < 4) {
size = 4;
}
if (align >= 0) {
if (align <= 4) {
ptr = allocFromHead(size);
}
else {
ptr = allocFromHead(size, align);
}
}
else {
if (-align <= 4) {
ptr = allocFromTail(size);
}
else {
ptr = allocFromTail(size, -align);
}
}
if (ptr == nullptr) {
JUTWarningConsole_f(":::cannot alloc memory (0x%x byte).\n", size);
if (JKRHeap::mErrorFlag == true) {
if (JKRHeap::mErrorHandler) {
(*JKRHeap::mErrorHandler)(this, size, align);
}
}
}
OSUnlockMutex(&mMutex);
return ptr;
}
// JKRExpHeap::allocFromHead
// JKRExpHeap::allocFromTail
JKRExpHeap::JKRExpHeap(void* data, u32 size, JKRHeap* parent, bool error)
: JKRHeap(data, size, parent, error) {