mirror of
https://git.tesses.org/tesses50/crosslang.git
synced 2026-09-30 16:54:14 +00:00
Fix bug with classes, use slim exclusively, add package private data and change rehaul cmake configs
This commit is contained in:
+46
-60
@@ -1,67 +1,53 @@
|
||||
#include "CrossLang.hpp"
|
||||
|
||||
namespace Tesses::CrossLang
|
||||
{
|
||||
GCList::GCList(std::shared_ptr<GC> gc)
|
||||
{
|
||||
gc->BarrierBegin();
|
||||
this->gc = gc;
|
||||
gc->SetRoot(this);
|
||||
gc->BarrierEnd();
|
||||
}
|
||||
|
||||
std::shared_ptr<GC> GCList::GetGC()
|
||||
{
|
||||
return this->gc;
|
||||
}
|
||||
void GCList::Remove(TObject obj)
|
||||
{
|
||||
if(std::holds_alternative<THeapObjectHolder>(obj))
|
||||
{
|
||||
auto _item=std::get<THeapObjectHolder>(obj).obj;
|
||||
this->gc->BarrierBegin();
|
||||
for(auto index = this->items.begin();index<this->items.end();index++)
|
||||
{
|
||||
if(*index == _item)
|
||||
{
|
||||
this->items.erase(index);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
this->gc->BarrierEnd();
|
||||
}
|
||||
}
|
||||
void GCList::Add(TObject obj)
|
||||
{
|
||||
namespace Tesses::CrossLang {
|
||||
GCList::GCList(std::shared_ptr<GC> gc) {
|
||||
gc->BarrierBegin();
|
||||
this->gc = gc;
|
||||
gc->SetRoot(this);
|
||||
gc->BarrierEnd();
|
||||
}
|
||||
|
||||
if(std::holds_alternative<THeapObjectHolder>(obj))
|
||||
{
|
||||
auto _item=std::get<THeapObjectHolder>(obj).obj;
|
||||
this->gc->BarrierBegin();
|
||||
|
||||
for(auto item : this->items)
|
||||
{
|
||||
if(item == _item) {
|
||||
this->gc->BarrierEnd();
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<GC> GCList::GetGC() { return this->gc; }
|
||||
void GCList::Remove(TObject obj) {
|
||||
if (std::holds_alternative<THeapObjectHolder>(obj)) {
|
||||
auto _item = std::get<THeapObjectHolder>(obj).obj;
|
||||
this->gc->BarrierBegin();
|
||||
for (auto index = this->items.begin(); index != this->items.end();
|
||||
index++) {
|
||||
if (*index == _item) {
|
||||
this->items.erase(index);
|
||||
continue;
|
||||
}
|
||||
this->items.push_back(_item);
|
||||
this->gc->BarrierEnd();
|
||||
}
|
||||
}
|
||||
void GCList::Mark()
|
||||
{
|
||||
this->marked=true;
|
||||
for(auto item : this->items)
|
||||
{
|
||||
item->Mark();
|
||||
}
|
||||
}
|
||||
GCList::~GCList()
|
||||
{
|
||||
gc->BarrierBegin();
|
||||
this->gc->UnsetRoot(this);
|
||||
gc->BarrierEnd();
|
||||
this->gc->BarrierEnd();
|
||||
}
|
||||
}
|
||||
void GCList::Add(TObject obj) {
|
||||
|
||||
if (std::holds_alternative<THeapObjectHolder>(obj)) {
|
||||
auto _item = std::get<THeapObjectHolder>(obj).obj;
|
||||
this->gc->BarrierBegin();
|
||||
|
||||
for (auto item : this->items) {
|
||||
if (item == _item) {
|
||||
this->gc->BarrierEnd();
|
||||
return;
|
||||
}
|
||||
}
|
||||
this->items.push_back(_item);
|
||||
this->gc->BarrierEnd();
|
||||
}
|
||||
}
|
||||
void GCList::Mark() {
|
||||
this->marked = true;
|
||||
for (auto item : this->items) {
|
||||
item->Mark();
|
||||
}
|
||||
}
|
||||
GCList::~GCList() {
|
||||
gc->BarrierBegin();
|
||||
this->gc->UnsetRoot(this);
|
||||
gc->BarrierEnd();
|
||||
}
|
||||
} // namespace Tesses::CrossLang
|
||||
|
||||
Reference in New Issue
Block a user