Fixing lalr on windows

This commit is contained in:
Ilusha 2024-03-09 12:02:02 +03:00 committed by Ilya Shurupov
parent 69db2b82a4
commit 8cc5f2f9f7
15 changed files with 1276 additions and 1226 deletions

View file

@ -145,13 +145,11 @@ namespace obj {
return;
}
#ifdef OBJECT_REF_COUNT
ObjectMemHead* mh = NDO_MEMH_FROM_NDO(in);
if (mh->refc > 1) {
mh->refc--;
return;
}
#endif
NDO_CASTV(ClassObject, in, classobj);
if (classobj) {
@ -175,7 +173,6 @@ namespace obj {
ObjectMemDeallocate(in);
}
#ifdef OBJECT_REF_COUNT
tp::halni objects_api::getrefc(Object* in) {
ObjectMemHead* mh = NDO_MEMH_FROM_NDO(in);
return (tp::halni) mh->refc;
@ -190,7 +187,7 @@ namespace obj {
ObjectMemHead* mh = NDO_MEMH_FROM_NDO(in);
mh->refc = refc;
}
#endif
void hierarchy_copy(Object* self, const Object* in, const ObjectType* type) {
if (type->base) {

View file

@ -11,6 +11,7 @@
namespace obj {
ObjectMemHead* bottom = nullptr;
tp::ualni count = 0;
struct ObjectsFileHeader {
char name[10] = { 0 };
@ -33,16 +34,17 @@ namespace obj {
memh->down = NULL;
memh->flags = 0;
#ifdef OBJECT_REF_COUNT
memh->refc = (tp::alni) 1;
#endif
if (bottom) {
bottom->down = memh;
}
memh->up = bottom;
bottom = memh;
count++;
NDO_FROM_MEMH(memh)->type = type;
return NDO_FROM_MEMH(memh);
}
@ -61,6 +63,8 @@ namespace obj {
}
tp::HeapAllocGlobal::deallocate(memh);
count--;
}
void logTypeData(const ObjectType* type) {
@ -71,6 +75,8 @@ namespace obj {
}
}
tp::ualni getObjCount() { return count; }
void assertNoLeaks() {
if (bottom) {
printf("ERROR : not all objects are destroyed\n");

View file

@ -128,7 +128,7 @@ void Interpreter::stepBytecodeIn() {
case OpCode::IGNORE:
{
NDO->destroy(mOperandsStack.getOperand());
mOperandsStack.getOperand();
break;
}

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@ oscript {
%left '==' '>' '<' '>=' '<=' '!=' '!';
%left ';';
script : stmts [tmp];
script : stmts [tmp] | ;
scope:
'{' stmts '}' [scope]

View file

@ -61,10 +61,8 @@ alni LinkObject::allocated_size_recursive(LinkObject* self) {
Object* LinkObject::getLink() { return link; }
void LinkObject::setLink(Object* obj) {
#ifdef OBJECT_REF_COUNT
if (link) NDO->destroy(link);
if (obj) NDO->refinc(obj);
#endif // OBJECT_REF_COUNT
link = obj;
}

View file

@ -84,31 +84,23 @@ alni ListObject::allocated_size_recursive(ListObject* self) {
}
void ListObject::pushBack(Object* obj) {
#ifdef OBJECT_REF_COUNT
obj::NDO->refinc(obj);
#endif // OBJECT_REF_COUNT
items.pushBack(obj);
}
void ListObject::pushFront(Object* obj) {
#ifdef OBJECT_REF_COUNT
obj::NDO->refinc(obj);
#endif // OBJECT_REF_COUNT
items.pushFront(obj);
}
void ListObject::delNode(tp::List<Object*>::Node* node) {
#ifdef OBJECT_REF_COUNT
obj::NDO->destroy(node->data);
#endif // OBJECT_REF_COUNT
items.deleteNode(node);
}
void ListObject::popBack() {
#ifdef OBJECT_REF_COUNT
auto obj = items.last();
if (obj) obj::NDO->destroy(obj->data);
#endif // OBJECT_REF_COUNT
items.popBack();
}