mirror of
https://git.tesses.org/tesses50/crosslang.git
synced 2026-11-30 09:41:53 +00:00
Add htmlparser, conditional variables, make alloc_threshold overridable in prefs.json
This commit is contained in:
+6
-1
@@ -179,6 +179,8 @@ void GC::BarrierEnd() { this->mtx.Unlock(); }
|
||||
void GC::Watch(TObject obj) {
|
||||
if (std::holds_alternative<THeapObject *>(obj)) {
|
||||
auto _item = std::get<THeapObject *>(obj);
|
||||
if (_item == nullptr)
|
||||
return;
|
||||
this->BarrierBegin();
|
||||
this->objects.insert(_item);
|
||||
auto nowAllocs = ++this->allocs;
|
||||
@@ -190,12 +192,15 @@ void GC::Watch(TObject obj) {
|
||||
void GC::Mark(TObject obj) {
|
||||
if (std::holds_alternative<THeapObject *>(obj)) {
|
||||
auto _item = std::get<THeapObject *>(obj);
|
||||
_item->Mark();
|
||||
if (_item)
|
||||
_item->Mark();
|
||||
}
|
||||
}
|
||||
void GC::Unwatch(TObject obj) {
|
||||
if (std::holds_alternative<THeapObject *>(obj)) {
|
||||
auto _item = std::get<THeapObject *>(obj);
|
||||
if (_item == nullptr)
|
||||
return;
|
||||
this->BarrierBegin();
|
||||
this->objects.erase(_item);
|
||||
this->BarrierEnd();
|
||||
|
||||
@@ -32,6 +32,8 @@ std::shared_ptr<GC> GCList::GetGC() const { return this->gc; }
|
||||
void GCList::Remove(TObject obj) {
|
||||
if (std::holds_alternative<THeapObject *>(obj)) {
|
||||
auto _item = std::get<THeapObject *>(obj);
|
||||
if (_item == nullptr)
|
||||
return;
|
||||
this->gc->BarrierBegin();
|
||||
for (auto index = this->items.begin(); index != this->items.end();
|
||||
index++) {
|
||||
@@ -47,6 +49,8 @@ void GCList::Add(TObject obj) {
|
||||
|
||||
if (std::holds_alternative<THeapObject *>(obj)) {
|
||||
auto _item = std::get<THeapObject *>(obj);
|
||||
if (_item == nullptr)
|
||||
return;
|
||||
this->gc->BarrierBegin();
|
||||
|
||||
for (auto item : this->items) {
|
||||
|
||||
Reference in New Issue
Block a user