aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-03-24 14:10:30 +0000
committerMichael Williamson <mike@zwobble.org>2024-03-24 14:10:30 +0000
commit04cf66d6b53121998b33889a5495aaef3925cdfd (patch)
tree71f827e2486627eb794c3f5b62e74ccab349d5ec
parentcb44def5d662e9ec15cf1d97d735c6deb129c302 (diff)
Use profiles when compiling
-rw-r--r--examples-perf/01-fibonacci/shed.toml13
-rw-r--r--src/main/java/org/shedlang/compiler/ShedCompiler.java19
-rw-r--r--src/main/java/org/shedlang/compiler/backends/Backend.java3
-rw-r--r--src/main/java/org/shedlang/compiler/backends/PatioBackends.java11
-rw-r--r--src/main/java/org/shedlang/compiler/backends/PatioTextBackend.java7
-rw-r--r--src/main/java/org/shedlang/compiler/backends/ShidTextBackend.java3
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java15
-rw-r--r--src/main/java/org/shedlang/compiler/backends/wasm/WasmBackend.java15
-rw-r--r--src/main/java/org/shedlang/compiler/cli/ShedCli.java6
-rw-r--r--src/main/java/org/shedlang/compiler/config/GcBumpConfig.java4
-rw-r--r--src/main/java/org/shedlang/compiler/config/GcConfig.java3
-rw-r--r--src/main/java/org/shedlang/compiler/config/GcMarkAndSweepConfig.java9
-rw-r--r--src/main/java/org/shedlang/compiler/config/ProfileConfig.java2
-rw-r--r--src/main/java/org/shedlang/compiler/config/ProjectConfig.java8
-rw-r--r--src/main/java/org/shedlang/compiler/filesystem/ShedCompilerFiles.java6
-rw-r--r--src/test/java/org/shedlang/compiler/backends/ExampleTests.java11
-rw-r--r--src/test/java/org/shedlang/compiler/backends/llvm/PatioToLlvmTests.java6
-rw-r--r--src/test/java/org/shedlang/compiler/backends/wasm/PatioToWasmTests.java3
18 files changed, 105 insertions, 39 deletions
diff --git a/examples-perf/01-fibonacci/shed.toml b/examples-perf/01-fibonacci/shed.toml
index 1662cb22..bc1fa969 100644
--- a/examples-perf/01-fibonacci/shed.toml
+++ b/examples-perf/01-fibonacci/shed.toml
@@ -5,3 +5,16 @@ main-namespace = "Fibonacci"
[[shed.examples]]
bin = "fibonacci"
expected-output = "success"
+
+[[shed.profiles]]
+name = "gc-bump"
+gc.name = "bump"
+
+[[shed.profiles]]
+name = "gc-mark-and-sweep"
+gc.name = "mark-and-sweep"
+
+[[shed.profiles]]
+name = "gc-mark-and-sweep-always-collect"
+gc.name = "mark-and-sweep"
+gc.collect-interval = 1
diff --git a/src/main/java/org/shedlang/compiler/ShedCompiler.java b/src/main/java/org/shedlang/compiler/ShedCompiler.java
index 1f04c0fa..45c189bf 100644
--- a/src/main/java/org/shedlang/compiler/ShedCompiler.java
+++ b/src/main/java/org/shedlang/compiler/ShedCompiler.java
@@ -4,6 +4,7 @@ import org.shedlang.compiler.ast.untyped.UntypedNamespaceNode;
import org.shedlang.compiler.backends.Backend;
import org.shedlang.compiler.backends.paths.TargetDir;
import org.shedlang.compiler.config.ConfigChecker;
+import org.shedlang.compiler.config.ProfileConfig;
import org.shedlang.compiler.config.ProjectConfig;
import org.shedlang.compiler.parser.Parser;
import org.shedlang.compiler.shid.ShidCodeGen;
@@ -21,10 +22,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.stream.StreamSupport;
import static org.shedlang.compiler.parser.Tokeniser.tokenise;
@@ -34,7 +32,7 @@ public class ShedCompiler {
public void compile(
Path projectRoot,
Backend backend,
- String profileName
+ Optional<String> profileName
) throws IOException, InterruptedException {
var config = ProjectConfig.read(projectRoot);
@@ -75,12 +73,19 @@ public class ShedCompiler {
ConfigChecker.configCheck(config, typeInfos);
+ var profileConfig = profileName.map(config::profile)
+ .orElse(ProfileConfig.DEFAULT);
+
backend.compile(
config,
- profileName,
+ profileConfig,
namespaces,
typeInfos,
- new TargetDir(config.targetDir().resolve(backend.targetName()))
+ new TargetDir(
+ config.targetDir()
+ .resolve(backend.targetName())
+ .resolve(profileConfig.name())
+ )
);
}
diff --git a/src/main/java/org/shedlang/compiler/backends/Backend.java b/src/main/java/org/shedlang/compiler/backends/Backend.java
index 17b8400f..ddd57f8e 100644
--- a/src/main/java/org/shedlang/compiler/backends/Backend.java
+++ b/src/main/java/org/shedlang/compiler/backends/Backend.java
@@ -1,6 +1,7 @@
package org.shedlang.compiler.backends;
import org.shedlang.compiler.backends.paths.TargetDir;
+import org.shedlang.compiler.config.ProfileConfig;
import org.shedlang.compiler.config.ProjectConfig;
import org.shedlang.compiler.shid.ShidNamespace;
import org.shedlang.compiler.typechecker.TypeInfos;
@@ -13,7 +14,7 @@ public interface Backend {
void compile(
ProjectConfig config,
- String profileName,
+ ProfileConfig profileConfig,
List<ShidNamespace> namespaces,
TypeInfos typeInfos,
TargetDir targetDir
diff --git a/src/main/java/org/shedlang/compiler/backends/PatioBackends.java b/src/main/java/org/shedlang/compiler/backends/PatioBackends.java
index 8bdc15e0..bc90c6b4 100644
--- a/src/main/java/org/shedlang/compiler/backends/PatioBackends.java
+++ b/src/main/java/org/shedlang/compiler/backends/PatioBackends.java
@@ -1,6 +1,7 @@
package org.shedlang.compiler.backends;
import org.shedlang.compiler.config.BinConfig;
+import org.shedlang.compiler.config.ProfileConfig;
import org.shedlang.compiler.config.ProjectConfig;
import org.shedlang.compiler.patio.PatioCompilationUnit;
import org.shedlang.compiler.shid.ShidNamespace;
@@ -24,13 +25,13 @@ public class PatioBackends {
String binName,
PatioCompilationUnit patioCompilationUnit,
String mainFunctionName,
- String profileName
+ ProfileConfig profileConfig
) throws IOException, InterruptedException;
}
public static void compile(
ProjectConfig config,
- String profileName,
+ ProfileConfig profileConfig,
List<ShidNamespace> namespaces,
TypeInfos typeInfos,
PatioToTarget patioToTarget
@@ -49,12 +50,12 @@ public class PatioBackends {
}
for (var bin : config.bins()) {
- generateMain(profileName, bin, shidToPatioContext, patioToTarget);
+ generateMain(profileConfig, bin, shidToPatioContext, patioToTarget);
}
}
private static void generateMain(
- String profileName,
+ ProfileConfig profileConfig,
BinConfig binConfig,
ShidToPatioContext shidToPatioContext,
PatioToTarget patioToTarget
@@ -83,7 +84,7 @@ public class PatioBackends {
binConfig.name(),
patioCompilationUnit,
mainFunctionName,
- profileName
+ profileConfig
);
}
}
diff --git a/src/main/java/org/shedlang/compiler/backends/PatioTextBackend.java b/src/main/java/org/shedlang/compiler/backends/PatioTextBackend.java
index 929feac3..052408c0 100644
--- a/src/main/java/org/shedlang/compiler/backends/PatioTextBackend.java
+++ b/src/main/java/org/shedlang/compiler/backends/PatioTextBackend.java
@@ -2,6 +2,7 @@ package org.shedlang.compiler.backends;
import org.shedlang.compiler.backends.paths.PartialTargetPath;
import org.shedlang.compiler.backends.paths.TargetDir;
+import org.shedlang.compiler.config.ProfileConfig;
import org.shedlang.compiler.config.ProjectConfig;
import org.shedlang.compiler.patio.PatioCompilationUnit;
import org.shedlang.compiler.patio.PatioSerializer;
@@ -26,14 +27,14 @@ public class PatioTextBackend implements Backend {
public void compile(
ProjectConfig config,
- String profileName,
+ ProfileConfig profileConfig,
List<ShidNamespace> namespaces,
TypeInfos typeInfos,
TargetDir targetDir
) throws IOException, InterruptedException {
PatioBackends.compile(
config,
- profileName,
+ profileConfig,
namespaces,
typeInfos,
new PatioToText(targetDir)
@@ -66,7 +67,7 @@ public class PatioTextBackend implements Backend {
String binName,
PatioCompilationUnit patioCompilationUnit,
String mainFunctionName,
- String profileName
+ ProfileConfig profileConfig
) throws IOException, InterruptedException {
serializeToDisk(
targetDir.bin(binName),
diff --git a/src/main/java/org/shedlang/compiler/backends/ShidTextBackend.java b/src/main/java/org/shedlang/compiler/backends/ShidTextBackend.java
index 36af4357..f34c18b2 100644
--- a/src/main/java/org/shedlang/compiler/backends/ShidTextBackend.java
+++ b/src/main/java/org/shedlang/compiler/backends/ShidTextBackend.java
@@ -1,6 +1,7 @@
package org.shedlang.compiler.backends;
import org.shedlang.compiler.backends.paths.TargetDir;
+import org.shedlang.compiler.config.ProfileConfig;
import org.shedlang.compiler.config.ProjectConfig;
import org.shedlang.compiler.shid.ShidNamespace;
import org.shedlang.compiler.shid.ShidSerializer;
@@ -19,7 +20,7 @@ public class ShidTextBackend implements Backend {
@Override
public void compile(
ProjectConfig config,
- String profileName,
+ ProfileConfig profileConfig,
List<ShidNamespace> namespaces,
TypeInfos typeInfos,
TargetDir targetDir
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java
index 70430da7..bb951a9f 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java
@@ -15,6 +15,8 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariableGlobal;
import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariableLocal;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmTypes;
import org.shedlang.compiler.backends.paths.TargetDir;
+import org.shedlang.compiler.config.GcConfig;
+import org.shedlang.compiler.config.ProfileConfig;
import org.shedlang.compiler.config.ProjectConfig;
import org.shedlang.compiler.filesystem.ShedCompilerFiles;
import org.shedlang.compiler.patio.PatioCompilationUnit;
@@ -54,14 +56,14 @@ public class LlvmBackend implements Backend {
@Override
public void compile(
ProjectConfig config,
- String profileName,
+ ProfileConfig profileConfig,
List<ShidNamespace> namespaces,
TypeInfos typeInfos,
TargetDir targetDir
) throws IOException, InterruptedException {
PatioBackends.compile(
config,
- profileName,
+ profileConfig,
namespaces,
typeInfos,
new PatioToBinary(
@@ -121,7 +123,7 @@ public class LlvmBackend implements Backend {
String binName,
PatioCompilationUnit patioCompilationUnit,
String mainFunctionName,
- String profileName
+ ProfileConfig profileConfig
) throws IOException, InterruptedException {
var linkInputs = new ArrayList<>(objectFilePaths);
@@ -133,15 +135,16 @@ public class LlvmBackend implements Backend {
var mainObjectPath = llvmCompiler.compileLlvmModule(mainModule, targetDir.bin(binName));
linkInputs.add(mainObjectPath);
- link(linkInputs, targetDir.topLevel(binName), profileName);
+ link(linkInputs, targetDir.topLevel(binName), profileConfig.gc().orElse(GcConfig.DEFAULT));
}
}
public void link(
List<Path> inputs,
Path outputPath,
- String profileName
+ GcConfig gcConfig
) throws ProcessError, InterruptedException {
+ // TODO: handle config for GC
var clangArgs = new ArrayList<String>();
clangArgs.add("clang");
@@ -154,7 +157,7 @@ public class LlvmBackend implements Backend {
var runtimeDir = ShedCompilerFiles.targetDir(
this.target.targetName(),
- profileName
+ gcConfig
);
clangArgs.add(runtimeDir.resolve("libpatio.a").toString());
clangArgs.add(runtimeDir.resolve("libshed.a").toString());
diff --git a/src/main/java/org/shedlang/compiler/backends/wasm/WasmBackend.java b/src/main/java/org/shedlang/compiler/backends/wasm/WasmBackend.java
index 6069563f..3a7a4733 100644
--- a/src/main/java/org/shedlang/compiler/backends/wasm/WasmBackend.java
+++ b/src/main/java/org/shedlang/compiler/backends/wasm/WasmBackend.java
@@ -12,6 +12,8 @@ import org.shedlang.compiler.backends.wasm.structure.ast.instructions.WasmExpres
import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmFuncName;
import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmFunction;
import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmModule;
+import org.shedlang.compiler.config.GcConfig;
+import org.shedlang.compiler.config.ProfileConfig;
import org.shedlang.compiler.config.ProjectConfig;
import org.shedlang.compiler.filesystem.ShedCompilerFiles;
import org.shedlang.compiler.patio.PatioCompilationUnit;
@@ -52,14 +54,14 @@ public class WasmBackend implements Backend {
@Override
public void compile(
ProjectConfig config,
- String profileName,
+ ProfileConfig profileConfig,
List<ShidNamespace> namespaces,
TypeInfos typeInfos,
TargetDir targetDir
) throws IOException, InterruptedException {
PatioBackends.compile(
config,
- profileName,
+ profileConfig,
namespaces,
typeInfos,
new PatioToWasmBinary(targetDir, P.vector())
@@ -101,7 +103,7 @@ public class WasmBackend implements Backend {
String binName,
PatioCompilationUnit patioCompilationUnit,
String mainFunctionName,
- String profileName
+ ProfileConfig profileConfig
) throws IOException, InterruptedException {
var linkInputs = new ArrayList<>(objectFilePaths);
@@ -110,7 +112,7 @@ public class WasmBackend implements Backend {
linkInputs.add(mainObjectPath);
var outputBinPath = targetDir.topLevel(binName + ".wasm");
- link(linkInputs, outputBinPath, profileName);
+ link(linkInputs, outputBinPath, profileConfig.gc().orElse(GcConfig.DEFAULT));
validate(outputBinPath);
}
}
@@ -118,8 +120,9 @@ public class WasmBackend implements Backend {
public void link(
List<Path> inputs,
Path outputPath,
- String profileName
+ GcConfig gcConfig
) throws ProcessError, InterruptedException {
+ // TODO: handle config for GC
var ldArgs = new ArrayList<String>();
ldArgs.add("wasm-ld-17");
@@ -134,7 +137,7 @@ public class WasmBackend implements Backend {
var runtimeDir = ShedCompilerFiles.targetDir(
this.target.targetName(),
- profileName
+ gcConfig
);
ldArgs.add(runtimeDir.resolve("libpatio.a").toString());
ldArgs.add(runtimeDir.resolve("libshed.a").toString());
diff --git a/src/main/java/org/shedlang/compiler/cli/ShedCli.java b/src/main/java/org/shedlang/compiler/cli/ShedCli.java
index 5d7baf63..6e5d115b 100644
--- a/src/main/java/org/shedlang/compiler/cli/ShedCli.java
+++ b/src/main/java/org/shedlang/compiler/cli/ShedCli.java
@@ -9,6 +9,7 @@ import org.shedlang.compiler.errors.CompilerError;
import java.io.IOException;
import java.nio.file.Paths;
+import java.util.Optional;
public class ShedCli {
public static void main(String[] rawArgs) throws IOException, InterruptedException {
@@ -30,7 +31,7 @@ public class ShedCli {
switch (args.<Command>get("command")) {
case COMPILE -> {
var backend = Backends.backendForTarget(args.getString("target"));
- var profile = args.getString("profile");
+ var profile = Optional.ofNullable(args.getString("profile"));
compiler.compile(sourcePath, backend, profile);
}
}
@@ -46,8 +47,7 @@ public class ShedCli {
compileSubParser.setDefault("command", Command.COMPILE);
compileSubParser.addArgument("source").required(true);
compileSubParser.addArgument("--target").choices(Backends.targetNames()).required(true);
- // TODO: support profiles properly (define profile, allow GC as an option)
- compileSubParser.addArgument("--profile").setDefault("mark-and-sweep").required(false);
+ compileSubParser.addArgument("--profile").required(false);
try {
return parser.parseArgs(args);
diff --git a/src/main/java/org/shedlang/compiler/config/GcBumpConfig.java b/src/main/java/org/shedlang/compiler/config/GcBumpConfig.java
index bfbd7d4e..02f39173 100644
--- a/src/main/java/org/shedlang/compiler/config/GcBumpConfig.java
+++ b/src/main/java/org/shedlang/compiler/config/GcBumpConfig.java
@@ -1,4 +1,8 @@
package org.shedlang.compiler.config;
public record GcBumpConfig() implements GcConfig {
+ @Override
+ public String name() {
+ return "bump";
+ }
}
diff --git a/src/main/java/org/shedlang/compiler/config/GcConfig.java b/src/main/java/org/shedlang/compiler/config/GcConfig.java
index 6d8ed950..12691658 100644
--- a/src/main/java/org/shedlang/compiler/config/GcConfig.java
+++ b/src/main/java/org/shedlang/compiler/config/GcConfig.java
@@ -4,6 +4,7 @@ import org.tomlj.TomlTable;
public sealed interface GcConfig permits GcBumpConfig, GcMarkAndSweepConfig {
GcConfig BUMP = new GcBumpConfig();
+ GcConfig DEFAULT = GcMarkAndSweepConfig.DEFAULT;
static GcConfig fromToml(TomlTable table) {
var name = table.getString("name");
@@ -23,4 +24,6 @@ public sealed interface GcConfig permits GcBumpConfig, GcMarkAndSweepConfig {
throw new IllegalArgumentException("Unrecognised GC name: \"%s\"".formatted(name));
};
}
+
+ String name();
}
diff --git a/src/main/java/org/shedlang/compiler/config/GcMarkAndSweepConfig.java b/src/main/java/org/shedlang/compiler/config/GcMarkAndSweepConfig.java
index 695654ea..b54add24 100644
--- a/src/main/java/org/shedlang/compiler/config/GcMarkAndSweepConfig.java
+++ b/src/main/java/org/shedlang/compiler/config/GcMarkAndSweepConfig.java
@@ -7,8 +7,17 @@ import java.util.Optional;
public record GcMarkAndSweepConfig(
Optional<Long> collectInterval
) implements GcConfig {
+ public static final GcMarkAndSweepConfig DEFAULT = new GcMarkAndSweepConfig(
+ Optional.empty()
+ );
+
public static GcMarkAndSweepConfig fromToml(TomlTable table) {
var collectInterval = Optional.ofNullable(table.getLong("collect-interval"));
return new GcMarkAndSweepConfig(collectInterval);
}
+
+ @Override
+ public String name() {
+ return "mark-and-sweep";
+ }
}
diff --git a/src/main/java/org/shedlang/compiler/config/ProfileConfig.java b/src/main/java/org/shedlang/compiler/config/ProfileConfig.java
index b8854721..eba2878f 100644
--- a/src/main/java/org/shedlang/compiler/config/ProfileConfig.java
+++ b/src/main/java/org/shedlang/compiler/config/ProfileConfig.java
@@ -5,6 +5,8 @@ import org.tomlj.TomlTable;
import java.util.Optional;
public record ProfileConfig(String name, Optional<GcConfig> gc) {
+ public static final ProfileConfig DEFAULT = new ProfileConfig("dev", Optional.empty());
+
public static ProfileConfig fromToml(TomlTable table) {
var name = table.getString("name");
var gc = Optional.ofNullable(table.getTable("gc"))
diff --git a/src/main/java/org/shedlang/compiler/config/ProjectConfig.java b/src/main/java/org/shedlang/compiler/config/ProjectConfig.java
index b7453f70..3381e521 100644
--- a/src/main/java/org/shedlang/compiler/config/ProjectConfig.java
+++ b/src/main/java/org/shedlang/compiler/config/ProjectConfig.java
@@ -68,4 +68,12 @@ public record ProjectConfig(
public Path targetDir() {
return root.resolve("target");
}
+
+ public ProfileConfig profile(String profileName) {
+ return this.profiles.stream()
+ .filter(profile -> profile.name().equals(profileName))
+ .findFirst()
+ // TODO: better error
+ .orElseThrow();
+ }
}
diff --git a/src/main/java/org/shedlang/compiler/filesystem/ShedCompilerFiles.java b/src/main/java/org/shedlang/compiler/filesystem/ShedCompilerFiles.java
index 5c195448..57f24ae4 100644
--- a/src/main/java/org/shedlang/compiler/filesystem/ShedCompilerFiles.java
+++ b/src/main/java/org/shedlang/compiler/filesystem/ShedCompilerFiles.java
@@ -1,5 +1,7 @@
package org.shedlang.compiler.filesystem;
+import org.shedlang.compiler.config.GcConfig;
+
import java.nio.file.Path;
public class ShedCompilerFiles {
@@ -11,10 +13,10 @@ public class ShedCompilerFiles {
return Path.of(".");
}
- public static Path targetDir(String targetName, String profileName) {
+ public static Path targetDir(String targetName, GcConfig gcConfig) {
return getRoot()
.resolve("runtime/target")
.resolve(targetName)
- .resolve(profileName);
+ .resolve(gcConfig.name());
}
}
diff --git a/src/test/java/org/shedlang/compiler/backends/ExampleTests.java b/src/test/java/org/shedlang/compiler/backends/ExampleTests.java
index 1190a67f..0d7eba56 100644
--- a/src/test/java/org/shedlang/compiler/backends/ExampleTests.java
+++ b/src/test/java/org/shedlang/compiler/backends/ExampleTests.java
@@ -5,6 +5,7 @@ import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.shedlang.compiler.ShedCompiler;
+import org.shedlang.compiler.config.ProfileConfig;
import org.shedlang.compiler.config.ProjectConfig;
import org.shedlang.compiler.errors.CompilerError;
import org.shedlang.compiler.filesystem.ShedCompilerFiles;
@@ -16,6 +17,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
+import java.util.Optional;
import java.util.stream.Stream;
import static org.zwobble.precisely.AssertThat.assertThat;
@@ -44,7 +46,7 @@ public abstract class ExampleTests {
var config = ProjectConfig.read(exampleDirectory.toPath());
for (var example : config.examples()) {
try {
- compiler.compile(exampleDirectory.toPath(), backend, "mark-and-sweep");
+ compiler.compile(exampleDirectory.toPath(), backend, Optional.empty());
} catch (CompilerError error) {
if (example.expectedError().isPresent()) {
assertThat(error.getMessage(), equalTo(example.expectedError().get()));
@@ -55,7 +57,12 @@ public abstract class ExampleTests {
throw error;
}
- var binPath = config.targetDir().resolve(backend.targetName()).resolve(example.bin()).toString();
+ // TODO: remove duplicated generation of target binary path
+ var binPath = config.targetDir()
+ .resolve(backend.targetName())
+ .resolve(ProfileConfig.DEFAULT.name())
+ .resolve(example.bin())
+ .toString();
var result = runExampleBinary(binPath).throwOnError();
assertThat(result.stdout(), equalTo(example.expectedOutput().orElseThrow()));
}
diff --git a/src/test/java/org/shedlang/compiler/backends/llvm/PatioToLlvmTests.java b/src/test/java/org/shedlang/compiler/backends/llvm/PatioToLlvmTests.java
index b4c27e65..71dd9320 100644
--- a/src/test/java/org/shedlang/compiler/backends/llvm/PatioToLlvmTests.java
+++ b/src/test/java/org/shedlang/compiler/backends/llvm/PatioToLlvmTests.java
@@ -10,6 +10,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmOperandInt;
import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariableGlobal;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmTypes;
import org.shedlang.compiler.backends.paths.PartialTargetPath;
+import org.shedlang.compiler.config.GcConfig;
import org.shedlang.compiler.filesystem.ShedCompilerFiles;
import org.shedlang.compiler.patio.PatioCompilationUnit;
import org.shedlang.compiler.patio.PatioExampleTests;
@@ -62,16 +63,17 @@ public abstract class PatioToLlvmTests extends PatioExampleTests {
var executablePath = workingDirectory.resolve("main");
+ var gcConfig = GcConfig.DEFAULT;
LlvmBackend.forTarget(this.llvmTarget()).link(
List.of(
objectFilePath,
ShedCompilerFiles.targetDir(
this.llvmTarget().targetName(),
- "mark-and-sweep"
+ gcConfig
).resolve("libpatio_test.a")
),
executablePath,
- "mark-and-sweep"
+ gcConfig
);
return TestProcessRunner.runCaptureOutput(List.of(executablePath.toString()));
diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/PatioToWasmTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/PatioToWasmTests.java
index bc7c572f..829c69e6 100644
--- a/src/test/java/org/shedlang/compiler/backends/wasm/PatioToWasmTests.java
+++ b/src/test/java/org/shedlang/compiler/backends/wasm/PatioToWasmTests.java
@@ -7,6 +7,7 @@ import org.shedlang.compiler.backends.wasm.structure.ast.instructions.WasmInstru
import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmFuncName;
import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmFunction;
import org.shedlang.compiler.backends.wasm.structure.binary.WasmBinaryFormatTesting;
+import org.shedlang.compiler.config.GcConfig;
import org.shedlang.compiler.patio.PatioCompilationUnit;
import org.shedlang.compiler.patio.PatioExampleTests;
import org.shedlang.compiler.testing.ExecutionResult;
@@ -49,7 +50,7 @@ public abstract class PatioToWasmTests extends PatioExampleTests {
WasmBackend.forTarget(wasmTarget()).link(
List.of(objectPath),
executablePath,
- "mark-and-sweep"
+ GcConfig.DEFAULT
);
WasmBinaryFormatTesting.validate(executablePath, wasmTarget());