aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-17 12:57:53 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-17 12:57:53 +0000
commitd51f80a5bd21c4dd6cac8d623e96d1093dc1deff (patch)
tree4d84abd62f071da1ac8ce6ee785990c4ccd28865
parentc3e4f46095658fdf331046e5812bc135e66f4844 (diff)
Remove GC perm roots
-rw-r--r--runtime/src/gc.c22
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenGc.java26
2 files changed, 0 insertions, 48 deletions
diff --git a/runtime/src/gc.c b/runtime/src/gc.c
index c5738f63..dc8c719b 100644
--- a/runtime/src/gc.c
+++ b/runtime/src/gc.c
@@ -49,8 +49,6 @@ void mark(struct ShedGcObjectHeader* object) {
// == Roots ==
-// === Root stack ===
-
typedef size_t ShedGcRootIndex;
ShedGcRootIndex gc_root_stack_index = 0;
@@ -78,22 +76,6 @@ void shed__runtime__gc_push_root(ShedObject gc_root) {
shed__runtime__gc_push_root_gc_object((struct ShedGcObjectHeader*) gc_root);
}
-// === Perm roots ===
-
-ShedGcRootIndex gc_perm_root_index = 0;
-
-// TODO: should be growable
-struct ShedGcObjectHeader* gc_perm_roots[16384];
-
-void shed__runtime__gc_add_perm_root(ShedObject gc_root) {
- if (!is_gc_object(gc_root)) {
- return;
- }
-
- gc_perm_roots[gc_perm_root_index] = (struct ShedGcObjectHeader*) gc_root;
- gc_perm_root_index++;
-}
-
// == Allocation ==
struct ShedGcObjectHeader* first = NULL;
@@ -125,10 +107,6 @@ void* shed__runtime__gc_alloc(size_t size, size_t children_offset, size_t childr
// == Collection ==
void mark_reachable() {
- for (size_t i = 0; i < gc_perm_root_index; i++) {
- mark(gc_perm_roots[i]);
- }
-
for (size_t i = 0; i < gc_root_stack_index; i++) {
mark(gc_root_stack[i]);
}
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenGc.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenGc.java
index 4c9f6316..525ab89a 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenGc.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenGc.java
@@ -55,8 +55,6 @@ public class PatioCodeGenGc {
// == Roots ==
- // == Root stack ==
-
public static final PatioType GC_ROOT_STACK_INDEX_TYPE = PatioTypes.INT;
private static final PatioFunctionDeclaration GET_GC_ROOT_STACK_INDEX = new PatioFunctionDeclaration(
@@ -125,30 +123,6 @@ public class PatioCodeGenGc {
));
}
- // == Perm roots ==
-
- private static final PatioFunctionDeclaration ADD_PERM_GC_ROOT = new PatioFunctionDeclaration(
- "shed__runtime__gc_add_perm_root",
- List.of(PatioLocal.param("gc_root", PatioCodeGenTypes.VALUE_TYPE)),
- PatioTypes.VOID,
- Sources.RUNTIME
- );
-
- public static PatioCodeGenContext addPermGcRoot(
- PatioOperand gcRoot,
- Source source,
- PatioCodeGenContext context
- ) {
- return context
- .ensureCompilationUnitElement(ADD_PERM_GC_ROOT)
- .addInstruction(new PatioCall(
- Optional.empty(),
- ADD_PERM_GC_ROOT.name(),
- List.of(gcRoot),
- source
- ));
- }
-
// == Allocation ==
public static PatioCodeGenContext alloc(