codekingpro/portable-devtools
114k
1// asmcheck -gcflags=-spectre=ret2 3//go:build amd644 5package codegen6 7func CallFunc(f func()) {8 // amd64:`CALL runtime.retpoline`9 f()10}11 12func CallInterface(x interface{ M() }) {13 // amd64:`CALL runtime.retpoline`14 x.M()15}16 17// Check to make sure that jump tables are disabled18// when retpoline is on. See issue 57097.19func noJumpTables(x int) int {20 switch x {21 case 0:22 return 023 case 1:24 return 125 case 2:26 return 227 case 3:28 return 329 case 4:30 return 431 case 5:32 return 533 case 6:34 return 635 case 7:36 return 737 case 8:38 return 839 case 9:40 return 941 }42 return 1043}44 