From 6d380ac1b8aefb00e6be1655a416588e5559bfa0 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 22 Jan 2024 18:52:29 +0000 Subject: Rename const operands to with const suffix --- .../backends/llvm/codegen/PatioToLlvm.java | 24 ++--- .../compiler/backends/wasm/PatioToWasm.java | 24 ++--- .../shedlang/compiler/patio/PatioSerializer.java | 16 ++-- .../compiler/patio/operands/PatioBool.java | 4 - .../compiler/patio/operands/PatioBoolConst.java | 4 + .../compiler/patio/operands/PatioDataPtr.java | 4 - .../compiler/patio/operands/PatioDataPtrConst.java | 4 + .../compiler/patio/operands/PatioFunctionPtr.java | 4 - .../patio/operands/PatioFunctionPtrConst.java | 4 + .../shedlang/compiler/patio/operands/PatioInt.java | 4 - .../compiler/patio/operands/PatioIntConst.java | 4 + .../compiler/patio/operands/PatioOperand.java | 2 +- .../shedlang/compiler/shidtopatio/ShidToPatio.java | 4 +- .../compiler/shidtopatio/ShidToPatioClosures.java | 4 +- .../compiler/shidtopatio/ShidToPatioEffects.java | 12 +-- .../compiler/shidtopatio/ShidToPatioGc.java | 4 +- .../compiler/shidtopatio/ShidToPatioInts.java | 4 +- .../shidtopatio/ShidToPatioNamespaces.java | 16 ++-- .../compiler/shidtopatio/ShidToPatioStrings.java | 6 +- .../compiler/shidtopatio/ShidToPatioStructs.java | 4 +- .../compiler/shidtopatio/ShidToPatioTuples.java | 4 +- .../shedlang/compiler/patio/PatioExampleTests.java | 92 +++++++++--------- .../compiler/patio/PatioSerializerTests.java | 104 ++++++++++----------- .../compiler/patio/instructions/Patio.java | 16 ++-- .../ShidToPatioDefineFunctionTests.java | 4 +- 25 files changed, 186 insertions(+), 186 deletions(-) delete mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioBool.java create mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioBoolConst.java delete mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtr.java create mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtrConst.java delete mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtr.java create mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtrConst.java delete mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioInt.java create mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioIntConst.java (limited to 'src') diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java b/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java index 7d70a90b..71212189 100644 --- a/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java +++ b/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java @@ -1118,16 +1118,16 @@ public class PatioToLlvm { PatioToLlvmFunctionContext context ) { return switch (patioOperand) { - case PatioBool patioBool -> + case PatioBoolConst patioBoolConst -> LlvmTypes.INT_1; - case PatioDataPtr patioDataPtr -> + case PatioDataPtrConst patioDataPtrConst -> LlvmTypes.pointer(LlvmTypes.VOID); - case PatioFunctionPtr patioFunctionPtr -> + case PatioFunctionPtrConst patioFunctionPtrConst -> LlvmTypes.pointer(LlvmTypes.VOID); - case PatioInt patioInt -> + case PatioIntConst patioIntConst -> context.target().patioIntType(); case PatioLocalRef patioLocalRef -> @@ -1140,17 +1140,17 @@ public class PatioToLlvm { PatioToLlvmFunctionContext context ) { return switch (patioOperand) { - case PatioBool patioBool -> - new LlvmOperandInt(patioBool.value() ? 1 : 0); + case PatioBoolConst patioBoolConst -> + new LlvmOperandInt(patioBoolConst.value() ? 1 : 0); - case PatioDataPtr patioDataPtr -> - new LlvmVariableGlobal(patioDataPtr.name()); + case PatioDataPtrConst patioDataPtrConst -> + new LlvmVariableGlobal(patioDataPtrConst.name()); - case PatioFunctionPtr patioFunctionPtr -> - new LlvmVariableGlobal(patioFunctionPtr.name()); + case PatioFunctionPtrConst patioFunctionPtrConst -> + new LlvmVariableGlobal(patioFunctionPtrConst.name()); - case PatioInt patioInt -> - new LlvmOperandInt(patioInt.value()); + case PatioIntConst patioIntConst -> + new LlvmOperandInt(patioIntConst.value()); case PatioLocalRef patioLocalRef -> context.patioLocalToOperand(patioLocalRef); diff --git a/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java b/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java index fcf55e79..66519767 100644 --- a/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java +++ b/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java @@ -554,19 +554,19 @@ public class PatioToWasm { Context context ) { return switch (patioOperand) { - case PatioBool patioBool -> - context.addInstruction(new WasmI32Const(patioBool.value() ? 1 : 0)); + case PatioBoolConst patioBoolConst -> + context.addInstruction(new WasmI32Const(patioBoolConst.value() ? 1 : 0)); - case PatioDataPtr patioDataPtr -> { - var wasmMemoryAddress = new WasmMemoryAddress(patioDataPtr.name()); + case PatioDataPtrConst patioDataPtrConst -> { + var wasmMemoryAddress = new WasmMemoryAddress(patioDataPtrConst.name()); yield context.addInstruction(new WasmMemoryAddressConst( context.target.indexType(), wasmMemoryAddress )); } - case PatioFunctionPtr patioFunctionPtr -> { - var wasmFuncName = new WasmFuncName(patioFunctionPtr.name()); + case PatioFunctionPtrConst patioFunctionPtrConst -> { + var wasmFuncName = new WasmFuncName(patioFunctionPtrConst.name()); context = context .addInstruction(new WasmTableElementIndexConst(wasmFuncName)); @@ -577,10 +577,10 @@ public class PatioToWasm { yield context; } - case PatioInt patioInt -> + case PatioIntConst patioIntConst -> context.addInstruction(wasmIntConst( context.target.patioIntType(), - patioInt.value() + patioIntConst.value() )); case PatioLocalRef patioLocalRef -> { @@ -752,13 +752,13 @@ public class PatioToWasm { ) { // TODO: push into PatioOperand? return switch (operand) { - case PatioBool patioBool -> + case PatioBoolConst patioBoolConst -> patioTypeToWasmValueType(PatioTypes.BOOL, context.target); - case PatioDataPtr patioDataPtr -> + case PatioDataPtrConst patioDataPtrConst -> patioTypeToWasmValueType(PatioTypes.DATA_POINTER, context.target); - case PatioFunctionPtr patioFunctionPtr -> + case PatioFunctionPtrConst patioFunctionPtrConst -> patioTypeToWasmValueType(PatioTypes.FUNCTION_POINTER, context.target); - case PatioInt patioInt -> + case PatioIntConst patioIntConst -> patioTypeToWasmValueType(PatioTypes.INT, context.target); case PatioLocalRef patioLocalRef -> context.wasmLocalType(patioLocalRef); diff --git a/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java b/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java index 3203993b..c770cd21 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java @@ -421,17 +421,17 @@ public class PatioSerializer { private static Tree operandToTree(PatioOperand operand) { return switch (operand) { - case PatioBool bool -> - treeList(treeIdentifier("bool"), treeBool(bool.value())); + case PatioBoolConst bool -> + treeList(treeIdentifier("bool-const"), treeBool(bool.value())); - case PatioDataPtr dataPtr -> - treeList(treeIdentifier("data-ptr"), treeString(dataPtr.name())); + case PatioDataPtrConst dataPtr -> + treeList(treeIdentifier("data-ptr-const"), treeString(dataPtr.name())); - case PatioFunctionPtr functionPtr -> - treeList(treeIdentifier("function-ptr"), treeString(functionPtr.name())); + case PatioFunctionPtrConst functionPtr -> + treeList(treeIdentifier("function-ptr-const"), treeString(functionPtr.name())); - case PatioInt int_ -> - treeList(treeIdentifier("int"), treeInt(int_.value())); + case PatioIntConst int_ -> + treeList(treeIdentifier("int-const"), treeInt(int_.value())); case PatioLocalRef localRef -> treeList(treeIdentifier("local"), treeString(localRef.name())); diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioBool.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioBool.java deleted file mode 100644 index 769667c1..00000000 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioBool.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.shedlang.compiler.patio.operands; - -public record PatioBool(boolean value) implements PatioOperand { -} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioBoolConst.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioBoolConst.java new file mode 100644 index 00000000..eadb7e1c --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioBoolConst.java @@ -0,0 +1,4 @@ +package org.shedlang.compiler.patio.operands; + +public record PatioBoolConst(boolean value) implements PatioOperand { +} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtr.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtr.java deleted file mode 100644 index 9907733b..00000000 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtr.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.shedlang.compiler.patio.operands; - -public record PatioDataPtr(String name) implements PatioOperand { -} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtrConst.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtrConst.java new file mode 100644 index 00000000..3899b380 --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtrConst.java @@ -0,0 +1,4 @@ +package org.shedlang.compiler.patio.operands; + +public record PatioDataPtrConst(String name) implements PatioOperand { +} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtr.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtr.java deleted file mode 100644 index b025089e..00000000 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtr.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.shedlang.compiler.patio.operands; - -public record PatioFunctionPtr(String name) implements PatioOperand { -} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtrConst.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtrConst.java new file mode 100644 index 00000000..2457163f --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtrConst.java @@ -0,0 +1,4 @@ +package org.shedlang.compiler.patio.operands; + +public record PatioFunctionPtrConst(String name) implements PatioOperand { +} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioInt.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioInt.java deleted file mode 100644 index 4191def2..00000000 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioInt.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.shedlang.compiler.patio.operands; - -public record PatioInt(int value) implements PatioOperand { -} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioIntConst.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioIntConst.java new file mode 100644 index 00000000..d7734096 --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioIntConst.java @@ -0,0 +1,4 @@ +package org.shedlang.compiler.patio.operands; + +public record PatioIntConst(int value) implements PatioOperand { +} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioOperand.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioOperand.java index 3bd1849c..17ffb0e4 100644 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioOperand.java +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioOperand.java @@ -1,5 +1,5 @@ package org.shedlang.compiler.patio.operands; -public sealed interface PatioOperand permits PatioBool, PatioDataPtr, PatioFunctionPtr, PatioInt, PatioLocalRef { +public sealed interface PatioOperand permits PatioBoolConst, PatioDataPtrConst, PatioFunctionPtrConst, PatioIntConst, PatioLocalRef { } diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java index 66d9c3be..438ebac3 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java @@ -3,7 +3,7 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.patio.PatioCompilationUnit; import org.shedlang.compiler.patio.PatioVisibility; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioTypes; @@ -1008,7 +1008,7 @@ public class ShidToPatio { context = localResult.context(); return context - .addInstruction(new PatioLocalStore(local, new PatioInt(value), source)) + .addInstruction(new PatioLocalStore(local, new PatioIntConst(value), source)) .temporaryPush(local); } } diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java index 43b19744..b1d40a87 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java @@ -4,7 +4,7 @@ import org.shedlang.compiler.ast.typed.FreeVariable; import org.shedlang.compiler.ast.typed.FreeVariables; import org.shedlang.compiler.patio.PatioVisibility; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioFunctionPtr; +import org.shedlang.compiler.patio.operands.PatioFunctionPtrConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayout; @@ -176,7 +176,7 @@ class ShidToPatioClosures { closurePointer, layout, FUNCTION_POINTER_OFFSET, - new PatioFunctionPtr(functionName), + new PatioFunctionPtrConst(functionName), source )); diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java index fb113850..51f198e3 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java @@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.PatioExceptionTypeDefinition; import org.shedlang.compiler.patio.PatioFunctionDeclaration; import org.shedlang.compiler.patio.PatioLocal; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayout; @@ -187,8 +187,8 @@ public class ShidToPatioEffects { Optional.of(handlerMethod), FIND_HANDLER_METHOD_DECLARATION.name(), List.of( - new PatioInt(bodyContext.effectTag(effect)), - new PatioInt(method.fieldIndex()) + new PatioIntConst(bodyContext.effectTag(effect)), + new PatioIntConst(method.fieldIndex()) ), source )); @@ -307,8 +307,8 @@ public class ShidToPatioEffects { Optional.of(effectHandler), PUSH_HANDLER_DECLARATION.name(), List.of( - new PatioInt(context.effectTag(effect)), - new PatioInt(effectInfo.methodCount()) + new PatioIntConst(context.effectTag(effect)), + new PatioIntConst(effectInfo.methodCount()) ), source )); @@ -319,7 +319,7 @@ public class ShidToPatioEffects { SET_HANDLER_METHOD_DECLARATION.name(), List.of( effectHandler, - new PatioInt(handlerMethodInfo.fieldIndex()), + new PatioIntConst(handlerMethodInfo.fieldIndex()), handlerMethodsByName.get(handlerMethodInfo.name()) ), source diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java index 8dd36463..32971b8b 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java @@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.PatioLocal; import org.shedlang.compiler.patio.instructions.PatioByteOffsetOf; import org.shedlang.compiler.patio.instructions.PatioByteSizeOf; import org.shedlang.compiler.patio.instructions.PatioCall; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.*; @@ -164,7 +164,7 @@ public class ShidToPatioGc { return context.addInstruction(new PatioCall( Optional.of(destination), ALLOC.name(), - List.of(size, offset, new PatioInt(childrenCount)), + List.of(size, offset, new PatioIntConst(childrenCount)), source )); } diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java index 77dada45..fee88bec 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java @@ -3,7 +3,7 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.patio.PatioFunctionDeclaration; import org.shedlang.compiler.patio.PatioLocal; import org.shedlang.compiler.patio.instructions.PatioCall; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioType; @@ -81,7 +81,7 @@ public class ShidToPatioInts { .addInstruction(new PatioCall( Optional.of(destination), INT_CREATE_DECLARATION.name(), - List.of(new PatioInt(value.intValueExact())), + List.of(new PatioIntConst(value.intValueExact())), source )); } diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java index c12a25bb..913bb966 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java @@ -3,8 +3,8 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.patio.PatioFunctionDeclaration; import org.shedlang.compiler.patio.PatioVisibility; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioBool; -import org.shedlang.compiler.patio.operands.PatioDataPtr; +import org.shedlang.compiler.patio.operands.PatioBoolConst; +import org.shedlang.compiler.patio.operands.PatioDataPtrConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.*; @@ -66,7 +66,7 @@ public class ShidToPatioNamespaces { ); initContext = initContext.addInstruction(new PatioMemoryStore( - new PatioDataPtr(globalNameNamespaceValue(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceValue(namespaceName)), PatioDataLayouts.DATA_POINTER, List.of(), namespaceValue, @@ -76,10 +76,10 @@ public class ShidToPatioNamespaces { initContext = generateInitBody.apply(initContext); initContext = initContext.addInstruction(new PatioMemoryStore( - new PatioDataPtr(globalNameNamespaceIsInited(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceIsInited(namespaceName)), PatioDataLayouts.BOOL, List.of(), - new PatioBool(true), + new PatioBoolConst(true), source )); @@ -104,7 +104,7 @@ public class ShidToPatioNamespaces { importContext = importContext.addInstruction(new PatioMemoryLoad( isInited, - new PatioDataPtr(globalNameNamespaceIsInited(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceIsInited(namespaceName)), PatioDataLayouts.BOOL, List.of(), source @@ -142,7 +142,7 @@ public class ShidToPatioNamespaces { importContext = importContext.addInstruction(new PatioMemoryLoad( namespaceValuePointer, - new PatioDataPtr(globalNameNamespaceValue(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceValue(namespaceName)), PatioDataLayouts.DATA_POINTER, List.of(), source @@ -251,7 +251,7 @@ public class ShidToPatioNamespaces { context = context.addInstruction(new PatioMemoryLoad( namespaceValue, - new PatioDataPtr(globalNameNamespaceValue(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceValue(namespaceName)), PatioDataLayouts.DATA_POINTER, List.of(), source diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java index af037ae6..a1c7d9bf 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java @@ -4,7 +4,7 @@ import org.shedlang.compiler.patio.PatioDataElementImmutable; import org.shedlang.compiler.patio.PatioFunctionDeclaration; import org.shedlang.compiler.patio.PatioLocal; import org.shedlang.compiler.patio.instructions.PatioCall; -import org.shedlang.compiler.patio.operands.PatioDataPtr; +import org.shedlang.compiler.patio.operands.PatioDataPtrConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayouts; @@ -31,7 +31,7 @@ public class ShidToPatioStrings { private ShidToPatioStrings() {} - public static ShidToPatioResult define( + public static ShidToPatioResult define( String value, Source source, ShidToPatioContext context @@ -60,7 +60,7 @@ public class ShidToPatioStrings { source )); - return context.toResult(new PatioDataPtr(elementName)); + return context.toResult(new PatioDataPtrConst(elementName)); } public static ShidToPatioContext add( diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java index 7146320d..0e36f05c 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java @@ -2,7 +2,7 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.ast.typed.FreeVariables; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayout; @@ -59,7 +59,7 @@ public class ShidToPatioStructs { valuePointer, structDataLayout, TAG_OFFSET, - new PatioInt(context.structTag(type)), + new PatioIntConst(context.structTag(type)), source )); diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java index acf24c08..e86bc366 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java @@ -1,7 +1,7 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayout; @@ -31,7 +31,7 @@ public class ShidToPatioTuples { if (elements.size() == 0) { context = context.addInstruction(new PatioLocalStore( tuple, - new PatioInt(0), + new PatioIntConst(0), source )); diff --git a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java index 3b894f3a..6a5545ab 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java @@ -31,7 +31,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("x", PatioTypes.INT)) .addBodyInstruction(Patio.memoryLoad( Patio.localRef("x"), - Patio.dataPtr("answer"), + Patio.dataPtrConst("answer"), PatioDataLayouts.INT, List.of() )) @@ -66,7 +66,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("x", PatioTypes.INT)) .addBodyInstruction(Patio.memoryLoad( Patio.localRef("x"), - Patio.dataPtr("answer"), + Patio.dataPtrConst("answer"), PatioDataLayouts.struct(List.of( PatioDataLayouts.INT, PatioDataLayouts.INT, @@ -102,7 +102,7 @@ public abstract class PatioExampleTests { Patio.localRef("x"), PatioDataLayouts.INT, List.of(), - Patio.int_(42) + Patio.intConst(42) )) .addBodyInstruction(Patio.memoryLoad( Patio.localRef("y"), @@ -113,7 +113,7 @@ public abstract class PatioExampleTests { .addBodyInstruction(Patio.intAdd( Patio.localRef("z"), Patio.localRef("y"), - Patio.int_(5) + Patio.intConst(5) )) .addBodyInstruction(Patio.memoryStore( Patio.localRef("x"), @@ -148,7 +148,7 @@ public abstract class PatioExampleTests { List.of( Patio.localStore( Patio.localRef("x"), - Patio.int_(42) + Patio.intConst(42) ) ), List.of(Patio.localRef("x")) @@ -173,7 +173,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("r", PatioTypes.INT)) .addBodyInstruction(Patio.localStore( Patio.localRef("x"), - Patio.bool(false) + Patio.boolConst(false) )) .addBodyInstruction(Patio.boolToInt( Patio.localRef("y"), @@ -186,8 +186,8 @@ public abstract class PatioExampleTests { .addBodyInstruction(Patio.if_( List.of(Patio.localRef("r")), Patio.localRef("z"), - Patio.block(List.of(), List.of(Patio.int_(42))), - Patio.block(List.of(), List.of(Patio.int_(47))) + Patio.block(List.of(), List.of(Patio.intConst(42))), + Patio.block(List.of(), List.of(Patio.intConst(47))) )) .addBodyInstruction(Patio.return_(Patio.localRef("r"))) .build(); @@ -209,7 +209,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("r", PatioTypes.INT)) .addBodyInstruction(Patio.localStore( Patio.localRef("x"), - Patio.bool(true) + Patio.boolConst(true) )) .addBodyInstruction(Patio.boolToInt( Patio.localRef("y"), @@ -222,8 +222,8 @@ public abstract class PatioExampleTests { .addBodyInstruction(Patio.if_( List.of(Patio.localRef("r")), Patio.localRef("z"), - Patio.block(List.of(), List.of(Patio.int_(42))), - Patio.block(List.of(), List.of(Patio.int_(47))) + Patio.block(List.of(), List.of(Patio.intConst(42))), + Patio.block(List.of(), List.of(Patio.intConst(47))) )) .addBodyInstruction(Patio.return_(Patio.localRef("r"))) .build(); @@ -244,11 +244,11 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("z", PatioTypes.INT)) .addBodyInstruction(Patio.localStore( Patio.localRef("x"), - Patio.int_(42) + Patio.intConst(42) )) .addBodyInstruction(Patio.localStore( Patio.localRef("y"), - Patio.int_(5) + Patio.intConst(5) )) .addBodyInstruction(Patio.intAdd( Patio.localRef("z"), @@ -274,13 +274,13 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("x2", PatioTypes.INT)) .addBodyInstruction(Patio.switch_( List.of(Patio.localRef("x")), - Patio.int_(2), + Patio.intConst(2), List.of( Patio.switchCase( 1, Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(42)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(42)) ), List.of(Patio.localRef("x1")) ) @@ -289,7 +289,7 @@ public abstract class PatioExampleTests { 2, Patio.block( List.of( - Patio.localStore(Patio.localRef("x2"), Patio.int_(47)) + Patio.localStore(Patio.localRef("x2"), Patio.intConst(47)) ), List.of(Patio.localRef("x2")) ) @@ -319,13 +319,13 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("x2", PatioTypes.INT)) .addBodyInstruction(Patio.switch_( List.of(Patio.localRef("x")), - Patio.int_(2), + Patio.intConst(2), List.of( Patio.switchCase( 1, Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(42)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(42)) ), List.of(Patio.localRef("x1")) ) @@ -333,7 +333,7 @@ public abstract class PatioExampleTests { ), Patio.block( List.of( - Patio.localStore(Patio.localRef("x2"), Patio.int_(47)) + Patio.localStore(Patio.localRef("x2"), Patio.intConst(47)) ), List.of(Patio.localRef("x2")) ) @@ -364,13 +364,13 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), Patio.block( List.of(), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) )) .addBodyInstruction(Patio.return_( @@ -404,7 +404,7 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), @@ -418,15 +418,15 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) ) ), @@ -464,7 +464,7 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ), Patio.catchClause( @@ -472,15 +472,15 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of( - Patio.throw_("Error2", Patio.int_(0)) + Patio.throw_("Error2", Patio.intConst(0)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) )) .addBodyInstruction(Patio.return_( @@ -515,7 +515,7 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), @@ -529,15 +529,15 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) ) ), @@ -576,7 +576,7 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), @@ -590,17 +590,17 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) ) ), @@ -638,7 +638,7 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), @@ -652,16 +652,16 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of(), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) ), - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), List.of(Patio.localRef("r2")) ) @@ -701,9 +701,9 @@ public abstract class PatioExampleTests { ), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(1)) + Patio.throw_("Error", Patio.intConst(1)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) )) .addBodyInstruction(Patio.return_( @@ -731,7 +731,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("r", PatioTypes.INT)) .addBodyInstruction(Patio.varStore( Patio.localRef("x"), - Patio.int_(42) + Patio.intConst(42) )) .addBodyInstruction(Patio.varLoad( Patio.localRef("y"), @@ -740,7 +740,7 @@ public abstract class PatioExampleTests { .addBodyInstruction(Patio.intAdd( Patio.localRef("z"), Patio.localRef("y"), - Patio.int_(5) + Patio.intConst(5) )) .addBodyInstruction(Patio.varStore( Patio.localRef("x"), diff --git a/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java b/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java index 071007f9..a1be788c 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java @@ -112,7 +112,7 @@ public class PatioSerializerTests { .addLocal(Patio.val("local1", PatioTypes.FUNCTION_POINTER)) .addLocal(Patio.val("local2", PatioTypes.INT)) .withReturnType(PatioTypes.VOID) - .addBodyInstruction(Patio.localStore(Patio.localRef("local2"), Patio.int_(2))) + .addBodyInstruction(Patio.localStore(Patio.localRef("local2"), Patio.intConst(2))) .build(); var string = PatioTesting.serializeCompilationUnitElement(element); @@ -125,7 +125,7 @@ public class PatioSerializerTests { locals=((param "param1" int) (param "param2" data-ptr) (val "local1" function-ptr) (val "local2" int)) return-type=void body=( - (local-store (local "local2") (int 2)) + (local-store (local "local2") (int-const 2)) ) )""" )); @@ -149,8 +149,8 @@ public class PatioSerializerTests { public void canSerializeBlock() { var instruction = Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(1)), - Patio.localStore(Patio.localRef("y1"), Patio.int_(2)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(1)), + Patio.localStore(Patio.localRef("y1"), Patio.intConst(2)) ), List.of( Patio.localRef("x1"), @@ -164,8 +164,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x1") (int 1)) - (local-store (local "y1") (int 2)) + (local-store (local "x1") (int-const 1)) + (local-store (local "y1") (int-const 2)) ) results=((local "x1") (local "y1")) )""")); @@ -290,8 +290,8 @@ public class PatioSerializerTests { Patio.localRef("condition"), Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(1)), - Patio.localStore(Patio.localRef("y1"), Patio.int_(2)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(1)), + Patio.localStore(Patio.localRef("y1"), Patio.intConst(2)) ), List.of( Patio.localRef("x1"), @@ -300,8 +300,8 @@ public class PatioSerializerTests { ), Patio.block( List.of( - Patio.localStore(Patio.localRef("x2"), Patio.int_(11)), - Patio.localStore(Patio.localRef("y2"), Patio.int_(12)) + Patio.localStore(Patio.localRef("x2"), Patio.intConst(11)), + Patio.localStore(Patio.localRef("y2"), Patio.intConst(12)) ), List.of( Patio.localRef("x2"), @@ -320,16 +320,16 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x1") (int 1)) - (local-store (local "y1") (int 2)) + (local-store (local "x1") (int-const 1)) + (local-store (local "y1") (int-const 2)) ) results=((local "x1") (local "y1")) ) ( block ( - (local-store (local "x2") (int 11)) - (local-store (local "y2") (int 12)) + (local-store (local "x2") (int-const 11)) + (local-store (local "y2") (int-const 12)) ) results=((local "x2") (local "y2")) ) @@ -433,7 +433,7 @@ public class PatioSerializerTests { public void canSerializeLoop() { var instruction = Patio.loop( List.of( - Patio.localStore(Patio.localRef("x"), Patio.int_(1)) + Patio.localStore(Patio.localRef("x"), Patio.intConst(1)) ) ); @@ -443,7 +443,7 @@ public class PatioSerializerTests { ( loop ( - (local-store (local "x") (int 1)) + (local-store (local "x") (int-const 1)) ) )""")); } @@ -550,8 +550,8 @@ public class PatioSerializerTests { 1, Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(11)), - Patio.localStore(Patio.localRef("y1"), Patio.int_(12)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(11)), + Patio.localStore(Patio.localRef("y1"), Patio.intConst(12)) ), List.of( Patio.localRef("x1"), @@ -563,8 +563,8 @@ public class PatioSerializerTests { 2, Patio.block( List.of( - Patio.localStore(Patio.localRef("x2"), Patio.int_(21)), - Patio.localStore(Patio.localRef("y2"), Patio.int_(22)) + Patio.localStore(Patio.localRef("x2"), Patio.intConst(21)), + Patio.localStore(Patio.localRef("y2"), Patio.intConst(22)) ), List.of( Patio.localRef("x2"), @@ -575,8 +575,8 @@ public class PatioSerializerTests { ), Patio.block( List.of( - Patio.localStore(Patio.localRef("x3"), Patio.int_(31)), - Patio.localStore(Patio.localRef("y3"), Patio.int_(32)) + Patio.localStore(Patio.localRef("x3"), Patio.intConst(31)), + Patio.localStore(Patio.localRef("y3"), Patio.intConst(32)) ), List.of( Patio.localRef("x3"), @@ -599,8 +599,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x1") (int 11)) - (local-store (local "y1") (int 12)) + (local-store (local "x1") (int-const 11)) + (local-store (local "y1") (int-const 12)) ) results=((local "x1") (local "y1")) ) @@ -611,8 +611,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x2") (int 21)) - (local-store (local "y2") (int 22)) + (local-store (local "x2") (int-const 21)) + (local-store (local "y2") (int-const 22)) ) results=((local "x2") (local "y2")) ) @@ -621,8 +621,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x3") (int 31)) - (local-store (local "y3") (int 32)) + (local-store (local "x3") (int-const 31)) + (local-store (local "y3") (int-const 32)) ) results=((local "x3") (local "y3")) ) @@ -649,8 +649,8 @@ public class PatioSerializerTests { Patio.localRef("a1"), Patio.block( List.of( - Patio.localStore(Patio.localRef("xCatch1"), Patio.int_(11)), - Patio.localStore(Patio.localRef("yCatch1"), Patio.int_(12)) + Patio.localStore(Patio.localRef("xCatch1"), Patio.intConst(11)), + Patio.localStore(Patio.localRef("yCatch1"), Patio.intConst(12)) ), List.of(Patio.localRef("xCatch1"), Patio.localRef("yCatch1")) ) @@ -660,8 +660,8 @@ public class PatioSerializerTests { Patio.localRef("a2"), Patio.block( List.of( - Patio.localStore(Patio.localRef("xCatch2"), Patio.int_(21)), - Patio.localStore(Patio.localRef("yCatch2"), Patio.int_(22)) + Patio.localStore(Patio.localRef("xCatch2"), Patio.intConst(21)), + Patio.localStore(Patio.localRef("yCatch2"), Patio.intConst(22)) ), List.of(Patio.localRef("xCatch2"), Patio.localRef("yCatch2")) ) @@ -669,8 +669,8 @@ public class PatioSerializerTests { ), Patio.block( List.of( - Patio.localStore(Patio.localRef("xTry"), Patio.int_(31)), - Patio.localStore(Patio.localRef("yTry"), Patio.int_(32)) + Patio.localStore(Patio.localRef("xTry"), Patio.intConst(31)), + Patio.localStore(Patio.localRef("yTry"), Patio.intConst(32)) ), List.of(Patio.localRef("xTry"), Patio.localRef("yTry")) ) @@ -690,8 +690,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "xCatch1") (int 11)) - (local-store (local "yCatch1") (int 12)) + (local-store (local "xCatch1") (int-const 11)) + (local-store (local "yCatch1") (int-const 12)) ) results=((local "xCatch1") (local "yCatch1")) ) @@ -703,8 +703,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "xCatch2") (int 21)) - (local-store (local "yCatch2") (int 22)) + (local-store (local "xCatch2") (int-const 21)) + (local-store (local "yCatch2") (int-const 22)) ) results=((local "xCatch2") (local "yCatch2")) ) @@ -713,8 +713,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "xTry") (int 31)) - (local-store (local "yTry") (int 32)) + (local-store (local "xTry") (int-const 31)) + (local-store (local "yTry") (int-const 32)) ) results=((local "xTry") (local "yTry")) ) @@ -757,39 +757,39 @@ public class PatioSerializerTests { // == Operands == @Test - public void canSerializeBool() { - var operand = Patio.bool(true); + public void canSerializeBoolConst() { + var operand = Patio.boolConst(true); var string = PatioTesting.serializeOperand(operand); - assertThat(string, equalTo("(bool true)")); + assertThat(string, equalTo("(bool-const true)")); } @Test - public void canSerializeDataPtr() { - var operand = Patio.dataPtr("x"); + public void canSerializeDataPtrConst() { + var operand = Patio.dataPtrConst("x"); var string = PatioTesting.serializeOperand(operand); - assertThat(string, equalTo("(data-ptr \"x\")")); + assertThat(string, equalTo("(data-ptr-const \"x\")")); } @Test - public void canSerializeFunctionPtr() { - var operand = Patio.functionPtr("x"); + public void canSerializeFunctionPtrConst() { + var operand = Patio.functionPtrConst("x"); var string = PatioTesting.serializeOperand(operand); - assertThat(string, equalTo("(function-ptr \"x\")")); + assertThat(string, equalTo("(function-ptr-const \"x\")")); } @Test - public void canSerializeInt() { - var operand = Patio.int_(42); + public void canSerializeIntConst() { + var operand = Patio.intConst(42); var string = PatioTesting.serializeOperand(operand); - assertThat(string, equalTo("(int 42)")); + assertThat(string, equalTo("(int-const 42)")); } @Test 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 49f35768..68bba360 100644 --- a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java +++ b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java @@ -24,8 +24,8 @@ public class Patio { return new PatioBlock(body, results, Sources.NULL); } - public static PatioOperand bool(boolean value) { - return new PatioBool(value); + public static PatioOperand boolConst(boolean value) { + return new PatioBoolConst(value); } public static PatioInstruction boolToInt(PatioLocalRef destination, PatioOperand value) { @@ -115,8 +115,8 @@ public class Patio { return new PatioDataElementMutable(name, initialValue, Sources.NULL); } - public static PatioOperand dataPtr(String name) { - return new PatioDataPtr(name); + public static PatioOperand dataPtrConst(String name) { + return new PatioDataPtrConst(name); } public static PatioInstruction dataPtrToInt(PatioLocalRef destination, PatioOperand value) { @@ -131,8 +131,8 @@ public class Patio { return new PatioExceptionTypeDefinition(name, valueType, Sources.NULL); } - public static PatioOperand functionPtr(String name) { - return new PatioFunctionPtr(name); + public static PatioOperand functionPtrConst(String name) { + return new PatioFunctionPtrConst(name); } public static PatioInstruction if_( @@ -150,8 +150,8 @@ public class Patio { ); } - public static PatioOperand int_(int value) { - return new PatioInt(value); + public static PatioOperand intConst(int value) { + return new PatioIntConst(value); } public static PatioInstruction intAdd( diff --git a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioDefineFunctionTests.java b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioDefineFunctionTests.java index 797a8442..2bd24199 100644 --- a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioDefineFunctionTests.java +++ b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioDefineFunctionTests.java @@ -86,9 +86,9 @@ public class ShidToPatioDefineFunctionTests { // free variables so we can distinguish the free variable being copied // into the closure upon closure creation (i.e. too soon) versus after // the free variable is set. - context = context.addInstruction(Patio.localStore(Patio.localRef("a"), Patio.int_(42))); + context = context.addInstruction(Patio.localStore(Patio.localRef("a"), Patio.intConst(42))); context = context.initShidLocal("a"); - context = context.addInstruction(Patio.localStore(Patio.localRef("b"), Patio.int_(47))); + context = context.addInstruction(Patio.localStore(Patio.localRef("b"), Patio.intConst(47))); context = context.initShidLocal("b"); snapshotter.assertSnapshot(serialize(context)); -- cgit v1.2.3