Files
tesses50 2430b62232
Build and Deploy on Tag / 🔨 Build for PowerPC (push) Successful in 1m11s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-riscv64:latest, riscv64-linux-gnu, riscv64) (push) Successful in 3m22s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-x64:latest, x86_64-linux-gnu, amd64) (push) Successful in 3m34s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-arm:latest, arm-linux-gnueabihf, arm7) (push) Successful in 3m37s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-arm64:latest, aarch64-linux-gnu, arm64) (push) Successful in 3m39s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-x86:latest, i386-linux-gnu, 386) (push) Successful in 55s
Build and Deploy on Tag / update-tap (push) Failing after 4m8s
Replace time-based GC with allocation-count trigger, migrate all Create factories to GCList::Create(), fix VFSPath root path, reorder TObject variant
2026-09-01 05:15:43 -05:00

45 lines
1.2 KiB
C++

#include "CrossLang.hpp"
namespace Tesses::CrossLang {
TNative::TNative(void *ptr, std::function<void(void *)> destroy) {
this->ptr = ptr;
this->destroyed = false;
this->destroy = destroy;
}
bool TNative::GetDestroyed() { return this->destroyed; }
void *TNative::GetPointer() { return this->ptr; }
void TNative::Mark() {
if (this->marked)
return;
this->marked = true;
GC::Mark(this->other);
}
void TNative::Destroy() {
if (this->destroyed)
return;
if (this->destroy != nullptr) {
this->destroyed = true;
this->destroy(this->ptr);
}
}
bool TNativeObject::ToBool() { return true; }
bool TNativeObject::Equals(std::shared_ptr<GC> gc, TObject right) {
if (std::holds_alternative<THeapObjectHolder>(right)) {
return this == std::get<THeapObjectHolder>(right).obj;
}
return false;
}
TNative *TNative::Create(GCList &ls, void *ptr,
std::function<void(void *)> destroy) {
return ls.Create<TNative>(ptr, destroy);
}
TNative *TNative::Create(GCList *ls, void *ptr,
std::function<void(void *)> destroy) {
return ls->Create<TNative>(ptr, destroy);
}
TNative::~TNative() { this->Destroy(); }
} // namespace Tesses::CrossLang