From beccc35e77ae431a3074b0cf1a11d8fef48d6f26 Mon Sep 17 00:00:00 2001 From: xFrednet Date: Fri, 1 Nov 2024 13:21:14 +0100 Subject: [PATCH] Fix CI --- CMakeLists.txt | 2 +- src/rt/objects/region.cc | 16 ++++++++++++++++ src/rt/objects/region.h | 13 +------------ tests/cowns/valid_01.vpy | 1 - .../fail_cross_region_ref.vpy} | 9 ++++++--- 5 files changed, 24 insertions(+), 17 deletions(-) rename tests/{region/fail_cross_region_reg.vpy => regions/fail_cross_region_ref.vpy} (57%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f2380..1836e2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,6 @@ set_property(TEST leak_with_global.vpy PROPERTY WILL_FAIL true) set_property(TEST invalid_read.vpy PROPERTY WILL_FAIL true) set_property(TEST invalid_shared_region.vpy PROPERTY WILL_FAIL true) set_property(TEST invalid_write.vpy PROPERTY WILL_FAIL true) -set_property(TEST fail_cross_region_reg.vpy PROPERTY WILL_FAIL true) set_property(TEST region_bad_1.vpy PROPERTY WILL_FAIL true) set_property(TEST region_bad_2.vpy PROPERTY WILL_FAIL true) +set_property(TEST fail_cross_region_ref.vpy PROPERTY WILL_FAIL true) diff --git a/src/rt/objects/region.cc b/src/rt/objects/region.cc index 6860e74..459f0ca 100644 --- a/src/rt/objects/region.cc +++ b/src/rt/objects/region.cc @@ -251,4 +251,20 @@ namespace rt::objects return obj; } + void Region::action(Region* r) + { + if ((r->local_reference_count == 0) && (r->parent == nullptr)) + { + // TODO, this can be hooked to perform delayed operations like send. + // Needs to check for sub_region_reference_count for send, but not + // deallocate. + + if (r != get_local_region() && r != cown_region) + { + to_collect.push_back(r); + std::cout << "Collecting region: " << r << std::endl; + } + } + } + } diff --git a/src/rt/objects/region.h b/src/rt/objects/region.h index 9344127..060459a 100644 --- a/src/rt/objects/region.h +++ b/src/rt/objects/region.h @@ -55,18 +55,7 @@ namespace rt::objects return local_reference_count + sub_region_reference_count; } - static void action(Region* r) - { - if ((r->local_reference_count == 0) && (r->parent == nullptr)) - { - // TODO, this can be hooked to perform delayed operations like send. - // Needs to check for sub_region_reference_count for send, but not - // deallocate. - - to_collect.push_back(r); - std::cout << "Collecting region: " << r << std::endl; - } - } + static void action(Region*); static void dec_lrc(Region* r) { diff --git a/tests/cowns/valid_01.vpy b/tests/cowns/valid_01.vpy index da22a09..121ea1b 100644 --- a/tests/cowns/valid_01.vpy +++ b/tests/cowns/valid_01.vpy @@ -4,7 +4,6 @@ global = {} a = Region() a.b = {} - c01 = cown(move a) # Store the cown in a global diff --git a/tests/region/fail_cross_region_reg.vpy b/tests/regions/fail_cross_region_ref.vpy similarity index 57% rename from tests/region/fail_cross_region_reg.vpy rename to tests/regions/fail_cross_region_ref.vpy index 5fa7016..884ad75 100644 --- a/tests/region/fail_cross_region_reg.vpy +++ b/tests/regions/fail_cross_region_ref.vpy @@ -1,11 +1,14 @@ # Root a -a = Region() +a = {} +region(a) # Root b -b = Region() +b = {} +region(b) # Child region -c = Region() +c = {} +region(c) a.child = c # Error