aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-16 13:29:07 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-16 13:29:07 +0000
commit16b74100b42d59379a2983c9bef2f6357c2376d3 (patch)
tree0870f4a4e30dbee3ac8d7bf6029728ce8b0f3959 /src/main/java
parent071fb90e7d12c6cc177fd9414584ee47679e2dc5 (diff)
Extract PatioCodeGenTuples::elementOffset()
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java
index 9e2f7421..44a6397f 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenTuples.java
@@ -60,7 +60,7 @@ public class PatioCodeGenTuples {
context = context.addInstruction(new PatioMemoryStore(
tuplePointer,
tupleLayout,
- List.of(elementIndex),
+ elementOffset(elementIndex),
element,
source
));
@@ -107,13 +107,17 @@ public class PatioCodeGenTuples {
target,
tuplePointer,
tupleDataLayout(elementCount),
- List.of(elementIndex),
+ elementOffset(elementIndex),
source
));
return context.toResult(target);
}
+ private static List<Integer> elementOffset(int elementIndex) {
+ return List.of(elementIndex);
+ }
+
private static PatioDataLayout tupleDataLayout(int elementCount) {
return PatioDataLayouts.struct(Lists.repeat(
PatioDataLayouts.INT,