From a12a211d70fcfd0a4910f9d0651754c976a28b81 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Thu, 6 Apr 2023 08:44:31 +0200 Subject: [PATCH] #814 Upgrade to Java 17 plus upgraded libraries. --- pom.xml | 24 +++++++++---------- .../model/statements/StatementPhiBlock.java | 6 ++--- .../Pass0GenerateStatementSequence.java | 22 ++++++++--------- .../kickc/passes/Pass4RegistersFinalize.java | 2 +- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/pom.xml b/pom.xml index 0146de442..e4abd072c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,8 +5,8 @@ 4.0.0 - 8 - 8 + 17 + 17 UTF-8 -Xmx2048m @@ -47,24 +47,24 @@ org.antlr antlr4 - 4.9.3 + 4.12.0 provided org.antlr antlr4-runtime - 4.9.3 + 4.12.0 org.junit.jupiter junit-jupiter-engine - 5.8.2 + 5.9.2 test info.picocli picocli - 4.6.2 + 4.7.1 javax.json @@ -124,7 +124,7 @@ org.antlr antlr4-maven-plugin - 4.9.3 + 4.12.0 antlr @@ -152,7 +152,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M5 + 3.0.0-M9 **/TestFragments.java @@ -167,7 +167,7 @@ org.jacoco jacoco-maven-plugin - 0.8.7 + 0.8.9 pre-unit-test @@ -187,7 +187,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.3.0 @@ -201,7 +201,7 @@ org.apache.felix maven-bundle-plugin - 3.5.0 + 5.1.8 bundle-manifest @@ -214,7 +214,7 @@ maven-assembly-plugin - 3.3.0 + 3.5.0 kickc posix diff --git a/src/main/java/dk/camelot64/kickc/model/statements/StatementPhiBlock.java b/src/main/java/dk/camelot64/kickc/model/statements/StatementPhiBlock.java index 11cdbb587..bb1d018ee 100644 --- a/src/main/java/dk/camelot64/kickc/model/statements/StatementPhiBlock.java +++ b/src/main/java/dk/camelot64/kickc/model/statements/StatementPhiBlock.java @@ -1,13 +1,11 @@ package dk.camelot64.kickc.model.statements; import dk.camelot64.kickc.model.Comment; -import dk.camelot64.kickc.model.values.LabelRef; import dk.camelot64.kickc.model.Program; +import dk.camelot64.kickc.model.values.LabelRef; import dk.camelot64.kickc.model.values.RValue; import dk.camelot64.kickc.model.values.VariableRef; -import org.antlr.v4.runtime.RuleContext; -import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -24,7 +22,7 @@ public class StatementPhiBlock extends StatementBase { private List phiVariables; public StatementPhiBlock(List comments) { - super(new StatementSource(RuleContext.EMPTY), comments); + super(StatementSource.NONE, comments); this.phiVariables = new ArrayList<>(); } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java b/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java index 3f570bead..c8604b28d 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java @@ -136,7 +136,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor()); program.getScope().add(initProc); program.createProcedureCompilation(initProc.getRef()); - program.getProcedureCompilation(initProc.getRef()).getStatementSequence().addStatement(new StatementProcedureBegin(initProc.getRef(), new StatementSource(RuleContext.EMPTY), Comment.NO_COMMENTS)); + program.getProcedureCompilation(initProc.getRef()).getStatementSequence().addStatement(new StatementProcedureBegin(initProc.getRef(), StatementSource.NONE, Comment.NO_COMMENTS)); } return initProc; } @@ -180,9 +180,9 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor(), new StatementSource(RuleContext.EMPTY), Comment.NO_COMMENTS)); + startSequence.addStatement(new StatementCall(null, SymbolRef.INIT_PROC_NAME, new ArrayList<>(), StatementSource.NONE, Comment.NO_COMMENTS)); final Procedure mainProc = program.getScope().getLocalProcedure(SymbolRef.MAIN_PROC_NAME); if(mainProc == null) throw new CompileError("Required main() not defined in program."); if(!SymbolType.VOID.equals(mainProc.getReturnType()) && !SymbolType.SWORD.equals(mainProc.getReturnType())) throw new CompileError("return of main() must be 'void' or of type 'int'.", mainProc.getDefinitionSource()); if(mainProc.getParameterNames().size() == 0) { - startSequence.addStatement(new StatementCall(null, SymbolRef.MAIN_PROC_NAME, new ArrayList<>(), new StatementSource(RuleContext.EMPTY), Comment.NO_COMMENTS)); + startSequence.addStatement(new StatementCall(null, SymbolRef.MAIN_PROC_NAME, new ArrayList<>(), StatementSource.NONE, Comment.NO_COMMENTS)); } else if(mainProc.getParameterNames().size() == 2) { final List parameters = mainProc.getParameters(); final Variable argc = parameters.get(0); @@ -214,15 +214,15 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor params = new ArrayList<>(); params.add(new ConstantInteger(0L, SymbolType.SWORD)); params.add(new ConstantPointer(0L, new SymbolTypePointer(SymbolType.BYTE))); - startSequence.addStatement(new StatementCall(null, SymbolRef.MAIN_PROC_NAME, params, new StatementSource(RuleContext.EMPTY), Comment.NO_COMMENTS)); + startSequence.addStatement(new StatementCall(null, SymbolRef.MAIN_PROC_NAME, params, StatementSource.NONE, Comment.NO_COMMENTS)); } else throw new CompileError("main() has wrong number of parameters. It must have zero or 2 parameters.", mainProc.getDefinitionSource()); final Label startReturnLabel = startProcedure.addLabel(SymbolRef.PROCEXIT_BLOCK_NAME); - startSequence.addStatement(new StatementLabel(startReturnLabel.getRef(), new StatementSource(RuleContext.EMPTY), Comment.NO_COMMENTS)); - startSequence.addStatement(new StatementReturn(null, new StatementSource(RuleContext.EMPTY), Comment.NO_COMMENTS)); - startSequence.addStatement(new StatementProcedureEnd(startProcedure.getRef(), new StatementSource(RuleContext.EMPTY), Comment.NO_COMMENTS)); + startSequence.addStatement(new StatementLabel(startReturnLabel.getRef(), StatementSource.NONE, Comment.NO_COMMENTS)); + startSequence.addStatement(new StatementReturn(null, StatementSource.NONE, Comment.NO_COMMENTS)); + startSequence.addStatement(new StatementProcedureEnd(startProcedure.getRef(), StatementSource.NONE, Comment.NO_COMMENTS)); } } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4RegistersFinalize.java b/src/main/java/dk/camelot64/kickc/passes/Pass4RegistersFinalize.java index 545eb23e9..59c1a1480 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4RegistersFinalize.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4RegistersFinalize.java @@ -212,7 +212,7 @@ public class Pass4RegistersFinalize extends Pass2Base { reserved = false; int candidateZp = currentZp; for(int i=0;i