aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-16 14:27:54 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-16 14:28:06 +0000
commitfeeb048fe9ab2e2d9f748a6028a8ca05d8a8eacf (patch)
treee39e0a2e2918ae310dd5f8ab8117903a71a6243e
parent9458a3b5676bc78eac5807a878b9d8536035d6e2 (diff)
Make user defined effects GC objects
-rw-r--r--snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected10
-rw-r--r--snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForUserDefinedEffectFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java6
3 files changed, 10 insertions, 10 deletions
diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
index 4bb1c523..401ed700 100644
--- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
+++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
@@ -59,7 +59,7 @@ Locals:
Instructions:
(
- (alloc-heap (local "userDefinedEffectPointer__State__0") (struct (int int)))
+ (alloc-heap (local "userDefinedEffectPointer__State__0") (struct (data-ptr (struct (int int)))))
(alloc-heap (local "closurePointer__read__0") (struct (data-ptr (struct (function-ptr (struct ()) (struct ()))))))
(
memory-store
@@ -72,8 +72,8 @@ Instructions:
(
memory-store
pointer=(local "userDefinedEffectPointer__State__0")
- layout=(struct (int int))
- offset=(0)
+ layout=(struct (data-ptr (struct (int int))))
+ offset=(1 0)
value=(local "userDefinedMethod__read__0")
)
(alloc-heap (local "closurePointer__write__0") (struct (data-ptr (struct (function-ptr (struct ()) (struct ()))))))
@@ -88,8 +88,8 @@ Instructions:
(
memory-store
pointer=(local "userDefinedEffectPointer__State__0")
- layout=(struct (int int))
- offset=(1)
+ layout=(struct (data-ptr (struct (int int))))
+ offset=(1 1)
value=(local "userDefinedMethod__write__0")
)
(data-ptr-to-int (local "userDefinedEffect__State__0") (local "userDefinedEffectPointer__State__0"))
diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForUserDefinedEffectFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForUserDefinedEffectFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
index dbd97455..cbdc2fba 100644
--- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForUserDefinedEffectFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
+++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForUserDefinedEffectFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
@@ -13,8 +13,8 @@ Instructions:
memory-load
(local "tmp__fence__0")
pointer=(local "userDefinedEffectPointer__0")
- layout=(struct (int int int))
- offset=(1)
+ layout=(struct (data-ptr (struct (int int int))))
+ offset=(1 1)
)
)
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java
index f1897264..1c763f17 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java
@@ -50,14 +50,14 @@ public class PatioCodeGenEffects {
PatioCodeGenContext context
) {
var effectInfo = context.userDefinedEffectInfo(effect);
- return PatioDataLayouts.struct(Lists.repeat(
+ return PatioCodeGenGc.gcObjectDataLayout(PatioDataLayouts.struct(Lists.repeat(
PatioDataLayouts.fromType(PatioCodeGenClosures.CLOSURE_TYPE),
effectInfo.methodCount()
- ));
+ )));
}
private static List<Integer> userDefinedEffectMethodOffset(int methodIndex) {
- return List.of(methodIndex);
+ return PatioCodeGenGc.gcObjectOffset(List.of(methodIndex));
}
private static final PatioFunctionDeclaration FIND_HANDLER_METHOD_DECLARATION = new PatioFunctionDeclaration(