Skip to content

Commit ce711ba

Browse files
committed
[GR-41638] Make sure that shouldNotReachHere always has a message.
PullRequest: graal/13974
2 parents aa96c53 + d8a6edb commit ce711ba

File tree

268 files changed

+851
-769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+851
-769
lines changed

compiler/src/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64ASIMDAssembler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ public static byte[] getCmodeOpEncodings(ImmediateOp op) {
412412
case FMOVDP:
413413
return fmovDPEncodings;
414414
}
415-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
415+
throw GraalError.shouldNotReachHereUnexpectedValue(op); // ExcludeFromJacocoGeneratedReport
416416
}
417417

418418
}
@@ -487,7 +487,7 @@ public static ElementSize fromKind(PlatformKind kind) {
487487
case DOUBLE:
488488
return DoubleWord;
489489
default:
490-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
490+
throw GraalError.shouldNotReachHereUnexpectedValue(((AArch64Kind) kind).getScalar()); // ExcludeFromJacocoGeneratedReport
491491
}
492492
}
493493

@@ -517,7 +517,7 @@ public static ElementSize fromStride(Stride stride) {
517517
case S8:
518518
return DoubleWord;
519519
default:
520-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
520+
throw GraalError.shouldNotReachHereUnexpectedValue(stride); // ExcludeFromJacocoGeneratedReport
521521
}
522522
}
523523

@@ -788,7 +788,7 @@ private static int singleStructureElemSizeEncoding(ASIMDInstruction instr, Eleme
788788
encoding = eSize.encoding;
789789
break;
790790
default:
791-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
791+
throw GraalError.shouldNotReachHereUnexpectedValue(instr); // ExcludeFromJacocoGeneratedReport
792792
}
793793
return encoding << 10;
794794
}
@@ -816,7 +816,7 @@ private static int encodeStructureAddress(ASIMDInstruction instr, ASIMDSize size
816816
offsetEncoding = rs2(offset);
817817
break;
818818
default:
819-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
819+
throw GraalError.shouldNotReachHereUnexpectedValue(address.getAddressingMode()); // ExcludeFromJacocoGeneratedReport
820820
}
821821
return postIndexEncoding | offsetEncoding | rn(address.getBase());
822822
}

compiler/src/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64ASIMDMacroAssembler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static long replicateValueToImm64(ElementSize eSize, long val) {
5959
return eVal;
6060
}
6161

62-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
62+
throw GraalError.shouldNotReachHereUnexpectedValue(eSize); // ExcludeFromJacocoGeneratedReport
6363
}
6464

6565
/**
@@ -82,7 +82,7 @@ private void moveVI(ASIMDSize size, Register reg, long imm64) {
8282
/* Moving not(not(imm64)). */
8383
mvniVI(size, reg, ~imm64);
8484
} else {
85-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
85+
throw GraalError.shouldNotReachHereUnexpectedValue(imm64); // ExcludeFromJacocoGeneratedReport
8686
}
8787
}
8888

@@ -271,7 +271,7 @@ public void revVV(ASIMDSize size, ElementSize eSize, Register dst, Register src)
271271
masm.neon.rev64VV(size, ElementSize.Byte, dst, src);
272272
break;
273273
default:
274-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
274+
throw GraalError.shouldNotReachHereUnexpectedValue(eSize); // ExcludeFromJacocoGeneratedReport
275275
}
276276
}
277277

compiler/src/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64Address.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private static boolean isValidSize(int bitMemoryTransferSize, AddressingMode mod
159159
case IMMEDIATE_PAIR_PRE_INDEXED:
160160
return bitMemoryTransferSize == 32 || bitMemoryTransferSize == 64 || bitMemoryTransferSize == 128;
161161
}
162-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
162+
throw GraalError.shouldNotReachHereUnexpectedValue(mode); // ExcludeFromJacocoGeneratedReport
163163
}
164164

165165
/**
@@ -178,7 +178,7 @@ private static boolean immediateFitsInInstruction(AddressingMode mode, int immed
178178
case IMMEDIATE_PAIR_PRE_INDEXED:
179179
return NumUtil.isSignedNbit(7, immediate);
180180
}
181-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
181+
throw GraalError.shouldNotReachHereUnexpectedValue(mode); // ExcludeFromJacocoGeneratedReport
182182
}
183183

184184
/**
@@ -366,7 +366,7 @@ static int determineStructureImmediateValue(ASIMDInstruction instruction, ASIMDS
366366
case LD4_MULTIPLE_4R:
367367
return regByteSize * 4;
368368
default:
369-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
369+
throw GraalError.shouldNotReachHereUnexpectedValue(instruction); // ExcludeFromJacocoGeneratedReport
370370
}
371371
}
372372

@@ -470,7 +470,7 @@ private boolean verify() {
470470
assert extendType == null;
471471
break;
472472
default:
473-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
473+
throw GraalError.shouldNotReachHereUnexpectedValue(addressingMode); // ExcludeFromJacocoGeneratedReport
474474
}
475475

476476
return true;
@@ -617,7 +617,7 @@ public String toString() {
617617
addressEncoding = String.format("[X%d], X%d", base.encoding, offset.encoding);
618618
break;
619619
default:
620-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
620+
throw GraalError.shouldNotReachHereUnexpectedValue(addressingMode); // ExcludeFromJacocoGeneratedReport
621621
}
622622
return String.format("%s: %s", addressingMode.toString(), addressEncoding);
623623
}

compiler/src/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64Assembler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ public ConditionFlag negate() {
12601260
case AL:
12611261
case NV:
12621262
default:
1263-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1263+
throw GraalError.shouldNotReachHereUnexpectedValue(this); // ExcludeFromJacocoGeneratedReport
12641264
}
12651265
}
12661266
}
@@ -1743,7 +1743,7 @@ public void prfm(AArch64Address address, PrefetchMode mode) {
17431743
break;
17441744
default:
17451745
/* Invalid addressing mode provided. */
1746-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1746+
throw GraalError.shouldNotReachHereUnexpectedValue(address.getAddressingMode()); // ExcludeFromJacocoGeneratedReport
17471747
}
17481748

17491749
/* The prefetch mode is encoded within rt. */

compiler/src/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64MacroAssembler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public void loadAddress(Register dst, AArch64Address address) {
280280
mov(64, dst, address.getBase());
281281
break;
282282
default:
283-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
283+
throw GraalError.shouldNotReachHereUnexpectedValue(address.getAddressingMode()); // ExcludeFromJacocoGeneratedReport
284284
}
285285
}
286286

@@ -2053,7 +2053,7 @@ protected void patchJumpTarget(int patchPos, int jumpTarget) {
20532053
break;
20542054
}
20552055
default:
2056-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
2056+
throw GraalError.shouldNotReachHereUnexpectedValue(type); // ExcludeFromJacocoGeneratedReport
20572057
}
20582058
}
20592059

compiler/src/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ public boolean supports(EnumSet<CPUFeature> features, AVXSize avxSize) {
10311031
case ZMM:
10321032
return l512features != null && features.containsAll(l512features);
10331033
default:
1034-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1034+
throw GraalError.shouldNotReachHereUnexpectedValue(avxSize); // ExcludeFromJacocoGeneratedReport
10351035
}
10361036
}
10371037
}
@@ -1187,7 +1187,7 @@ public boolean supports(EnumSet<CPUFeature> features, AVXSize avxSize, boolean u
11871187
} else if (avxSize == AVXSize.YMM) {
11881188
return l256feature != null && features.contains(l256feature) && extendedFeatureCheck;
11891189
}
1190-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1190+
throw GraalError.shouldNotReachHereUnexpectedValue(avxSize); // ExcludeFromJacocoGeneratedReport
11911191
}
11921192
}
11931193

@@ -2381,7 +2381,7 @@ public static Predicate getPredicate(Condition condition, boolean unorderedIsTru
23812381
case GE:
23822382
return NLT_UQ;
23832383
default:
2384-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
2384+
throw GraalError.shouldNotReachHereUnexpectedValue(condition); // ExcludeFromJacocoGeneratedReport
23852385
}
23862386
} else {
23872387
switch (condition) {
@@ -2398,7 +2398,7 @@ public static Predicate getPredicate(Condition condition, boolean unorderedIsTru
23982398
case GE:
23992399
return GE_OQ;
24002400
default:
2401-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
2401+
throw GraalError.shouldNotReachHereUnexpectedValue(condition); // ExcludeFromJacocoGeneratedReport
24022402
}
24032403
}
24042404
}

compiler/src/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64MacroAssembler.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,19 +1081,19 @@ private static VexRMOp getAVXLoadAndExtendOp(Stride strideDst, Stride strideSrc,
10811081
case S8:
10821082
return extendMode == ExtendMode.SIGN_EXTEND ? VexRMOp.VPMOVSXBQ : VexRMOp.VPMOVZXBQ;
10831083
}
1084-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1084+
throw GraalError.shouldNotReachHereUnexpectedValue(strideDst); // ExcludeFromJacocoGeneratedReport
10851085
case S2:
10861086
switch (strideDst) {
10871087
case S4:
10881088
return extendMode == ExtendMode.SIGN_EXTEND ? VexRMOp.VPMOVSXWD : VexRMOp.VPMOVZXWD;
10891089
case S8:
10901090
return extendMode == ExtendMode.SIGN_EXTEND ? VexRMOp.VPMOVSXWQ : VexRMOp.VPMOVZXWQ;
10911091
}
1092-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1092+
throw GraalError.shouldNotReachHereUnexpectedValue(strideDst); // ExcludeFromJacocoGeneratedReport
10931093
case S4:
10941094
return extendMode == ExtendMode.SIGN_EXTEND ? VexRMOp.VPMOVSXDQ : VexRMOp.VPMOVZXDQ;
10951095
}
1096-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1096+
throw GraalError.shouldNotReachHereUnexpectedValue(strideSrc); // ExcludeFromJacocoGeneratedReport
10971097
}
10981098

10991099
public final void loadAndExtendSSE(ExtendMode extendMode, Register dst, Stride strideDst, AMD64Address src, Stride strideSrc) {
@@ -1123,7 +1123,7 @@ public final void loadAndExtendSSE(ExtendMode extendMode, Register dst, Stride s
11231123
}
11241124
return;
11251125
}
1126-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1126+
throw GraalError.shouldNotReachHereUnexpectedValue(strideDst); // ExcludeFromJacocoGeneratedReport
11271127
case S2:
11281128
switch (strideDst) {
11291129
case S4:
@@ -1141,7 +1141,7 @@ public final void loadAndExtendSSE(ExtendMode extendMode, Register dst, Stride s
11411141
}
11421142
return;
11431143
}
1144-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1144+
throw GraalError.shouldNotReachHereUnexpectedValue(strideDst); // ExcludeFromJacocoGeneratedReport
11451145
case S4:
11461146
if (signExtend) {
11471147
pmovsxdq(dst, src);
@@ -1150,7 +1150,7 @@ public final void loadAndExtendSSE(ExtendMode extendMode, Register dst, Stride s
11501150
}
11511151
return;
11521152
}
1153-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1153+
throw GraalError.shouldNotReachHereUnexpectedValue(strideSrc); // ExcludeFromJacocoGeneratedReport
11541154
}
11551155

11561156
public final void loadAndExtendSSE(ExtendMode extendMode, Register dst, Stride strideDst, Register src, Stride strideSrc) {
@@ -1180,7 +1180,7 @@ public final void loadAndExtendSSE(ExtendMode extendMode, Register dst, Stride s
11801180
}
11811181
return;
11821182
}
1183-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1183+
throw GraalError.shouldNotReachHereUnexpectedValue(strideDst); // ExcludeFromJacocoGeneratedReport
11841184
case S2:
11851185
switch (strideDst) {
11861186
case S4:
@@ -1198,7 +1198,7 @@ public final void loadAndExtendSSE(ExtendMode extendMode, Register dst, Stride s
11981198
}
11991199
return;
12001200
}
1201-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1201+
throw GraalError.shouldNotReachHereUnexpectedValue(strideDst); // ExcludeFromJacocoGeneratedReport
12021202
case S4:
12031203
if (signExtend) {
12041204
pmovsxdq(dst, src);
@@ -1207,7 +1207,7 @@ public final void loadAndExtendSSE(ExtendMode extendMode, Register dst, Stride s
12071207
}
12081208
return;
12091209
}
1210-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
1210+
throw GraalError.shouldNotReachHereUnexpectedValue(strideSrc); // ExcludeFromJacocoGeneratedReport
12111211
}
12121212

12131213
public final void packuswb(AVXSize size, Register dst, Register src) {

compiler/src/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64ArithmeticLIRGenerator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ protected static AArch64Kind getFloatConvertResultKind(FloatConvert op) {
303303
case F2D:
304304
return AArch64Kind.DOUBLE;
305305
default:
306-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
306+
throw GraalError.shouldNotReachHereUnexpectedValue(op); // ExcludeFromJacocoGeneratedReport
307307
}
308308
}
309309

@@ -430,7 +430,7 @@ private static boolean isValidBinaryConstant(AArch64ArithmeticOp op, AArch64Kind
430430
case NONE:
431431
return false;
432432
default:
433-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
433+
throw GraalError.shouldNotReachHereUnexpectedValue(op.category); // ExcludeFromJacocoGeneratedReport
434434
}
435435
}
436436

@@ -442,7 +442,7 @@ private static boolean isLogicalConstant(AArch64Kind kind, JavaConstant constVal
442442
case QWORD:
443443
return AArch64MacroAssembler.isLogicalImmediate(64, value);
444444
default:
445-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
445+
throw GraalError.shouldNotReachHereUnexpectedValue(kind); // ExcludeFromJacocoGeneratedReport
446446
}
447447
}
448448

@@ -454,7 +454,7 @@ public static boolean isAddSubtractConstant(JavaConstant constValue) {
454454
case Object:
455455
return constValue.isNull();
456456
default:
457-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
457+
throw GraalError.shouldNotReachHereUnexpectedValue(constValue.getJavaKind().getStackKind()); // ExcludeFromJacocoGeneratedReport
458458
}
459459
}
460460

@@ -523,7 +523,7 @@ public Value emitMathCopySign(Value magnitude, Value sign) {
523523

524524
@Override
525525
public Variable emitBitScanForward(Value value) {
526-
throw GraalError.unimplemented(); // ExcludeFromJacocoGeneratedReport
526+
throw GraalError.unimplementedOverride(); // ExcludeFromJacocoGeneratedReport
527527
}
528528

529529
@Override
@@ -651,7 +651,7 @@ public Value emitRound(Value value, ArithmeticLIRGeneratorTool.RoundingMode mode
651651
op = AArch64ArithmeticOp.FRINTZ;
652652
break;
653653
default:
654-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
654+
throw GraalError.shouldNotReachHereUnexpectedValue(mode); // ExcludeFromJacocoGeneratedReport
655655
}
656656

657657
return emitUnary(op, value);

compiler/src/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ private static ConditionFlag toFloatConditionFlag(Condition cond, boolean unorde
383383
case NE:
384384
return ConditionFlag.NE;
385385
default:
386-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
386+
throw GraalError.shouldNotReachHereUnexpectedValue(cond); // ExcludeFromJacocoGeneratedReport
387387
}
388388
}
389389

@@ -413,7 +413,7 @@ private static ConditionFlag toIntConditionFlag(Condition cond) {
413413
case BT:
414414
return ConditionFlag.LO;
415415
default:
416-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
416+
throw GraalError.shouldNotReachHereUnexpectedValue(cond); // ExcludeFromJacocoGeneratedReport
417417
}
418418
}
419419

compiler/src/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRKindTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public LIRKind getFloatingKind(int bits) {
5454
case 64:
5555
return LIRKind.value(AArch64Kind.DOUBLE);
5656
default:
57-
throw GraalError.shouldNotReachHere(); // ExcludeFromJacocoGeneratedReport
57+
throw GraalError.shouldNotReachHereUnexpectedValue(bits); // ExcludeFromJacocoGeneratedReport
5858
}
5959
}
6060

compiler/src/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64MoveFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public AArch64LIRInstruction createLoad(AllocatableValue dst, Constant src) {
7878
} else if (src instanceof DataPointerConstant) {
7979
return new AArch64Move.LoadDataOp(dst, (DataPointerConstant) src);
8080
} else {
81-
throw GraalError.unimplemented(); // ExcludeFromJacocoGeneratedReport
81+
throw GraalError.shouldNotReachHereUnexpectedValue(src); // ExcludeFromJacocoGeneratedReport
8282
}
8383
}
8484

0 commit comments

Comments
 (0)