From bf445ef68ba14fa557414fe3dd387d422448f81f Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Fri, 25 Sep 2026 22:04:55 -0500 Subject: [PATCH] Add htmlparser, conditional variables, make alloc_threshold overridable in prefs.json --- .vscode/launch.json | 8 +++++--- src/runtime_methods/helpers.cpp | 20 ++++++++++++++++++++ src/vm/gc.cpp | 7 ++++++- src/vm/gclist.cpp | 4 ++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 22eaf55..5be7621 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,8 +8,11 @@ "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/builds/l/crossint", - "args": ["queryable.tcross"], + "program": "${workspaceFolder}/build/crosslang", + "args": [ + "webapp", + "tytd2025" + ], "stopAtEntry": false, "cwd": "${workspaceFolder}/builds/l", "environment": [], @@ -28,6 +31,5 @@ } ] } - ] } \ No newline at end of file diff --git a/src/runtime_methods/helpers.cpp b/src/runtime_methods/helpers.cpp index 69cfe5f..37ca071 100644 --- a/src/runtime_methods/helpers.cpp +++ b/src/runtime_methods/helpers.cpp @@ -1,3 +1,23 @@ +/* + CrossLang is a dynamically-typed scripting language built on + TessesFramework, named in honor of Jesus's sacrifice. + + Copyright (C) 2026 Mike Nolan + SPDX-License-Identifier: GPL-3.0-or-later WITH TessesFramework-Exception-1.0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ #include "CrossLang.hpp" namespace Tesses::CrossLang { diff --git a/src/vm/gc.cpp b/src/vm/gc.cpp index 7f0279a..b24114c 100644 --- a/src/vm/gc.cpp +++ b/src/vm/gc.cpp @@ -179,6 +179,8 @@ void GC::BarrierEnd() { this->mtx.Unlock(); } void GC::Watch(TObject obj) { if (std::holds_alternative(obj)) { auto _item = std::get(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(obj)) { auto _item = std::get(obj); - _item->Mark(); + if (_item) + _item->Mark(); } } void GC::Unwatch(TObject obj) { if (std::holds_alternative(obj)) { auto _item = std::get(obj); + if (_item == nullptr) + return; this->BarrierBegin(); this->objects.erase(_item); this->BarrierEnd(); diff --git a/src/vm/gclist.cpp b/src/vm/gclist.cpp index 73d7302..d03872f 100644 --- a/src/vm/gclist.cpp +++ b/src/vm/gclist.cpp @@ -32,6 +32,8 @@ std::shared_ptr GCList::GetGC() const { return this->gc; } void GCList::Remove(TObject obj) { if (std::holds_alternative(obj)) { auto _item = std::get(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(obj)) { auto _item = std::get(obj); + if (_item == nullptr) + return; this->gc->BarrierBegin(); for (auto item : this->items) {