diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-29 10:46:34 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-29 10:47:00 +0100 |
| commit | cfbdb4b8873a218519ac74d59195615edcd3e88a (patch) | |
| tree | 0c942804ebfa6d0e819d4e8f931aba4730b726f5 /src/main/java | |
| parent | 7367e30043ab9de09fafdb72e5fab6bac4debb9a (diff) | |
Rename Patio instruction alloc to alloc-heap
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java | 6 | ||||
| -rw-r--r-- | src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java | 6 | ||||
| -rw-r--r-- | src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java | 2 | ||||
| -rw-r--r-- | src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java | 8 | ||||
| -rw-r--r-- | src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAllocHeap.java (renamed from src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAlloc.java) | 6 | ||||
| -rw-r--r-- | src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java | 2 |
6 files changed, 15 insertions, 15 deletions
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java index 8b3d4a4b..8ba153de 100644 --- a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java +++ b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java @@ -179,12 +179,12 @@ public class LlvmPatioCodeGen { FunctionContext context ) { return switch (patioInstruction) { - case PatioAlloc patioAlloc -> { - var sizeResult = sizeOf(patioDataLayoutToLlvmType(patioAlloc.layout()), context); + case PatioAllocHeap patioAllocHeap -> { + var sizeResult = sizeOf(patioDataLayoutToLlvmType(patioAllocHeap.layout()), context); var size = sizeResult.value; context = sizeResult.context; - var targetResult = context.addPatioLocalToLlvmLocal(patioAlloc.target()); + var targetResult = context.addPatioLocalToLlvmLocal(patioAllocHeap.target()); var target = targetResult.value; context = targetResult.context; diff --git a/src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java b/src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java index 529a2198..d559ece4 100644 --- a/src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java +++ b/src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java @@ -120,11 +120,11 @@ public class WasmPatioCodeGen { Context context ) { return switch (patioInstruction) { - case PatioAlloc patioAlloc -> { + case PatioAllocHeap patioAllocHeap -> { context = context - .addInstruction(new WasmI32Const(sizeOf(patioAlloc.layout()))) + .addInstruction(new WasmI32Const(sizeOf(patioAllocHeap.layout()))) .addInstruction(new WasmCall(new WasmFuncName(ALLOC_NAME))) - .addInstruction(new WasmLocalSet(context.wasmLocalIndex(patioAlloc.target()))); + .addInstruction(new WasmLocalSet(context.wasmLocalIndex(patioAllocHeap.target()))); yield context; } diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java index 8c9c242e..c0cb41ea 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java @@ -105,7 +105,7 @@ class PatioCodeGenClosures { var closurePointer = closurePointerResult.value(); context = closurePointerResult.context(); - context = context.addInstruction(new PatioAlloc(closurePointer, layout, source)); + context = context.addInstruction(new PatioAllocHeap(closurePointer, layout, source)); context = context.addInstruction(new PatioMemoryStore( closurePointer, diff --git a/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java b/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java index d0826348..e5cf29b1 100644 --- a/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java +++ b/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java @@ -138,11 +138,11 @@ public class PatioSerializer { private static Tree instructionToTree(PatioInstruction instruction) { return switch (instruction) { - case PatioAlloc alloc -> + case PatioAllocHeap allocHeap -> treeList( - treeIdentifier("alloc"), - operandToTree(alloc.target()), - dataLayoutToTree(alloc.layout()) + treeIdentifier("alloc-heap"), + operandToTree(allocHeap.target()), + dataLayoutToTree(allocHeap.layout()) ); case PatioBoolToInt boolToInt -> diff --git a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAlloc.java b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAllocHeap.java index dd5bde56..aee64781 100644 --- a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAlloc.java +++ b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAllocHeap.java @@ -5,10 +5,10 @@ import org.shedlang.compiler.patio.ast.types.PatioDataLayout; import org.shedlang.compiler.sources.Source; /** - * Allocate space for the given data layout, and store the pointer to the - * allocated memory in the target local. + * Allocate space on the heap for the given data layout, and store the pointer + * to the allocated memory in the target local. */ -public record PatioAlloc( +public record PatioAllocHeap( PatioLocalRef target, PatioDataLayout layout, Source source diff --git a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java index 3dcc516e..cd3fb874 100644 --- a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java +++ b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java @@ -2,6 +2,6 @@ package org.shedlang.compiler.patio.ast.instructions; import org.shedlang.compiler.sources.Source; -public sealed interface PatioInstruction permits PatioAlloc, PatioBoolToInt, PatioCall, PatioCallPointer, PatioDataPtrToInt, PatioIf, PatioIntAdd, PatioIntEquals, PatioIntNotEqual, PatioIntSub, PatioIntToBool, PatioIntToDataPtr, PatioLocalStore, PatioMemoryLoad, PatioMemoryStore, PatioReturn { +public sealed interface PatioInstruction permits PatioAllocHeap, PatioBoolToInt, PatioCall, PatioCallPointer, PatioDataPtrToInt, PatioIf, PatioIntAdd, PatioIntEquals, PatioIntNotEqual, PatioIntSub, PatioIntToBool, PatioIntToDataPtr, PatioLocalStore, PatioMemoryLoad, PatioMemoryStore, PatioReturn { Source source(); } |
