diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-12-28 00:41:01 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-12-28 00:41:01 +0000 |
| commit | c860a6bc277d37ea91bcd29534d0cde9fe3eced9 (patch) | |
| tree | 7240c68d333267edbd4381ff6b5641db57cbb6a3 /src/test/java | |
| parent | d6e6efc43aa4f650725bbeba5450c6c44b56fd8f (diff) | |
Update example to include GC object header
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java index 3855a497..d485e9e5 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java @@ -5,6 +5,7 @@ import org.shedlang.compiler.patio.types.PatioDataLayouts; import org.shedlang.compiler.patio.types.PatioDataValues; import org.shedlang.compiler.patio.types.PatioTypes; import org.shedlang.compiler.patio.instructions.Patio; +import org.shedlang.compiler.shidtopatio.ShidToPatioGc; import org.shedlang.compiler.sources.Sources; import org.shedlang.compiler.testing.ExecutionResult; import org.zwobble.precisely.Matcher; @@ -97,18 +98,24 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("y", PatioTypes.INT)) .addLocal(Patio.val("z", PatioTypes.INT)) .addLocal(Patio.val("r", PatioTypes.INT)) - .addBodyInstruction(Patio.allocHeap(Patio.localRef("x"), PatioDataLayouts.INT)) + .addBodyInstruction(Patio.allocHeap( + Patio.localRef("x"), + // TODO: move/rename ShidToPatioGc to be shid-agnostic? + // TODO: find a way to ensure we only alloc objects with the GC header? + // (Probably just remove the GC from Patio?) + ShidToPatioGc.gcObjectDataLayout(PatioDataLayouts.INT) + )) .addBodyInstruction(Patio.memoryStore( Patio.localRef("x"), - PatioDataLayouts.INT, - List.of(), + ShidToPatioGc.gcObjectDataLayout(PatioDataLayouts.INT), + ShidToPatioGc.gcObjectOffset(List.of()), Patio.int_(42) )) .addBodyInstruction(Patio.memoryLoad( Patio.localRef("y"), Patio.localRef("x"), - PatioDataLayouts.INT, - List.of() + ShidToPatioGc.gcObjectDataLayout(PatioDataLayouts.INT), + ShidToPatioGc.gcObjectOffset(List.of()) )) .addBodyInstruction(Patio.intAdd( Patio.localRef("z"), @@ -117,15 +124,15 @@ public abstract class PatioExampleTests { )) .addBodyInstruction(Patio.memoryStore( Patio.localRef("x"), - PatioDataLayouts.INT, - List.of(), + ShidToPatioGc.gcObjectDataLayout(PatioDataLayouts.INT), + ShidToPatioGc.gcObjectOffset(List.of()), Patio.localRef("z") )) .addBodyInstruction(Patio.memoryLoad( Patio.localRef("r"), Patio.localRef("x"), - PatioDataLayouts.INT, - List.of() + ShidToPatioGc.gcObjectDataLayout(PatioDataLayouts.INT), + ShidToPatioGc.gcObjectOffset(List.of()) )) .addBodyInstruction(Patio.return_( Patio.localRef("r") |
