diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-21 12:26:22 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-21 12:26:22 +0100 |
| commit | 55be460e03ff3fdb9e3a54b979c5ca16bd6045fe (patch) | |
| tree | b553aa1738d06f9d9aba93e40970602be6b58aa4 | |
| parent | 6f4e1ae90880d94d23219a0a97774b2df4e04b56 (diff) | |
Use call instead of call-pointer
2 files changed, 8 insertions, 17 deletions
diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 278cd3a4..1886727a 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -44,7 +44,7 @@ "shed__namespaceImport__An_Example" visibility=public params=() - locals=(("tmp__0" bool) ("tmp__1" bool) ("tmp__2" int)) + locals=(("tmp__0" bool) ("tmp__1" int)) return-type=int body=( ( @@ -60,11 +60,11 @@ ( ) ( - (call-pointer (local "tmp__1") (function-ptr "shed__namespaceInit__An_Example") ()) + (call _ "shed__namespaceInit__An_Example" ()) ) ) - (data-ptr-to-int (local "tmp__2") (data-ptr "shed__namespace__An_Example")) - (return (local "tmp__2")) + (data-ptr-to-int (local "tmp__1") (data-ptr "shed__namespace__An_Example")) + (return (local "tmp__1")) ) ) )
\ No newline at end of file diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenNamespaces.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenNamespaces.java index 7623f23a..43101e7a 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenNamespaces.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenNamespaces.java @@ -4,7 +4,6 @@ import org.shedlang.compiler.patio.ast.PatioVisibility; import org.shedlang.compiler.patio.ast.instructions.*; import org.shedlang.compiler.patio.ast.operands.PatioBool; import org.shedlang.compiler.patio.ast.operands.PatioDataPtr; -import org.shedlang.compiler.patio.ast.operands.PatioFunctionPtr; import org.shedlang.compiler.patio.ast.types.PatioDataLayout; import org.shedlang.compiler.patio.ast.types.PatioTypes; import org.shedlang.compiler.sources.Sources; @@ -13,6 +12,7 @@ import org.shedlang.compiler.types.NamespaceTypeInfo; import org.shedlang.compiler.util.Lists; import java.util.List; +import java.util.Optional; import java.util.function.Function; public class PatioCodeGenNamespaces { @@ -82,22 +82,13 @@ public class PatioCodeGenNamespaces { source )); - var initReturnResult = importContext.allocateLocal( - PatioCodeGenLocalSpace.TEMPORARY, - PatioTypes.BOOL - ); - var initReturn = initReturnResult.value(); - importContext = initReturnResult.context(); - importContext = importContext.addInstruction(new PatioIf( isInited, List.of(), List.of( - // TODO: use direct call - // TODO: don't require target - new PatioCallPointer( - initReturn, - new PatioFunctionPtr(globalNameNamespaceInit(namespaceName)), + new PatioCall( + Optional.empty(), + globalNameNamespaceInit(namespaceName), List.of(), source ) |
