From 72cda5d9f780184321c6c10d02c9dcaa7e6bd81a Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Tue, 16 Oct 2018 00:40:55 +0300 Subject: [PATCH] [refactor] Suppress fall through warnings --- .../max/asm/target/aarch64/Aarch64LogicalImmediateTable.java | 1 + .../src/com/oracle/max/asm/target/amd64/AMD64Assembler.java | 1 + .../oracle/max/asm/target/amd64/X86InstructionDecoder.java | 1 + .../max/vma/tools/gen/t1x/VMAdviceTemplateGenerator.java | 4 ++-- .../src/com/oracle/max/vma/tools/qa/ProcessLog.java | 1 + com.sun.c1x/src/com/sun/c1x/graph/BlockMap.java | 1 + .../src/com/sun/c1x/target/aarch64/Aarch64LIRAssembler.java | 1 + .../src/com/sun/c1x/target/armv7/ARMV7LIRAssembler.java | 1 + com.sun.cri/src/com/sun/cri/ci/CiUtil.java | 2 ++ .../src/com/sun/max/asm/dis/x86/X86Disassembler.java | 1 + .../src/com/sun/max/asm/gen/cisc/x86/X86Template.java | 5 +++-- .../com/sun/max/asm/gen/cisc/x86/X86TemplateAssembler.java | 1 + com.sun.max/src/com/sun/max/vm/actor/Actor.java | 1 + .../src/com/sun/max/vm/compiler/deopt/Deoptimization.java | 5 +++++ mx.maxine/suite.py | 4 ++-- 15 files changed, 24 insertions(+), 6 deletions(-) diff --git a/com.oracle.max.asm/src/com/oracle/max/asm/target/aarch64/Aarch64LogicalImmediateTable.java b/com.oracle.max.asm/src/com/oracle/max/asm/target/aarch64/Aarch64LogicalImmediateTable.java index 3695e3179b..daef4ade8f 100644 --- a/com.oracle.max.asm/src/com/oracle/max/asm/target/aarch64/Aarch64LogicalImmediateTable.java +++ b/com.oracle.max.asm/src/com/oracle/max/asm/target/aarch64/Aarch64LogicalImmediateTable.java @@ -149,6 +149,7 @@ public int compareTo(Immediate o) { } } + @SuppressWarnings("fallthrough") private static Immediate[] buildImmediateTable() { final int nrImmediates = 5334; final Immediate[] table = new Immediate[nrImmediates]; diff --git a/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java b/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java index cd6d6553af..217939f077 100644 --- a/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java +++ b/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java @@ -1276,6 +1276,7 @@ public final void nop() { nop(1); } + @SuppressWarnings("fallthrough") public void nop(int i) { if (AsmOptions.UseNormalNop) { assert i > 0 : " "; diff --git a/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/X86InstructionDecoder.java b/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/X86InstructionDecoder.java index 1122292146..4f83cc83a4 100644 --- a/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/X86InstructionDecoder.java +++ b/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/X86InstructionDecoder.java @@ -70,6 +70,7 @@ public int currentDisplacementPosition() { return currentDisplacementPosition; } + @SuppressWarnings("fallthrough") public void decodePosition(int inst) { assert inst >= 0 && inst < code.length; diff --git a/com.oracle.max.vma.tools/src/com/oracle/max/vma/tools/gen/t1x/VMAdviceTemplateGenerator.java b/com.oracle.max.vma.tools/src/com/oracle/max/vma/tools/gen/t1x/VMAdviceTemplateGenerator.java index 4d252708f6..33814c2787 100644 --- a/com.oracle.max.vma.tools/src/com/oracle/max/vma/tools/gen/t1x/VMAdviceTemplateGenerator.java +++ b/com.oracle.max.vma.tools/src/com/oracle/max/vma/tools/gen/t1x/VMAdviceTemplateGenerator.java @@ -280,6 +280,7 @@ private boolean generateTag(T1XTemplateTag tag, AdviceType at) { * and we may decide here to throw it away if we are not generating that advice. */ @Override + @SuppressWarnings("fallthrough") public void generate(T1XTemplateTag tag, AdviceType at, Object... args) { byteArrayOut.setTag(tag); if (!generateTag(tag, at)) { @@ -584,10 +585,9 @@ public void generate(T1XTemplateTag tag, AdviceType at, Object... args) { case NEW_HYBRID: methodName = "New"; - // Checkstyle: stop + // fall through case NEW: case NEW$init: - // Checkstyle: resume assert adviceType == AdviceType.AFTER; generateNew(); break; diff --git a/com.oracle.max.vma.tools/src/com/oracle/max/vma/tools/qa/ProcessLog.java b/com.oracle.max.vma.tools/src/com/oracle/max/vma/tools/qa/ProcessLog.java index 0d47bb724d..d527cc397f 100644 --- a/com.oracle.max.vma.tools/src/com/oracle/max/vma/tools/qa/ProcessLog.java +++ b/com.oracle.max.vma.tools/src/com/oracle/max/vma/tools/qa/ProcessLog.java @@ -800,6 +800,7 @@ private String arg(int slot) { } } + @SuppressWarnings("fallthrough") private void processTraceRecord() throws TraceException { String arg1 = arg(1); String arg2 = arg(2); diff --git a/com.sun.c1x/src/com/sun/c1x/graph/BlockMap.java b/com.sun.c1x/src/com/sun/c1x/graph/BlockMap.java index ffbcdb49cf..bf7080110c 100644 --- a/com.sun.c1x/src/com/sun/c1x/graph/BlockMap.java +++ b/com.sun.c1x/src/com/sun/c1x/graph/BlockMap.java @@ -356,6 +356,7 @@ public CiBitMap getStoresInLoops() { return storesInLoops; } + @SuppressWarnings("fallthrough") void iterateOverBytecodes() { // iterate over the bytecodes top to bottom. // mark the entrypoints of basic blocks and build lists of successors for diff --git a/com.sun.c1x/src/com/sun/c1x/target/aarch64/Aarch64LIRAssembler.java b/com.sun.c1x/src/com/sun/c1x/target/aarch64/Aarch64LIRAssembler.java index 7f70d17cc1..8f01803551 100644 --- a/com.sun.c1x/src/com/sun/c1x/target/aarch64/Aarch64LIRAssembler.java +++ b/com.sun.c1x/src/com/sun/c1x/target/aarch64/Aarch64LIRAssembler.java @@ -951,6 +951,7 @@ private ConditionFlag convertCondition(Condition condition) { } @Override + @SuppressWarnings("fallthrough") protected void emitCompare(Condition condition, CiValue opr1, CiValue opr2, LIROp2 op) { // Checkstyle: off assert Util.archKindsEqual(opr1.kind.stackKind(), opr2.kind.stackKind()) || (opr1.kind == CiKind.Long && opr2.kind == CiKind.Int) : "nonmatching stack kinds (" + condition + "): " + diff --git a/com.sun.c1x/src/com/sun/c1x/target/armv7/ARMV7LIRAssembler.java b/com.sun.c1x/src/com/sun/c1x/target/armv7/ARMV7LIRAssembler.java index f69861444f..84b36771a3 100644 --- a/com.sun.c1x/src/com/sun/c1x/target/armv7/ARMV7LIRAssembler.java +++ b/com.sun.c1x/src/com/sun/c1x/target/armv7/ARMV7LIRAssembler.java @@ -1498,6 +1498,7 @@ private ConditionFlag convertCondition(Condition condition) { } @Override + @SuppressWarnings("fallthrough") protected void emitCompare(Condition condition, CiValue opr1, CiValue opr2, LIROp2 op) { // Checkstyle: off assert Util.archKindsEqual(opr1.kind.stackKind(), opr2.kind.stackKind()) || (opr1.kind == CiKind.Long && opr2.kind == CiKind.Int) : "nonmatching stack kinds (" + condition + "): " + diff --git a/com.sun.cri/src/com/sun/cri/ci/CiUtil.java b/com.sun.cri/src/com/sun/cri/ci/CiUtil.java index acf8f20bf0..1ea8fce779 100644 --- a/com.sun.cri/src/com/sun/cri/ci/CiUtil.java +++ b/com.sun.cri/src/com/sun/cri/ci/CiUtil.java @@ -270,6 +270,7 @@ public static String format(String format, RiField field, boolean arg) throws Il * @return the result of formatting this method according to {@code format} * @throws IllegalFormatException if an illegal specifier is encountered in {@code format} */ + @SuppressWarnings("fallthrough") public static String format(String format, RiMethod method) throws IllegalFormatException { final StringBuilder sb = new StringBuilder(); int index = 0; @@ -360,6 +361,7 @@ public static String format(String format, RiMethod method) throws IllegalFormat * @return the result of formatting this field according to {@code format} * @throws IllegalFormatException if an illegal specifier is encountered in {@code format} */ + @SuppressWarnings("fallthrough") public static String format(String format, RiField field) throws IllegalFormatException { final StringBuilder sb = new StringBuilder(); int index = 0; diff --git a/com.sun.max.asm/src/com/sun/max/asm/dis/x86/X86Disassembler.java b/com.sun.max.asm/src/com/sun/max/asm/dis/x86/X86Disassembler.java index 22e6f7ae29..3b7e9965ff 100644 --- a/com.sun.max.asm/src/com/sun/max/asm/dis/x86/X86Disassembler.java +++ b/com.sun.max.asm/src/com/sun/max/asm/dis/x86/X86Disassembler.java @@ -169,6 +169,7 @@ private X86InstructionHeader scanInstructionHeader(BufferedInputStream stream, b return justSkip ? null : header; } + @SuppressWarnings("fallthrough") private List scanArguments(BufferedInputStream stream, X86Template template, X86InstructionHeader header, byte modRMByte, byte sibByte) throws IOException { final List arguments = new ArrayList(); final byte rexByte = (header.rexPrefix != null) ? header.rexPrefix.byteValue() : 0; diff --git a/com.sun.max.asm/src/com/sun/max/asm/gen/cisc/x86/X86Template.java b/com.sun.max.asm/src/com/sun/max/asm/gen/cisc/x86/X86Template.java index e998a90425..9c6d8c2f16 100644 --- a/com.sun.max.asm/src/com/sun/max/asm/gen/cisc/x86/X86Template.java +++ b/com.sun.max.asm/src/com/sun/max/asm/gen/cisc/x86/X86Template.java @@ -273,6 +273,7 @@ public void visitAddressingMethodCode(AddressingMethodCode addressingMethodCode, } } + @SuppressWarnings("fallthrough") private String getOperandTypeSuffix(OperandTypeCode operandTypeCode) throws TemplateNotNeededException { switch (operandTypeCode) { case b: @@ -281,9 +282,9 @@ private String getOperandTypeSuffix(OperandTypeCode operandTypeCode) throws Temp if (operandSizeAttribute() != addressSizeAttribute()) { throw TemplateNotNeededException.raise(); } - // Checkstyle: stop + // fall through case d_q: - // Checkstyle: resume + // fall through case v: switch (operandSizeAttribute()) { case BITS_16: diff --git a/com.sun.max.asm/src/com/sun/max/asm/gen/cisc/x86/X86TemplateAssembler.java b/com.sun.max.asm/src/com/sun/max/asm/gen/cisc/x86/X86TemplateAssembler.java index 379e36b1f4..1a17afcccb 100644 --- a/com.sun.max.asm/src/com/sun/max/asm/gen/cisc/x86/X86TemplateAssembler.java +++ b/com.sun.max.asm/src/com/sun/max/asm/gen/cisc/x86/X86TemplateAssembler.java @@ -130,6 +130,7 @@ private boolean sibRequiresImmediate(int sibRMByte) { return X86Field.BASE.extract(s) == 5; } + @SuppressWarnings("fallthrough") public byte[] assemble(List arguments) { int rexByte = 0; final boolean unconditionalRexBit = template.operandSizeAttribute() == WordWidth.BITS_64 && template.instructionDescription().defaultOperandSize() != WordWidth.BITS_64; diff --git a/com.sun.max/src/com/sun/max/vm/actor/Actor.java b/com.sun.max/src/com/sun/max/vm/actor/Actor.java index b5350ee345..8598c42111 100644 --- a/com.sun.max/src/com/sun/max/vm/actor/Actor.java +++ b/com.sun.max/src/com/sun/max/vm/actor/Actor.java @@ -596,6 +596,7 @@ private static void appendFlag(StringBuilder sb, boolean flag, String string) { * @return the result of formatting this method according to {@code format} * @throws IllegalFormatException if an illegal specifier is encountered in {@code format} */ + @SuppressWarnings("fallthrough") public final String format(boolean strict, String format, Object... args) throws IllegalFormatException { final StringBuilder sb = new StringBuilder(); int index = 0; diff --git a/com.sun.max/src/com/sun/max/vm/compiler/deopt/Deoptimization.java b/com.sun.max/src/com/sun/max/vm/compiler/deopt/Deoptimization.java index 0298cf25b1..cef848d490 100644 --- a/com.sun.max/src/com/sun/max/vm/compiler/deopt/Deoptimization.java +++ b/com.sun.max/src/com/sun/max/vm/compiler/deopt/Deoptimization.java @@ -407,14 +407,19 @@ public static void unroll(Info info) { switch (info.returnValue.kind.stackKind()) { case Int: Stubs.unwindInt(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asInt()); + break; case Float: Stubs.unwindFloat(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asFloat()); + break; case Long: Stubs.unwindLong(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asLong()); + break; case Double: Stubs.unwindDouble(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asDouble()); + break; case Object: Stubs.unwindObject(info.ip.asPointer(), info.sp, info.fp, info.returnValue.asObject()); + break; default: FatalError.unexpected("unexpected return kind: " + info.returnValue.kind.stackKind()); } diff --git a/mx.maxine/suite.py b/mx.maxine/suite.py index 663a48c3e2..99824294c3 100644 --- a/mx.maxine/suite.py +++ b/mx.maxine/suite.py @@ -28,7 +28,7 @@ "write": "git@github.com:beehive-lab/Maxine-VM.git", }, "outputRoot": "./", - "javac.lint.overrides": "-rawtypes,-serial,-fallthrough", + "javac.lint.overrides": "-rawtypes,-serial", "imports": { "suites": [ @@ -286,7 +286,7 @@ "checkstyle": "com.sun.max", "TestProject": True, "javaCompliance": "1.8", - "javac.lint.overrides": "-rawtypes,-serial,-fallthrough,-finally", + "javac.lint.overrides": "-rawtypes,-serial,-finally", }, "com.oracle.max.vma.tools": {