JSUList.h templates and JKRHeap matches (#13)

* JSULink, JSUList, JSUTree and more matching in JKRHeap

* Added JSUListIterator and decompiled JKRHeap::dispose_subroutine

* more templates and JKRHeap functions

* JKRDisposer!

* only 4 functions not OK in JKRHeap

* fixed: *this->getObject()

Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
Jonathan Wase
2020-12-04 03:02:41 +01:00
committed by GitHub
parent 294858f751
commit 4adfed901e
7 changed files with 583 additions and 204 deletions
+9 -28
View File
@@ -3,36 +3,17 @@
#include "JSystem/JKernel/JKRHeap/JKRHeap.h"
// #include "JSystem/JKernel/asm/func_802D147C.s"
JKRDisposer::JKRDisposer() : ptr_link(this) {
this->heap = JKRHeap::findFromRoot(this);
if (this->heap != 0) {
this->heap->disposable_list.append(&this->ptr_link);
JKRDisposer::JKRDisposer() : mLink(this) {
this->mHeap = JKRHeap::findFromRoot(this);
if (this->mHeap) {
this->mHeap->appendDisposer(this);
}
}
/*
Super close.
This is what we expected: (from Ghidra)
if (this != (JKRDisposer *)&DAT_fffffff8) {
JSUPtrLink::~JSUPtrLink(&this->ptr_link,0);
}
But the compiler generate code like this instead: (no if and -1 instead of 0)
JSUPtrLink::~JSUPtrLink(&this->ptr_link,-1);
Maybe we are using the wrong compiler?
*/
#ifdef NONMATCHING
// #include "JSystem/JKernel/JKRDisposer/asm/func_802D14E4.s"
JKRDisposer::~JKRDisposer() {
JKRHeap* heap = this->heap;
if (heap != 0) {
heap->disposable_list.remove(&this->ptr_link);
}
JKRHeap* heap = this->mHeap;
if (heap) {
heap->removeDisposer(this);
}
}
#else
asm JKRDisposer::~JKRDisposer() {
nofralloc
#include "JSystem/JKernel/JKRDisposer/asm/func_802D14E4.s"
}
#endif