From 0702b47fc0f2d22324a2d45b44fa5657c8bfeab9 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 19 Mar 2024 15:56:15 +0000 Subject: Remove Patio alloc-stack instruction --- .../shedlang/compiler/patio/PatioExampleTests.java | 51 ---------------------- .../compiler/patio/PatioSerializerTests.java | 12 ----- .../compiler/patio/instructions/Patio.java | 4 -- 3 files changed, 67 deletions(-) (limited to 'src/test/java/org') diff --git a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java index b55755d4..b4f51813 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java @@ -98,57 +98,6 @@ public abstract class PatioExampleTests { )); } - @Test - public void allocStack() throws IOException, InterruptedException { - var patioFunction = PatioFunctionDefinition.builder() - .withName(FUNCTION_NAME) - .withReturnType(PatioTypes.VOID) - .addLocal(Patio.val("x", PatioTypes.DATA_PTR)) - .addLocal(Patio.val("y", PatioTypes.INT)) - .addLocal(Patio.val("z", PatioTypes.INT)) - .addLocal(Patio.val("r", PatioTypes.INT)) - .addBodyInstruction(Patio.allocStack(Patio.localRef("x"), PatioDataLayouts.INT)) - .addBodyInstruction(Patio.memoryStore( - Patio.localRef("x"), - PatioDataLayouts.INT, - List.of(), - Patio.intConst(42) - )) - .addBodyInstruction(Patio.memoryLoad( - Patio.localRef("y"), - Patio.localRef("x"), - PatioDataLayouts.INT, - List.of() - )) - .addBodyInstruction(Patio.intAdd( - Patio.localRef("z"), - Patio.localRef("y"), - Patio.intConst(5) - )) - .addBodyInstruction(Patio.memoryStore( - Patio.localRef("x"), - PatioDataLayouts.INT, - List.of(), - Patio.localRef("z") - )) - .addBodyInstruction(Patio.memoryLoad( - Patio.localRef("r"), - Patio.localRef("x"), - PatioDataLayouts.INT, - List.of() - )) - .addBodyInstruction(emitInt(Patio.localRef("r"))) - .addBodyInstruction(Patio.returnVoid()) - .build(); - var patio = Patio.compilationUnit(List.of(patioFunction)); - - var result = run(patio); - - assertThat(result, isSequence( - isInt(47) - )); - } - @Test public void block() throws IOException, InterruptedException { var patioFunction = PatioFunctionDefinition.builder() diff --git a/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java b/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java index f570b7fc..dcbec92f 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java @@ -138,18 +138,6 @@ public class PatioSerializerTests { // == Instructions == - @Test - public void canSerializeAllocStack() { - var instruction = Patio.allocStack( - Patio.localRef("x"), - PatioDataLayouts.struct(List.of(PatioDataLayouts.INT, PatioDataLayouts.INT, PatioDataLayouts.BYTE)) - ); - - var string = PatioTesting.serializeInstruction(instruction); - - assertThat(string, equalTo("(alloc-stack (local \"x\") (struct (int int byte)))")); - } - @Test public void canSerializeBlock() { var instruction = Patio.block( diff --git a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java index 32cdf769..6980eb2a 100644 --- a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java +++ b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java @@ -14,10 +14,6 @@ import java.util.Optional; public class Patio { private Patio() {} - public static PatioInstruction allocStack(PatioLocalRef destination, PatioDataLayout layout) { - return new PatioAllocStack(destination, layout, Sources.NULL); - } - public static PatioBlock block( List body, List results -- cgit v1.2.3