aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-16 12:29:07 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-16 12:29:07 +0000
commit4da8acf8d927bb1a99ef96b617d9da7680ff37cf (patch)
tree46c703f228fc6ce7b5e5c9b07e03c1c557d4de2a /src/main/java
parent32bdb166ae3d0656984d20d6d9fd7c29b425cea7 (diff)
Store free variables in alloc()
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java9
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java9
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenFunctions.java9
3 files changed, 11 insertions, 16 deletions
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java
index 69434491..923a2fb1 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenClosures.java
@@ -83,6 +83,7 @@ class PatioCodeGenClosures {
String name,
String functionName,
Layout layout,
+ FreeVariables freeVariables,
Source source,
PatioCodeGenContext context
) {
@@ -104,6 +105,14 @@ class PatioCodeGenClosures {
source
));
+ context = storeFreeVariables(
+ freeVariables,
+ closurePointer,
+ layout,
+ source,
+ context
+ );
+
return context.toResult(closurePointer);
}
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java
index c4a74f09..c0a24507 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenEffects.java
@@ -430,6 +430,7 @@ public class PatioCodeGenEffects {
name,
fullName,
layout,
+ freeVariables,
source,
context
);
@@ -453,14 +454,6 @@ public class PatioCodeGenEffects {
source
));
- context = storeFreeVariables(
- freeVariables,
- closurePointer,
- layout,
- source,
- context
- );
-
context = context.addInstruction(new PatioDataPtrToInt(
target,
closurePointer,
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenFunctions.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenFunctions.java
index 217ac701..cb2b8808 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenFunctions.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenFunctions.java
@@ -71,6 +71,7 @@ public class PatioCodeGenFunctions {
name,
fullName,
layout,
+ freeVariables,
source,
context
);
@@ -83,14 +84,6 @@ public class PatioCodeGenFunctions {
source
));
- context = storeFreeVariables(
- freeVariables,
- closurePointer,
- layout,
- source,
- context
- );
-
return context;
}
}