aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-11-20 22:27:15 +0000
committerMichael Williamson <mike@zwobble.org>2023-11-20 22:28:34 +0000
commit86f7fa2960fe0eaa49f0cebdedd8cc04f31ebd76 (patch)
tree58a0d944f8f87c4821aaba4cc232b7c2491994a9 /src/test/java
parentd90a1e3828856f4c790b3527299e17e42cf13552 (diff)
Implement stack IR vars using alloc-stack in Patio
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java2
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarLoadTests.java3
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarStoreTests.java5
4 files changed, 8 insertions, 6 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
index 7fca6f96..eeb17968 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
@@ -73,8 +73,8 @@ public class PatioCodeGenDefineFunctionTests {
Sources.NULL
);
var context = PatioCodeGenContext.EMPTY
- .declareStackIrVal("a").context()
- .declareStackIrVal("b").context();
+ .declareStackIrVal("a", PatioCodeGenTypes.VALUE_TYPE).context()
+ .declareStackIrVal("b", PatioCodeGenTypes.VALUE_TYPE).context();
context = PatioCodeGen.generateInstruction(instruction, context);
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java
index 2cdec3e1..dd37b35f 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java
@@ -17,7 +17,7 @@ public class PatioCodeGenLocalStoreTests {
public void localStorePopsTemporaryIntoLocal(Snapshotter snapshotter) throws IOException {
var stackIr = Instructions.localStore("x");
var context = PatioCodeGenContext.EMPTY
- .declareStackIrVal("x").context()
+ .declareStackIrVal("x", PatioCodeGenTypes.VALUE_TYPE).context()
.temporaryPush(new PatioLocalRef("a"))
.temporaryPush(new PatioLocalRef("b"));
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarLoadTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarLoadTests.java
index 0fe5582b..4cff0dd4 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarLoadTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarLoadTests.java
@@ -2,6 +2,7 @@ package org.shedlang.compiler.patio;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.shedlang.compiler.patio.ast.types.PatioTypes;
import org.shedlang.compiler.stackir.instructions.Instructions;
import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
import org.shedlang.compiler.testing.snapshots.Snapshotter;
@@ -16,7 +17,7 @@ public class PatioCodeGenVarLoadTests {
public void canGenerateCodeForVarLoad(Snapshotter snapshotter) throws IOException {
var stackIr = Instructions.varLoad("x");
var context = PatioCodeGenContext.EMPTY
- .defineStackIrVar("x");
+ .declareStackIrVal("x", PatioTypes.DATA_POINTER).context();
var result = PatioCodeGen.generateInstruction(stackIr, context);
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarStoreTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarStoreTests.java
index 5e7884ee..66038785 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarStoreTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenVarStoreTests.java
@@ -3,6 +3,7 @@ package org.shedlang.compiler.patio;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.shedlang.compiler.patio.ast.operands.PatioLocalRef;
+import org.shedlang.compiler.patio.ast.types.PatioTypes;
import org.shedlang.compiler.stackir.instructions.Instructions;
import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
import org.shedlang.compiler.testing.snapshots.Snapshotter;
@@ -17,7 +18,7 @@ public class PatioCodeGenVarStoreTests {
public void canGenerateCodeForVarStore(Snapshotter snapshotter) throws IOException {
var stackIr = Instructions.varStore("x");
var context = PatioCodeGenContext.EMPTY
- .defineStackIrVar("x")
+ .declareStackIrVal("x", PatioTypes.DATA_POINTER).context()
.temporaryPush(new PatioLocalRef("a"))
.temporaryPush(new PatioLocalRef("b"));
@@ -30,7 +31,7 @@ public class PatioCodeGenVarStoreTests {
public void canStoreIntoVarMultipleTimes(Snapshotter snapshotter) throws IOException {
var stackIr = Instructions.varStore("x");
var context = PatioCodeGenContext.EMPTY
- .defineStackIrVar("x")
+ .declareStackIrVal("x", PatioTypes.DATA_POINTER).context()
.temporaryPush(new PatioLocalRef("a"))
.temporaryPush(new PatioLocalRef("b"));