Commit ed7f323c authored by Shulhan's avatar Shulhan Committed by Ian Lance Taylor

all: simplify code using "gofmt -s -w"

Most changes are removing redundant declaration of type when direct
instantiating value of map or slice, e.g. []T{T{}} become []T{{}}.

Small changes are removing the high order of subslice if its value
is the length of slice itself, e.g. T[:len(T)] become T[:].

The following file is excluded due to incompatibility with go1.4,

- src/cmd/compile/internal/gc/ssa.go

Change-Id: Id3abb09401795ce1e6da591a89749cba8502fb26
Reviewed-on: https://go-review.googlesource.com/c/go/+/166437
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 04845fe7
......@@ -25,16 +25,16 @@ type iselOp struct {
var iselRegs = [2]int16{ppc64.REG_R0, ppc64.REGTMP}
var iselOps = map[ssa.Op]iselOp{
ssa.OpPPC64Equal: iselOp{cond: ppc64.C_COND_EQ, valueIfCond: 1},
ssa.OpPPC64NotEqual: iselOp{cond: ppc64.C_COND_EQ, valueIfCond: 0},
ssa.OpPPC64LessThan: iselOp{cond: ppc64.C_COND_LT, valueIfCond: 1},
ssa.OpPPC64GreaterEqual: iselOp{cond: ppc64.C_COND_LT, valueIfCond: 0},
ssa.OpPPC64GreaterThan: iselOp{cond: ppc64.C_COND_GT, valueIfCond: 1},
ssa.OpPPC64LessEqual: iselOp{cond: ppc64.C_COND_GT, valueIfCond: 0},
ssa.OpPPC64FLessThan: iselOp{cond: ppc64.C_COND_LT, valueIfCond: 1},
ssa.OpPPC64FGreaterThan: iselOp{cond: ppc64.C_COND_GT, valueIfCond: 1},
ssa.OpPPC64FLessEqual: iselOp{cond: ppc64.C_COND_LT, valueIfCond: 1}, // 2 comparisons, 2nd is EQ
ssa.OpPPC64FGreaterEqual: iselOp{cond: ppc64.C_COND_GT, valueIfCond: 1}, // 2 comparisons, 2nd is EQ
ssa.OpPPC64Equal: {cond: ppc64.C_COND_EQ, valueIfCond: 1},
ssa.OpPPC64NotEqual: {cond: ppc64.C_COND_EQ, valueIfCond: 0},
ssa.OpPPC64LessThan: {cond: ppc64.C_COND_LT, valueIfCond: 1},
ssa.OpPPC64GreaterEqual: {cond: ppc64.C_COND_LT, valueIfCond: 0},
ssa.OpPPC64GreaterThan: {cond: ppc64.C_COND_GT, valueIfCond: 1},
ssa.OpPPC64LessEqual: {cond: ppc64.C_COND_GT, valueIfCond: 0},
ssa.OpPPC64FLessThan: {cond: ppc64.C_COND_LT, valueIfCond: 1},
ssa.OpPPC64FGreaterThan: {cond: ppc64.C_COND_GT, valueIfCond: 1},
ssa.OpPPC64FLessEqual: {cond: ppc64.C_COND_LT, valueIfCond: 1}, // 2 comparisons, 2nd is EQ
ssa.OpPPC64FGreaterEqual: {cond: ppc64.C_COND_GT, valueIfCond: 1}, // 2 comparisons, 2nd is EQ
}
// markMoves marks any MOVXconst ops that need to avoid clobbering flags.
......
......@@ -62,7 +62,7 @@ func PseudoVersion(major, older string, t time.Time, rev string) string {
// Form (2), (3).
// Extract patch from vMAJOR.MINOR.PATCH
v := older[:len(older)]
v := older[:]
i := strings.LastIndex(v, ".") + 1
v, patch := v[:i], v[i:]
......
......@@ -68,351 +68,351 @@ type Optab struct {
var optab = []Optab{
// zero-length instructions
Optab{i: 0, as: obj.ATEXT, a1: C_ADDR, a6: C_TEXTSIZE},
Optab{i: 0, as: obj.ATEXT, a1: C_ADDR, a3: C_LCON, a6: C_TEXTSIZE},
Optab{i: 0, as: obj.APCDATA, a1: C_LCON, a6: C_LCON},
Optab{i: 0, as: obj.AFUNCDATA, a1: C_SCON, a6: C_ADDR},
Optab{i: 0, as: obj.ANOP},
Optab{i: 0, as: obj.ANOP, a1: C_SAUTO},
{i: 0, as: obj.ATEXT, a1: C_ADDR, a6: C_TEXTSIZE},
{i: 0, as: obj.ATEXT, a1: C_ADDR, a3: C_LCON, a6: C_TEXTSIZE},
{i: 0, as: obj.APCDATA, a1: C_LCON, a6: C_LCON},
{i: 0, as: obj.AFUNCDATA, a1: C_SCON, a6: C_ADDR},
{i: 0, as: obj.ANOP},
{i: 0, as: obj.ANOP, a1: C_SAUTO},
// move register
Optab{i: 1, as: AMOVD, a1: C_REG, a6: C_REG},
Optab{i: 1, as: AMOVB, a1: C_REG, a6: C_REG},
Optab{i: 1, as: AMOVBZ, a1: C_REG, a6: C_REG},
Optab{i: 1, as: AMOVW, a1: C_REG, a6: C_REG},
Optab{i: 1, as: AMOVWZ, a1: C_REG, a6: C_REG},
Optab{i: 1, as: AFMOVD, a1: C_FREG, a6: C_FREG},
Optab{i: 1, as: AMOVDBR, a1: C_REG, a6: C_REG},
{i: 1, as: AMOVD, a1: C_REG, a6: C_REG},
{i: 1, as: AMOVB, a1: C_REG, a6: C_REG},
{i: 1, as: AMOVBZ, a1: C_REG, a6: C_REG},
{i: 1, as: AMOVW, a1: C_REG, a6: C_REG},
{i: 1, as: AMOVWZ, a1: C_REG, a6: C_REG},
{i: 1, as: AFMOVD, a1: C_FREG, a6: C_FREG},
{i: 1, as: AMOVDBR, a1: C_REG, a6: C_REG},
// load constant
Optab{i: 26, as: AMOVD, a1: C_LACON, a6: C_REG},
Optab{i: 26, as: AMOVW, a1: C_LACON, a6: C_REG},
Optab{i: 26, as: AMOVWZ, a1: C_LACON, a6: C_REG},
Optab{i: 3, as: AMOVD, a1: C_DCON, a6: C_REG},
Optab{i: 3, as: AMOVW, a1: C_DCON, a6: C_REG},
Optab{i: 3, as: AMOVWZ, a1: C_DCON, a6: C_REG},
Optab{i: 3, as: AMOVB, a1: C_DCON, a6: C_REG},
Optab{i: 3, as: AMOVBZ, a1: C_DCON, a6: C_REG},
{i: 26, as: AMOVD, a1: C_LACON, a6: C_REG},
{i: 26, as: AMOVW, a1: C_LACON, a6: C_REG},
{i: 26, as: AMOVWZ, a1: C_LACON, a6: C_REG},
{i: 3, as: AMOVD, a1: C_DCON, a6: C_REG},
{i: 3, as: AMOVW, a1: C_DCON, a6: C_REG},
{i: 3, as: AMOVWZ, a1: C_DCON, a6: C_REG},
{i: 3, as: AMOVB, a1: C_DCON, a6: C_REG},
{i: 3, as: AMOVBZ, a1: C_DCON, a6: C_REG},
// store constant
Optab{i: 72, as: AMOVD, a1: C_SCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVD, a1: C_ADDCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVW, a1: C_SCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVW, a1: C_ADDCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVWZ, a1: C_SCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVWZ, a1: C_ADDCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVB, a1: C_SCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVB, a1: C_ADDCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVBZ, a1: C_SCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVBZ, a1: C_ADDCON, a6: C_LAUTO},
Optab{i: 72, as: AMOVD, a1: C_SCON, a6: C_LOREG},
Optab{i: 72, as: AMOVD, a1: C_ADDCON, a6: C_LOREG},
Optab{i: 72, as: AMOVW, a1: C_SCON, a6: C_LOREG},
Optab{i: 72, as: AMOVW, a1: C_ADDCON, a6: C_LOREG},
Optab{i: 72, as: AMOVWZ, a1: C_SCON, a6: C_LOREG},
Optab{i: 72, as: AMOVWZ, a1: C_ADDCON, a6: C_LOREG},
Optab{i: 72, as: AMOVB, a1: C_SCON, a6: C_LOREG},
Optab{i: 72, as: AMOVB, a1: C_ADDCON, a6: C_LOREG},
Optab{i: 72, as: AMOVBZ, a1: C_SCON, a6: C_LOREG},
Optab{i: 72, as: AMOVBZ, a1: C_ADDCON, a6: C_LOREG},
{i: 72, as: AMOVD, a1: C_SCON, a6: C_LAUTO},
{i: 72, as: AMOVD, a1: C_ADDCON, a6: C_LAUTO},
{i: 72, as: AMOVW, a1: C_SCON, a6: C_LAUTO},
{i: 72, as: AMOVW, a1: C_ADDCON, a6: C_LAUTO},
{i: 72, as: AMOVWZ, a1: C_SCON, a6: C_LAUTO},
{i: 72, as: AMOVWZ, a1: C_ADDCON, a6: C_LAUTO},
{i: 72, as: AMOVB, a1: C_SCON, a6: C_LAUTO},
{i: 72, as: AMOVB, a1: C_ADDCON, a6: C_LAUTO},
{i: 72, as: AMOVBZ, a1: C_SCON, a6: C_LAUTO},
{i: 72, as: AMOVBZ, a1: C_ADDCON, a6: C_LAUTO},
{i: 72, as: AMOVD, a1: C_SCON, a6: C_LOREG},
{i: 72, as: AMOVD, a1: C_ADDCON, a6: C_LOREG},
{i: 72, as: AMOVW, a1: C_SCON, a6: C_LOREG},
{i: 72, as: AMOVW, a1: C_ADDCON, a6: C_LOREG},
{i: 72, as: AMOVWZ, a1: C_SCON, a6: C_LOREG},
{i: 72, as: AMOVWZ, a1: C_ADDCON, a6: C_LOREG},
{i: 72, as: AMOVB, a1: C_SCON, a6: C_LOREG},
{i: 72, as: AMOVB, a1: C_ADDCON, a6: C_LOREG},
{i: 72, as: AMOVBZ, a1: C_SCON, a6: C_LOREG},
{i: 72, as: AMOVBZ, a1: C_ADDCON, a6: C_LOREG},
// store
Optab{i: 35, as: AMOVD, a1: C_REG, a6: C_LAUTO},
Optab{i: 35, as: AMOVW, a1: C_REG, a6: C_LAUTO},
Optab{i: 35, as: AMOVWZ, a1: C_REG, a6: C_LAUTO},
Optab{i: 35, as: AMOVBZ, a1: C_REG, a6: C_LAUTO},
Optab{i: 35, as: AMOVB, a1: C_REG, a6: C_LAUTO},
Optab{i: 35, as: AMOVDBR, a1: C_REG, a6: C_LAUTO},
Optab{i: 35, as: AMOVHBR, a1: C_REG, a6: C_LAUTO},
Optab{i: 35, as: AMOVD, a1: C_REG, a6: C_LOREG},
Optab{i: 35, as: AMOVW, a1: C_REG, a6: C_LOREG},
Optab{i: 35, as: AMOVWZ, a1: C_REG, a6: C_LOREG},
Optab{i: 35, as: AMOVBZ, a1: C_REG, a6: C_LOREG},
Optab{i: 35, as: AMOVB, a1: C_REG, a6: C_LOREG},
Optab{i: 35, as: AMOVDBR, a1: C_REG, a6: C_LOREG},
Optab{i: 35, as: AMOVHBR, a1: C_REG, a6: C_LOREG},
Optab{i: 74, as: AMOVD, a1: C_REG, a6: C_ADDR},
Optab{i: 74, as: AMOVW, a1: C_REG, a6: C_ADDR},
Optab{i: 74, as: AMOVWZ, a1: C_REG, a6: C_ADDR},
Optab{i: 74, as: AMOVBZ, a1: C_REG, a6: C_ADDR},
Optab{i: 74, as: AMOVB, a1: C_REG, a6: C_ADDR},
{i: 35, as: AMOVD, a1: C_REG, a6: C_LAUTO},
{i: 35, as: AMOVW, a1: C_REG, a6: C_LAUTO},
{i: 35, as: AMOVWZ, a1: C_REG, a6: C_LAUTO},
{i: 35, as: AMOVBZ, a1: C_REG, a6: C_LAUTO},
{i: 35, as: AMOVB, a1: C_REG, a6: C_LAUTO},
{i: 35, as: AMOVDBR, a1: C_REG, a6: C_LAUTO},
{i: 35, as: AMOVHBR, a1: C_REG, a6: C_LAUTO},
{i: 35, as: AMOVD, a1: C_REG, a6: C_LOREG},
{i: 35, as: AMOVW, a1: C_REG, a6: C_LOREG},
{i: 35, as: AMOVWZ, a1: C_REG, a6: C_LOREG},
{i: 35, as: AMOVBZ, a1: C_REG, a6: C_LOREG},
{i: 35, as: AMOVB, a1: C_REG, a6: C_LOREG},
{i: 35, as: AMOVDBR, a1: C_REG, a6: C_LOREG},
{i: 35, as: AMOVHBR, a1: C_REG, a6: C_LOREG},
{i: 74, as: AMOVD, a1: C_REG, a6: C_ADDR},
{i: 74, as: AMOVW, a1: C_REG, a6: C_ADDR},
{i: 74, as: AMOVWZ, a1: C_REG, a6: C_ADDR},
{i: 74, as: AMOVBZ, a1: C_REG, a6: C_ADDR},
{i: 74, as: AMOVB, a1: C_REG, a6: C_ADDR},
// load
Optab{i: 36, as: AMOVD, a1: C_LAUTO, a6: C_REG},
Optab{i: 36, as: AMOVW, a1: C_LAUTO, a6: C_REG},
Optab{i: 36, as: AMOVWZ, a1: C_LAUTO, a6: C_REG},
Optab{i: 36, as: AMOVBZ, a1: C_LAUTO, a6: C_REG},
Optab{i: 36, as: AMOVB, a1: C_LAUTO, a6: C_REG},
Optab{i: 36, as: AMOVDBR, a1: C_LAUTO, a6: C_REG},
Optab{i: 36, as: AMOVHBR, a1: C_LAUTO, a6: C_REG},
Optab{i: 36, as: AMOVD, a1: C_LOREG, a6: C_REG},
Optab{i: 36, as: AMOVW, a1: C_LOREG, a6: C_REG},
Optab{i: 36, as: AMOVWZ, a1: C_LOREG, a6: C_REG},
Optab{i: 36, as: AMOVBZ, a1: C_LOREG, a6: C_REG},
Optab{i: 36, as: AMOVB, a1: C_LOREG, a6: C_REG},
Optab{i: 36, as: AMOVDBR, a1: C_LOREG, a6: C_REG},
Optab{i: 36, as: AMOVHBR, a1: C_LOREG, a6: C_REG},
Optab{i: 75, as: AMOVD, a1: C_ADDR, a6: C_REG},
Optab{i: 75, as: AMOVW, a1: C_ADDR, a6: C_REG},
Optab{i: 75, as: AMOVWZ, a1: C_ADDR, a6: C_REG},
Optab{i: 75, as: AMOVBZ, a1: C_ADDR, a6: C_REG},
Optab{i: 75, as: AMOVB, a1: C_ADDR, a6: C_REG},
{i: 36, as: AMOVD, a1: C_LAUTO, a6: C_REG},
{i: 36, as: AMOVW, a1: C_LAUTO, a6: C_REG},
{i: 36, as: AMOVWZ, a1: C_LAUTO, a6: C_REG},
{i: 36, as: AMOVBZ, a1: C_LAUTO, a6: C_REG},
{i: 36, as: AMOVB, a1: C_LAUTO, a6: C_REG},
{i: 36, as: AMOVDBR, a1: C_LAUTO, a6: C_REG},
{i: 36, as: AMOVHBR, a1: C_LAUTO, a6: C_REG},
{i: 36, as: AMOVD, a1: C_LOREG, a6: C_REG},
{i: 36, as: AMOVW, a1: C_LOREG, a6: C_REG},
{i: 36, as: AMOVWZ, a1: C_LOREG, a6: C_REG},
{i: 36, as: AMOVBZ, a1: C_LOREG, a6: C_REG},
{i: 36, as: AMOVB, a1: C_LOREG, a6: C_REG},
{i: 36, as: AMOVDBR, a1: C_LOREG, a6: C_REG},
{i: 36, as: AMOVHBR, a1: C_LOREG, a6: C_REG},
{i: 75, as: AMOVD, a1: C_ADDR, a6: C_REG},
{i: 75, as: AMOVW, a1: C_ADDR, a6: C_REG},
{i: 75, as: AMOVWZ, a1: C_ADDR, a6: C_REG},
{i: 75, as: AMOVBZ, a1: C_ADDR, a6: C_REG},
{i: 75, as: AMOVB, a1: C_ADDR, a6: C_REG},
// interlocked load and op
Optab{i: 99, as: ALAAG, a1: C_REG, a2: C_REG, a6: C_LOREG},
{i: 99, as: ALAAG, a1: C_REG, a2: C_REG, a6: C_LOREG},
// integer arithmetic
Optab{i: 2, as: AADD, a1: C_REG, a2: C_REG, a6: C_REG},
Optab{i: 2, as: AADD, a1: C_REG, a6: C_REG},
Optab{i: 22, as: AADD, a1: C_LCON, a2: C_REG, a6: C_REG},
Optab{i: 22, as: AADD, a1: C_LCON, a6: C_REG},
Optab{i: 12, as: AADD, a1: C_LOREG, a6: C_REG},
Optab{i: 12, as: AADD, a1: C_LAUTO, a6: C_REG},
Optab{i: 21, as: ASUB, a1: C_LCON, a2: C_REG, a6: C_REG},
Optab{i: 21, as: ASUB, a1: C_LCON, a6: C_REG},
Optab{i: 12, as: ASUB, a1: C_LOREG, a6: C_REG},
Optab{i: 12, as: ASUB, a1: C_LAUTO, a6: C_REG},
Optab{i: 4, as: AMULHD, a1: C_REG, a6: C_REG},
Optab{i: 4, as: AMULHD, a1: C_REG, a2: C_REG, a6: C_REG},
Optab{i: 2, as: ADIVW, a1: C_REG, a2: C_REG, a6: C_REG},
Optab{i: 2, as: ADIVW, a1: C_REG, a6: C_REG},
Optab{i: 10, as: ASUB, a1: C_REG, a2: C_REG, a6: C_REG},
Optab{i: 10, as: ASUB, a1: C_REG, a6: C_REG},
Optab{i: 47, as: ANEG, a1: C_REG, a6: C_REG},
Optab{i: 47, as: ANEG, a6: C_REG},
{i: 2, as: AADD, a1: C_REG, a2: C_REG, a6: C_REG},
{i: 2, as: AADD, a1: C_REG, a6: C_REG},
{i: 22, as: AADD, a1: C_LCON, a2: C_REG, a6: C_REG},
{i: 22, as: AADD, a1: C_LCON, a6: C_REG},
{i: 12, as: AADD, a1: C_LOREG, a6: C_REG},
{i: 12, as: AADD, a1: C_LAUTO, a6: C_REG},
{i: 21, as: ASUB, a1: C_LCON, a2: C_REG, a6: C_REG},
{i: 21, as: ASUB, a1: C_LCON, a6: C_REG},
{i: 12, as: ASUB, a1: C_LOREG, a6: C_REG},
{i: 12, as: ASUB, a1: C_LAUTO, a6: C_REG},
{i: 4, as: AMULHD, a1: C_REG, a6: C_REG},
{i: 4, as: AMULHD, a1: C_REG, a2: C_REG, a6: C_REG},
{i: 2, as: ADIVW, a1: C_REG, a2: C_REG, a6: C_REG},
{i: 2, as: ADIVW, a1: C_REG, a6: C_REG},
{i: 10, as: ASUB, a1: C_REG, a2: C_REG, a6: C_REG},
{i: 10, as: ASUB, a1: C_REG, a6: C_REG},
{i: 47, as: ANEG, a1: C_REG, a6: C_REG},
{i: 47, as: ANEG, a6: C_REG},
// integer logical
Optab{i: 6, as: AAND, a1: C_REG, a2: C_REG, a6: C_REG},
Optab{i: 6, as: AAND, a1: C_REG, a6: C_REG},
Optab{i: 23, as: AAND, a1: C_LCON, a6: C_REG},
Optab{i: 12, as: AAND, a1: C_LOREG, a6: C_REG},
Optab{i: 12, as: AAND, a1: C_LAUTO, a6: C_REG},
Optab{i: 6, as: AANDW, a1: C_REG, a2: C_REG, a6: C_REG},
Optab{i: 6, as: AANDW, a1: C_REG, a6: C_REG},
Optab{i: 24, as: AANDW, a1: C_LCON, a6: C_REG},
Optab{i: 12, as: AANDW, a1: C_LOREG, a6: C_REG},
Optab{i: 12, as: AANDW, a1: C_LAUTO, a6: C_REG},
Optab{i: 7, as: ASLD, a1: C_REG, a6: C_REG},
Optab{i: 7, as: ASLD, a1: C_REG, a2: C_REG, a6: C_REG},
Optab{i: 7, as: ASLD, a1: C_SCON, a2: C_REG, a6: C_REG},
Optab{i: 7, as: ASLD, a1: C_SCON, a6: C_REG},
Optab{i: 13, as: ARNSBG, a1: C_SCON, a3: C_SCON, a4: C_SCON, a5: C_REG, a6: C_REG},
{i: 6, as: AAND, a1: C_REG, a2: C_REG, a6: C_REG},
{i: 6, as: AAND, a1: C_REG, a6: C_REG},
{i: 23, as: AAND, a1: C_LCON, a6: C_REG},
{i: 12, as: AAND, a1: C_LOREG, a6: C_REG},
{i: 12, as: AAND, a1: C_LAUTO, a6: C_REG},
{i: 6, as: AANDW, a1: C_REG, a2: C_REG, a6: C_REG},
{i: 6, as: AANDW, a1: C_REG, a6: C_REG},
{i: 24, as: AANDW, a1: C_LCON, a6: C_REG},
{i: 12, as: AANDW, a1: C_LOREG, a6: C_REG},
{i: 12, as: AANDW, a1: C_LAUTO, a6: C_REG},
{i: 7, as: ASLD, a1: C_REG, a6: C_REG},
{i: 7, as: ASLD, a1: C_REG, a2: C_REG, a6: C_REG},
{i: 7, as: ASLD, a1: C_SCON, a2: C_REG, a6: C_REG},
{i: 7, as: ASLD, a1: C_SCON, a6: C_REG},
{i: 13, as: ARNSBG, a1: C_SCON, a3: C_SCON, a4: C_SCON, a5: C_REG, a6: C_REG},
// compare and swap
Optab{i: 79, as: ACSG, a1: C_REG, a2: C_REG, a6: C_SOREG},
{i: 79, as: ACSG, a1: C_REG, a2: C_REG, a6: C_SOREG},
// floating point
Optab{i: 32, as: AFADD, a1: C_FREG, a6: C_FREG},
Optab{i: 33, as: AFABS, a1: C_FREG, a6: C_FREG},
Optab{i: 33, as: AFABS, a6: C_FREG},
Optab{i: 34, as: AFMADD, a1: C_FREG, a2: C_FREG, a6: C_FREG},
Optab{i: 32, as: AFMUL, a1: C_FREG, a6: C_FREG},
Optab{i: 36, as: AFMOVD, a1: C_LAUTO, a6: C_FREG},
Optab{i: 36, as: AFMOVD, a1: C_LOREG, a6: C_FREG},
Optab{i: 75, as: AFMOVD, a1: C_ADDR, a6: C_FREG},
Optab{i: 35, as: AFMOVD, a1: C_FREG, a6: C_LAUTO},
Optab{i: 35, as: AFMOVD, a1: C_FREG, a6: C_LOREG},
Optab{i: 74, as: AFMOVD, a1: C_FREG, a6: C_ADDR},
Optab{i: 67, as: AFMOVD, a1: C_ZCON, a6: C_FREG},
Optab{i: 81, as: ALDGR, a1: C_REG, a6: C_FREG},
Optab{i: 81, as: ALGDR, a1: C_FREG, a6: C_REG},
Optab{i: 82, as: ACEFBRA, a1: C_REG, a6: C_FREG},
Optab{i: 83, as: ACFEBRA, a1: C_FREG, a6: C_REG},
Optab{i: 48, as: AFIEBR, a1: C_SCON, a2: C_FREG, a6: C_FREG},
Optab{i: 49, as: ACPSDR, a1: C_FREG, a2: C_FREG, a6: C_FREG},
Optab{i: 50, as: ALTDBR, a1: C_FREG, a6: C_FREG},
Optab{i: 51, as: ATCDB, a1: C_FREG, a6: C_SCON},
{i: 32, as: AFADD, a1: C_FREG, a6: C_FREG},
{i: 33, as: AFABS, a1: C_FREG, a6: C_FREG},
{i: 33, as: AFABS, a6: C_FREG},
{i: 34, as: AFMADD, a1: C_FREG, a2: C_FREG, a6: C_FREG},
{i: 32, as: AFMUL, a1: C_FREG, a6: C_FREG},
{i: 36, as: AFMOVD, a1: C_LAUTO, a6: C_FREG},
{i: 36, as: AFMOVD, a1: C_LOREG, a6: C_FREG},
{i: 75, as: AFMOVD, a1: C_ADDR, a6: C_FREG},
{i: 35, as: AFMOVD, a1: C_FREG, a6: C_LAUTO},
{i: 35, as: AFMOVD, a1: C_FREG, a6: C_LOREG},
{i: 74, as: AFMOVD, a1: C_FREG, a6: C_ADDR},
{i: 67, as: AFMOVD, a1: C_ZCON, a6: C_FREG},
{i: 81, as: ALDGR, a1: C_REG, a6: C_FREG},
{i: 81, as: ALGDR, a1: C_FREG, a6: C_REG},
{i: 82, as: ACEFBRA, a1: C_REG, a6: C_FREG},
{i: 83, as: ACFEBRA, a1: C_FREG, a6: C_REG},
{i: 48, as: AFIEBR, a1: C_SCON, a2: C_FREG, a6: C_FREG},
{i: 49, as: ACPSDR, a1: C_FREG, a2: C_FREG, a6: C_FREG},
{i: 50, as: ALTDBR, a1: C_FREG, a6: C_FREG},
{i: 51, as: ATCDB, a1: C_FREG, a6: C_SCON},
// load symbol address (plus offset)
Optab{i: 19, as: AMOVD, a1: C_SYMADDR, a6: C_REG},
Optab{i: 93, as: AMOVD, a1: C_GOTADDR, a6: C_REG},
Optab{i: 94, as: AMOVD, a1: C_TLS_LE, a6: C_REG},
Optab{i: 95, as: AMOVD, a1: C_TLS_IE, a6: C_REG},
{i: 19, as: AMOVD, a1: C_SYMADDR, a6: C_REG},
{i: 93, as: AMOVD, a1: C_GOTADDR, a6: C_REG},
{i: 94, as: AMOVD, a1: C_TLS_LE, a6: C_REG},
{i: 95, as: AMOVD, a1: C_TLS_IE, a6: C_REG},
// system call
Optab{i: 5, as: ASYSCALL},
Optab{i: 77, as: ASYSCALL, a1: C_SCON},
{i: 5, as: ASYSCALL},
{i: 77, as: ASYSCALL, a1: C_SCON},
// branch
Optab{i: 16, as: ABEQ, a6: C_SBRA},
Optab{i: 11, as: ABR, a6: C_LBRA},
Optab{i: 16, as: ABC, a1: C_SCON, a2: C_REG, a6: C_LBRA},
Optab{i: 18, as: ABR, a6: C_REG},
Optab{i: 18, as: ABR, a1: C_REG, a6: C_REG},
Optab{i: 15, as: ABR, a6: C_ZOREG},
Optab{i: 15, as: ABC, a6: C_ZOREG},
Optab{i: 89, as: ACMPBEQ, a1: C_REG, a2: C_REG, a6: C_SBRA},
Optab{i: 90, as: ACMPBEQ, a1: C_REG, a3: C_ADDCON, a6: C_SBRA},
Optab{i: 90, as: ACMPBEQ, a1: C_REG, a3: C_SCON, a6: C_SBRA},
Optab{i: 89, as: ACMPUBEQ, a1: C_REG, a2: C_REG, a6: C_SBRA},
Optab{i: 90, as: ACMPUBEQ, a1: C_REG, a3: C_ANDCON, a6: C_SBRA},
{i: 16, as: ABEQ, a6: C_SBRA},
{i: 11, as: ABR, a6: C_LBRA},
{i: 16, as: ABC, a1: C_SCON, a2: C_REG, a6: C_LBRA},
{i: 18, as: ABR, a6: C_REG},
{i: 18, as: ABR, a1: C_REG, a6: C_REG},
{i: 15, as: ABR, a6: C_ZOREG},
{i: 15, as: ABC, a6: C_ZOREG},
{i: 89, as: ACMPBEQ, a1: C_REG, a2: C_REG, a6: C_SBRA},
{i: 90, as: ACMPBEQ, a1: C_REG, a3: C_ADDCON, a6: C_SBRA},
{i: 90, as: ACMPBEQ, a1: C_REG, a3: C_SCON, a6: C_SBRA},
{i: 89, as: ACMPUBEQ, a1: C_REG, a2: C_REG, a6: C_SBRA},
{i: 90, as: ACMPUBEQ, a1: C_REG, a3: C_ANDCON, a6: C_SBRA},
// move on condition
Optab{i: 17, as: AMOVDEQ, a1: C_REG, a6: C_REG},
{i: 17, as: AMOVDEQ, a1: C_REG, a6: C_REG},
// find leftmost one
Optab{i: 8, as: AFLOGR, a1: C_REG, a6: C_REG},
{i: 8, as: AFLOGR, a1: C_REG, a6: C_REG},
// population count
Optab{i: 9, as: APOPCNT, a1: C_REG, a6: C_REG},
{i: 9, as: APOPCNT, a1: C_REG, a6: C_REG},
// compare
Optab{i: 70, as: ACMP, a1: C_REG, a6: C_REG},
Optab{i: 71, as: ACMP, a1: C_REG, a6: C_LCON},
Optab{i: 70, as: ACMPU, a1: C_REG, a6: C_REG},
Optab{i: 71, as: ACMPU, a1: C_REG, a6: C_LCON},
Optab{i: 70, as: AFCMPO, a1: C_FREG, a6: C_FREG},
Optab{i: 70, as: AFCMPO, a1: C_FREG, a2: C_REG, a6: C_FREG},
{i: 70, as: ACMP, a1: C_REG, a6: C_REG},
{i: 71, as: ACMP, a1: C_REG, a6: C_LCON},
{i: 70, as: ACMPU, a1: C_REG, a6: C_REG},
{i: 71, as: ACMPU, a1: C_REG, a6: C_LCON},
{i: 70, as: AFCMPO, a1: C_FREG, a6: C_FREG},
{i: 70, as: AFCMPO, a1: C_FREG, a2: C_REG, a6: C_FREG},
// test under mask
Optab{i: 91, as: ATMHH, a1: C_REG, a6: C_ANDCON},
{i: 91, as: ATMHH, a1: C_REG, a6: C_ANDCON},
// insert program mask
Optab{i: 92, as: AIPM, a1: C_REG},
{i: 92, as: AIPM, a1: C_REG},
// 32-bit access registers
Optab{i: 68, as: AMOVW, a1: C_AREG, a6: C_REG},
Optab{i: 68, as: AMOVWZ, a1: C_AREG, a6: C_REG},
Optab{i: 69, as: AMOVW, a1: C_REG, a6: C_AREG},
Optab{i: 69, as: AMOVWZ, a1: C_REG, a6: C_AREG},
{i: 68, as: AMOVW, a1: C_AREG, a6: C_REG},
{i: 68, as: AMOVWZ, a1: C_AREG, a6: C_REG},
{i: 69, as: AMOVW, a1: C_REG, a6: C_AREG},
{i: 69, as: AMOVWZ, a1: C_REG, a6: C_AREG},
// macros
Optab{i: 96, as: ACLEAR, a1: C_LCON, a6: C_LOREG},
Optab{i: 96, as: ACLEAR, a1: C_LCON, a6: C_LAUTO},
{i: 96, as: ACLEAR, a1: C_LCON, a6: C_LOREG},
{i: 96, as: ACLEAR, a1: C_LCON, a6: C_LAUTO},
// load/store multiple
Optab{i: 97, as: ASTMG, a1: C_REG, a2: C_REG, a6: C_LOREG},
Optab{i: 97, as: ASTMG, a1: C_REG, a2: C_REG, a6: C_LAUTO},
Optab{i: 98, as: ALMG, a1: C_LOREG, a2: C_REG, a6: C_REG},
Optab{i: 98, as: ALMG, a1: C_LAUTO, a2: C_REG, a6: C_REG},
{i: 97, as: ASTMG, a1: C_REG, a2: C_REG, a6: C_LOREG},
{i: 97, as: ASTMG, a1: C_REG, a2: C_REG, a6: C_LAUTO},
{i: 98, as: ALMG, a1: C_LOREG, a2: C_REG, a6: C_REG},
{i: 98, as: ALMG, a1: C_LAUTO, a2: C_REG, a6: C_REG},
// bytes
Optab{i: 40, as: ABYTE, a1: C_SCON},
Optab{i: 40, as: AWORD, a1: C_LCON},
Optab{i: 31, as: ADWORD, a1: C_LCON},
Optab{i: 31, as: ADWORD, a1: C_DCON},
{i: 40, as: ABYTE, a1: C_SCON},
{i: 40, as: AWORD, a1: C_LCON},
{i: 31, as: ADWORD, a1: C_LCON},
{i: 31, as: ADWORD, a1: C_DCON},
// fast synchronization
Optab{i: 80, as: ASYNC},
{i: 80, as: ASYNC},
// store clock
Optab{i: 88, as: ASTCK, a6: C_SAUTO},
Optab{i: 88, as: ASTCK, a6: C_SOREG},
{i: 88, as: ASTCK, a6: C_SAUTO},
{i: 88, as: ASTCK, a6: C_SOREG},
// storage and storage
Optab{i: 84, as: AMVC, a1: C_SCON, a3: C_LOREG, a6: C_LOREG},
Optab{i: 84, as: AMVC, a1: C_SCON, a3: C_LOREG, a6: C_LAUTO},
Optab{i: 84, as: AMVC, a1: C_SCON, a3: C_LAUTO, a6: C_LAUTO},
{i: 84, as: AMVC, a1: C_SCON, a3: C_LOREG, a6: C_LOREG},
{i: 84, as: AMVC, a1: C_SCON, a3: C_LOREG, a6: C_LAUTO},
{i: 84, as: AMVC, a1: C_SCON, a3: C_LAUTO, a6: C_LAUTO},
// address
Optab{i: 85, as: ALARL, a1: C_LCON, a6: C_REG},
Optab{i: 85, as: ALARL, a1: C_SYMADDR, a6: C_REG},
Optab{i: 86, as: ALA, a1: C_SOREG, a6: C_REG},
Optab{i: 86, as: ALA, a1: C_SAUTO, a6: C_REG},
Optab{i: 87, as: AEXRL, a1: C_SYMADDR, a6: C_REG},
{i: 85, as: ALARL, a1: C_LCON, a6: C_REG},
{i: 85, as: ALARL, a1: C_SYMADDR, a6: C_REG},
{i: 86, as: ALA, a1: C_SOREG, a6: C_REG},
{i: 86, as: ALA, a1: C_SAUTO, a6: C_REG},
{i: 87, as: AEXRL, a1: C_SYMADDR, a6: C_REG},
// undefined (deliberate illegal instruction)
Optab{i: 78, as: obj.AUNDEF},
{i: 78, as: obj.AUNDEF},
// vector instructions
// VRX store
Optab{i: 100, as: AVST, a1: C_VREG, a6: C_SOREG},
Optab{i: 100, as: AVST, a1: C_VREG, a6: C_SAUTO},
Optab{i: 100, as: AVSTEG, a1: C_SCON, a2: C_VREG, a6: C_SOREG},
Optab{i: 100, as: AVSTEG, a1: C_SCON, a2: C_VREG, a6: C_SAUTO},
{i: 100, as: AVST, a1: C_VREG, a6: C_SOREG},
{i: 100, as: AVST, a1: C_VREG, a6: C_SAUTO},
{i: 100, as: AVSTEG, a1: C_SCON, a2: C_VREG, a6: C_SOREG},
{i: 100, as: AVSTEG, a1: C_SCON, a2: C_VREG, a6: C_SAUTO},
// VRX load
Optab{i: 101, as: AVL, a1: C_SOREG, a6: C_VREG},
Optab{i: 101, as: AVL, a1: C_SAUTO, a6: C_VREG},
Optab{i: 101, as: AVLEG, a1: C_SCON, a3: C_SOREG, a6: C_VREG},
Optab{i: 101, as: AVLEG, a1: C_SCON, a3: C_SAUTO, a6: C_VREG},
{i: 101, as: AVL, a1: C_SOREG, a6: C_VREG},
{i: 101, as: AVL, a1: C_SAUTO, a6: C_VREG},
{i: 101, as: AVLEG, a1: C_SCON, a3: C_SOREG, a6: C_VREG},
{i: 101, as: AVLEG, a1: C_SCON, a3: C_SAUTO, a6: C_VREG},
// VRV scatter
Optab{i: 102, as: AVSCEG, a1: C_SCON, a2: C_VREG, a6: C_SOREG},
Optab{i: 102, as: AVSCEG, a1: C_SCON, a2: C_VREG, a6: C_SAUTO},
{i: 102, as: AVSCEG, a1: C_SCON, a2: C_VREG, a6: C_SOREG},
{i: 102, as: AVSCEG, a1: C_SCON, a2: C_VREG, a6: C_SAUTO},
// VRV gather
Optab{i: 103, as: AVGEG, a1: C_SCON, a3: C_SOREG, a6: C_VREG},
Optab{i: 103, as: AVGEG, a1: C_SCON, a3: C_SAUTO, a6: C_VREG},
{i: 103, as: AVGEG, a1: C_SCON, a3: C_SOREG, a6: C_VREG},
{i: 103, as: AVGEG, a1: C_SCON, a3: C_SAUTO, a6: C_VREG},
// VRS element shift/rotate and load gr to/from vr element
Optab{i: 104, as: AVESLG, a1: C_SCON, a2: C_VREG, a6: C_VREG},
Optab{i: 104, as: AVESLG, a1: C_REG, a2: C_VREG, a6: C_VREG},
Optab{i: 104, as: AVESLG, a1: C_SCON, a6: C_VREG},
Optab{i: 104, as: AVESLG, a1: C_REG, a6: C_VREG},
Optab{i: 104, as: AVLGVG, a1: C_SCON, a2: C_VREG, a6: C_REG},
Optab{i: 104, as: AVLGVG, a1: C_REG, a2: C_VREG, a6: C_REG},
Optab{i: 104, as: AVLVGG, a1: C_SCON, a2: C_REG, a6: C_VREG},
Optab{i: 104, as: AVLVGG, a1: C_REG, a2: C_REG, a6: C_VREG},
{i: 104, as: AVESLG, a1: C_SCON, a2: C_VREG, a6: C_VREG},
{i: 104, as: AVESLG, a1: C_REG, a2: C_VREG, a6: C_VREG},
{i: 104, as: AVESLG, a1: C_SCON, a6: C_VREG},
{i: 104, as: AVESLG, a1: C_REG, a6: C_VREG},
{i: 104, as: AVLGVG, a1: C_SCON, a2: C_VREG, a6: C_REG},
{i: 104, as: AVLGVG, a1: C_REG, a2: C_VREG, a6: C_REG},
{i: 104, as: AVLVGG, a1: C_SCON, a2: C_REG, a6: C_VREG},
{i: 104, as: AVLVGG, a1: C_REG, a2: C_REG, a6: C_VREG},
// VRS store multiple
Optab{i: 105, as: AVSTM, a1: C_VREG, a2: C_VREG, a6: C_SOREG},
Optab{i: 105, as: AVSTM, a1: C_VREG, a2: C_VREG, a6: C_SAUTO},
{i: 105, as: AVSTM, a1: C_VREG, a2: C_VREG, a6: C_SOREG},
{i: 105, as: AVSTM, a1: C_VREG, a2: C_VREG, a6: C_SAUTO},
// VRS load multiple
Optab{i: 106, as: AVLM, a1: C_SOREG, a2: C_VREG, a6: C_VREG},
Optab{i: 106, as: AVLM, a1: C_SAUTO, a2: C_VREG, a6: C_VREG},
{i: 106, as: AVLM, a1: C_SOREG, a2: C_VREG, a6: C_VREG},
{i: 106, as: AVLM, a1: C_SAUTO, a2: C_VREG, a6: C_VREG},
// VRS store with length
Optab{i: 107, as: AVSTL, a1: C_REG, a2: C_VREG, a6: C_SOREG},
Optab{i: 107, as: AVSTL, a1: C_REG, a2: C_VREG, a6: C_SAUTO},
{i: 107, as: AVSTL, a1: C_REG, a2: C_VREG, a6: C_SOREG},
{i: 107, as: AVSTL, a1: C_REG, a2: C_VREG, a6: C_SAUTO},
// VRS load with length
Optab{i: 108, as: AVLL, a1: C_REG, a3: C_SOREG, a6: C_VREG},
Optab{i: 108, as: AVLL, a1: C_REG, a3: C_SAUTO, a6: C_VREG},
{i: 108, as: AVLL, a1: C_REG, a3: C_SOREG, a6: C_VREG},
{i: 108, as: AVLL, a1: C_REG, a3: C_SAUTO, a6: C_VREG},
// VRI-a
Optab{i: 109, as: AVGBM, a1: C_ANDCON, a6: C_VREG},
Optab{i: 109, as: AVZERO, a6: C_VREG},
Optab{i: 109, as: AVREPIG, a1: C_ADDCON, a6: C_VREG},
Optab{i: 109, as: AVREPIG, a1: C_SCON, a6: C_VREG},
Optab{i: 109, as: AVLEIG, a1: C_SCON, a3: C_ADDCON, a6: C_VREG},
Optab{i: 109, as: AVLEIG, a1: C_SCON, a3: C_SCON, a6: C_VREG},
{i: 109, as: AVGBM, a1: C_ANDCON, a6: C_VREG},
{i: 109, as: AVZERO, a6: C_VREG},
{i: 109, as: AVREPIG, a1: C_ADDCON, a6: C_VREG},
{i: 109, as: AVREPIG, a1: C_SCON, a6: C_VREG},
{i: 109, as: AVLEIG, a1: C_SCON, a3: C_ADDCON, a6: C_VREG},
{i: 109, as: AVLEIG, a1: C_SCON, a3: C_SCON, a6: C_VREG},
// VRI-b generate mask
Optab{i: 110, as: AVGMG, a1: C_SCON, a3: C_SCON, a6: C_VREG},
{i: 110, as: AVGMG, a1: C_SCON, a3: C_SCON, a6: C_VREG},
// VRI-c replicate
Optab{i: 111, as: AVREPG, a1: C_UCON, a2: C_VREG, a6: C_VREG},
{i: 111, as: AVREPG, a1: C_UCON, a2: C_VREG, a6: C_VREG},
// VRI-d element rotate and insert under mask and
// shift left double by byte
Optab{i: 112, as: AVERIMG, a1: C_SCON, a2: C_VREG, a3: C_VREG, a6: C_VREG},
Optab{i: 112, as: AVSLDB, a1: C_SCON, a2: C_VREG, a3: C_VREG, a6: C_VREG},
{i: 112, as: AVERIMG, a1: C_SCON, a2: C_VREG, a3: C_VREG, a6: C_VREG},
{i: 112, as: AVSLDB, a1: C_SCON, a2: C_VREG, a3: C_VREG, a6: C_VREG},
// VRI-d fp test data class immediate
Optab{i: 113, as: AVFTCIDB, a1: C_SCON, a2: C_VREG, a6: C_VREG},
{i: 113, as: AVFTCIDB, a1: C_SCON, a2: C_VREG, a6: C_VREG},
// VRR-a load reg
Optab{i: 114, as: AVLR, a1: C_VREG, a6: C_VREG},
{i: 114, as: AVLR, a1: C_VREG, a6: C_VREG},
// VRR-a compare
Optab{i: 115, as: AVECG, a1: C_VREG, a6: C_VREG},
{i: 115, as: AVECG, a1: C_VREG, a6: C_VREG},
// VRR-b
Optab{i: 117, as: AVCEQG, a1: C_VREG, a2: C_VREG, a6: C_VREG},
Optab{i: 117, as: AVFAEF, a1: C_VREG, a2: C_VREG, a6: C_VREG},
Optab{i: 117, as: AVPKSG, a1: C_VREG, a2: C_VREG, a6: C_VREG},
{i: 117, as: AVCEQG, a1: C_VREG, a2: C_VREG, a6: C_VREG},
{i: 117, as: AVFAEF, a1: C_VREG, a2: C_VREG, a6: C_VREG},
{i: 117, as: AVPKSG, a1: C_VREG, a2: C_VREG, a6: C_VREG},
// VRR-c
Optab{i: 118, as: AVAQ, a1: C_VREG, a2: C_VREG, a6: C_VREG},
Optab{i: 118, as: AVAQ, a1: C_VREG, a6: C_VREG},
Optab{i: 118, as: AVNOT, a1: C_VREG, a6: C_VREG},
Optab{i: 123, as: AVPDI, a1: C_SCON, a2: C_VREG, a3: C_VREG, a6: C_VREG},
{i: 118, as: AVAQ, a1: C_VREG, a2: C_VREG, a6: C_VREG},
{i: 118, as: AVAQ, a1: C_VREG, a6: C_VREG},
{i: 118, as: AVNOT, a1: C_VREG, a6: C_VREG},
{i: 123, as: AVPDI, a1: C_SCON, a2: C_VREG, a3: C_VREG, a6: C_VREG},
// VRR-c shifts
Optab{i: 119, as: AVERLLVG, a1: C_VREG, a2: C_VREG, a6: C_VREG},
Optab{i: 119, as: AVERLLVG, a1: C_VREG, a6: C_VREG},
{i: 119, as: AVERLLVG, a1: C_VREG, a2: C_VREG, a6: C_VREG},
{i: 119, as: AVERLLVG, a1: C_VREG, a6: C_VREG},
// VRR-d
Optab{i: 120, as: AVACQ, a1: C_VREG, a2: C_VREG, a3: C_VREG, a6: C_VREG},
{i: 120, as: AVACQ, a1: C_VREG, a2: C_VREG, a3: C_VREG, a6: C_VREG},
// VRR-e
Optab{i: 121, as: AVSEL, a1: C_VREG, a2: C_VREG, a3: C_VREG, a6: C_VREG},
{i: 121, as: AVSEL, a1: C_VREG, a2: C_VREG, a3: C_VREG, a6: C_VREG},
// VRR-f
Optab{i: 122, as: AVLVGP, a1: C_REG, a2: C_REG, a6: C_VREG},
{i: 122, as: AVLVGP, a1: C_REG, a2: C_REG, a6: C_VREG},
}
var oprange [ALAST & obj.AMask][]Optab
......
......@@ -164,9 +164,9 @@ func main() {
}`
want := map[string]map[string]bool{
"main.Foo": map[string]bool{"v": false},
"main.Bar": map[string]bool{"Foo": true, "name": false},
"main.Baz": map[string]bool{"Foo": true, "name": false},
"main.Foo": {"v": false},
"main.Bar": {"Foo": true, "name": false},
"main.Baz": {"Foo": true, "name": false},
}
dir, err := ioutil.TempDir("", "TestEmbeddedStructMarker")
......
......@@ -54,21 +54,21 @@ type wasmFuncType struct {
}
var wasmFuncTypes = map[string]*wasmFuncType{
"_rt0_wasm_js": &wasmFuncType{Params: []byte{}}, //
"wasm_export_run": &wasmFuncType{Params: []byte{I32, I32}}, // argc, argv
"wasm_export_resume": &wasmFuncType{Params: []byte{}}, //
"wasm_export_getsp": &wasmFuncType{Results: []byte{I32}}, // sp
"wasm_pc_f_loop": &wasmFuncType{Params: []byte{}}, //
"runtime.wasmMove": &wasmFuncType{Params: []byte{I32, I32, I32}}, // dst, src, len
"runtime.wasmZero": &wasmFuncType{Params: []byte{I32, I32}}, // ptr, len
"runtime.wasmDiv": &wasmFuncType{Params: []byte{I64, I64}, Results: []byte{I64}}, // x, y -> x/y
"runtime.wasmTruncS": &wasmFuncType{Params: []byte{F64}, Results: []byte{I64}}, // x -> int(x)
"runtime.wasmTruncU": &wasmFuncType{Params: []byte{F64}, Results: []byte{I64}}, // x -> uint(x)
"runtime.gcWriteBarrier": &wasmFuncType{Params: []byte{I64, I64}}, // ptr, val
"cmpbody": &wasmFuncType{Params: []byte{I64, I64, I64, I64}, Results: []byte{I64}}, // a, alen, b, blen -> -1/0/1
"memeqbody": &wasmFuncType{Params: []byte{I64, I64, I64}, Results: []byte{I64}}, // a, b, len -> 0/1
"memcmp": &wasmFuncType{Params: []byte{I32, I32, I32}, Results: []byte{I32}}, // a, b, len -> <0/0/>0
"memchr": &wasmFuncType{Params: []byte{I32, I32, I32}, Results: []byte{I32}}, // s, c, len -> index
"_rt0_wasm_js": {Params: []byte{}}, //
"wasm_export_run": {Params: []byte{I32, I32}}, // argc, argv
"wasm_export_resume": {Params: []byte{}}, //
"wasm_export_getsp": {Results: []byte{I32}}, // sp
"wasm_pc_f_loop": {Params: []byte{}}, //
"runtime.wasmMove": {Params: []byte{I32, I32, I32}}, // dst, src, len
"runtime.wasmZero": {Params: []byte{I32, I32}}, // ptr, len
"runtime.wasmDiv": {Params: []byte{I64, I64}, Results: []byte{I64}}, // x, y -> x/y
"runtime.wasmTruncS": {Params: []byte{F64}, Results: []byte{I64}}, // x -> int(x)
"runtime.wasmTruncU": {Params: []byte{F64}, Results: []byte{I64}}, // x -> uint(x)
"runtime.gcWriteBarrier": {Params: []byte{I64, I64}}, // ptr, val
"cmpbody": {Params: []byte{I64, I64, I64, I64}, Results: []byte{I64}}, // a, alen, b, blen -> -1/0/1
"memeqbody": {Params: []byte{I64, I64, I64}, Results: []byte{I64}}, // a, b, len -> 0/1
"memcmp": {Params: []byte{I32, I32, I32}, Results: []byte{I32}}, // a, b, len -> <0/0/>0
"memchr": {Params: []byte{I32, I32, I32}, Results: []byte{I32}}, // s, c, len -> index
}
func assignAddress(ctxt *ld.Link, sect *sym.Section, n int, s *sym.Symbol, va uint64, isTramp bool) (*sym.Section, int, uint64) {
......@@ -105,12 +105,12 @@ func asmb2(ctxt *ld.Link) {
// For normal Go functions the return value is
// 0 if the function returned normally or
// 1 if the stack needs to be unwound.
&wasmFuncType{Results: []byte{I32}},
{Results: []byte{I32}},
}
// collect host imports (functions that get imported from the WebAssembly host, usually JavaScript)
hostImports := []*wasmFunc{
&wasmFunc{
{
Name: "debug",
Type: lookupType(&wasmFuncType{Params: []byte{I32}}, &types),
},
......
......@@ -358,7 +358,7 @@ func buildProfile(prof map[uint64]Record) *profile.Profile {
ID: uint64(len(p.Location) + 1),
Address: frame.PC,
Line: []profile.Line{
profile.Line{
{
Function: fn,
Line: int64(frame.Line),
},
......
......@@ -169,12 +169,12 @@ type unmarshalTest struct {
var largeUnmarshalTests = []unmarshalTest{
// Data length: 7_102_415_735
unmarshalTest{
{
state: "md5\x01\xa5\xf7\xf0=\xd6S\x85\xd9M\n}\xc3\u0601\x89\xe7@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw",
sum: "cddefcf74ffec709a0b45a6a987564d5",
},
// Data length: 6_565_544_823
unmarshalTest{
{
state: "md5\x01{\xda\x1a\xc7\xc9'?\x83EX\xe0\x88q\xfeG\x18@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw",
sum: "fd9f41874ab240698e7bc9c3ae70c8e4",
},
......
......@@ -168,12 +168,12 @@ type unmarshalTest struct {
var largeUnmarshalTests = []unmarshalTest{
// Data length: 7_102_415_735
unmarshalTest{
{
state: "sha\x01\x13\xbc\xfe\x83\x8c\xbd\xdfP\x1f\xd8ڿ<\x9eji8t\xe1\xa5@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw",
sum: "bc6245c9959cc33e1c2592e5c9ea9b5d0431246c",
},
// Data length: 6_565_544_823
unmarshalTest{
{
state: "sha\x01m;\x16\xa6R\xbe@\xa9\xf9S\x03\x00B\xc2\xdcv\xcf@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw",
sum: "8f2d1c0e4271768f35feb918bfe21ea1387a2072",
},
......
......@@ -241,19 +241,19 @@ type unmarshalTest struct {
var largeUnmarshalTests = []unmarshalTest{
// Data length: 7_115_087_207
unmarshalTest{
{
state: "sha\x03yX\xaf\xb7\x04*\x8f\xaa\x9bx\xc5#\x1f\xeb\x94\xfdz1\xaf\xfb\n\xc93\xcf\x02\v.\xa5\xe4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa8\x17\x9dg",
sum: "f5e06371f0c115e9968455c8e48a318aba548b9f15676fa41de123f7d1c99c55",
},
// Data length: 7_070_038_086
unmarshalTest{
{
state: "sha\x03$\x933u\nV\v\xe2\xf7:0!ʳ\xa4\x13\xd3 6\xdcBB\xb5\x19\xcd=\xc1h\xee=\xb4\x9c@ABCDE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa5h8F",
sum: "a280b08df5eba060fcd0eb3d29320bbc038afb95781661f91bbfd0a6fc9fdd6e",
},
// Data length: 6_464_878_887
unmarshalTest{
{
state: "sha\x03\x9f\x12\x87G\xf2\xdf<\x82\xa0\x11/*W\x02&IKWlh\x03\x95\xb1\xab\f\n\xf6Ze\xf9\x1d\x1b\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x81V9'",
sum: "d2fffb762f105ab71e2d70069346c44c38c4fe183aad8cfcf5a76397c0457806",
},
......
......@@ -847,11 +847,11 @@ type unmarshalTest struct {
var largeUnmarshalTests = []unmarshalTest{
// Data length: 6_565_544_823
unmarshalTest{
{
state: "sha\aηe\x0f\x0f\xe1r]#\aoJ!.{5B\xe4\x140\x91\xdd\x00a\xe1\xb3E&\xb9\xbb\aJ\x9f^\x9f\x03ͺD\x96H\x80\xb0X\x9d\xdeʸ\f\xf7:\xd5\xe6'\xb9\x93f\xddA\xf0~\xe1\x02\x14\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw",
sum: "12d612357a1dbc74a28883dff79b83e7d2b881ae40d7a67fd7305490bc8a641cd1ce9ece598192080d6e9ac7e75d5988567a58a9812991299eb99a04ecb69523",
},
unmarshalTest{
{
state: "sha\a2\xd2\xdc\xf5\xd7\xe2\xf9\x97\xaa\xe7}Fϱ\xbc\x8e\xbf\x12h\x83Z\xa1\xc7\xf5p>bfS T\xea\xee\x1e\xa6Z\x9c\xa4ڶ\u0086\bn\xe47\x8fsGs3\xe0\xda\\\x9dqZ\xa5\xf6\xd0kM\xa1\xf2\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw",
sum: "94a04b9a901254cd94ca0313557e4be3ab1ca86e920c1f3efdc22d361e9ae12be66bc6d6dc5db79a0a4aa6eca6f293c1e9095bbae127ae405f6c325478343299",
},
......
......@@ -63,10 +63,8 @@ type leafSpec struct {
var nameConstraintsTests = []nameConstraintsTest{
// #0: dummy test for the certificate generation process itself.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
leaf: leafSpec{
sans: []string{"dns:example.com"},
},
......@@ -74,13 +72,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #1: dummy test for the certificate generation process itself: single
// level of intermediate.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -90,16 +86,14 @@ var nameConstraintsTests = []nameConstraintsTest{
// #2: dummy test for the certificate generation process itself: two
// levels of intermediates.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -108,15 +102,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #3: matching DNS constraint in root
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -125,13 +119,11 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #4: matching DNS constraint in intermediate.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:example.com"},
},
},
......@@ -142,15 +134,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #5: .example.com only matches subdomains.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -160,13 +152,11 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #6: .example.com matches subdomains.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:.example.com"},
},
},
......@@ -177,15 +167,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #7: .example.com matches multiple levels of subdomains
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -195,15 +185,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #8: specifying a permitted list of names does not exclude other name
// types
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -213,15 +203,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #9: specifying a permitted list of names does not exclude other name
// types
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"ip:10.0.0.0/8"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -232,15 +222,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #10: intermediates can try to permit other names, which isn't
// forbidden if the leaf doesn't mention them. I.e. name constraints
// apply to names, not constraints themselves.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:example.com", "dns:foo.com"},
},
},
......@@ -252,15 +242,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #11: intermediates cannot add permitted names that the root doesn't
// grant them.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:example.com", "dns:foo.com"},
},
},
......@@ -272,15 +262,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #12: intermediates can further limit their scope if they wish.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:.bar.example.com"},
},
},
......@@ -292,15 +282,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #13: intermediates can further limit their scope and that limitation
// is effective
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:.bar.example.com"},
},
},
......@@ -312,15 +302,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #14: roots can exclude subtrees and that doesn't affect other names.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"dns:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -329,15 +319,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #15: roots exclusions are effective.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"dns:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -348,13 +338,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #16: intermediates can also exclude names and that doesn't affect
// other names.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
bad: []string{"dns:.example.com"},
},
},
......@@ -365,13 +353,11 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #17: intermediate exclusions are effective.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
bad: []string{"dns:.example.com"},
},
},
......@@ -383,15 +369,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #18: having an exclusion doesn't prohibit other types of names.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"dns:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -401,15 +387,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #19: IP-based exclusions are permitted and don't affect unrelated IP
// addresses.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"ip:10.0.0.0/8"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -418,15 +404,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #20: IP-based exclusions are effective
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"ip:10.0.0.0/8"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -436,15 +422,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #21: intermediates can further constrain IP ranges.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"ip:0.0.0.0/1"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
bad: []string{"ip:11.0.0.0/8"},
},
},
......@@ -457,16 +443,14 @@ var nameConstraintsTests = []nameConstraintsTest{
// #22: when multiple intermediates are present, chain building can
// avoid intermediates with incompatible constraints.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:.foo.com"},
},
constraintsSpec{
{
ok: []string{"dns:.example.com"},
},
},
......@@ -479,16 +463,14 @@ var nameConstraintsTests = []nameConstraintsTest{
// #23: (same as the previous test, but in the other order in ensure
// that we don't pass it by luck.)
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:.example.com"},
},
constraintsSpec{
{
ok: []string{"dns:.foo.com"},
},
},
......@@ -501,16 +483,16 @@ var nameConstraintsTests = []nameConstraintsTest{
// #24: when multiple roots are valid, chain building can avoid roots
// with incompatible constraints.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{},
constraintsSpec{
{},
{
ok: []string{"dns:foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -521,16 +503,16 @@ var nameConstraintsTests = []nameConstraintsTest{
// #25: (same as the previous test, but in the other order in ensure
// that we don't pass it by luck.)
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com"},
},
constraintsSpec{},
{},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -541,26 +523,26 @@ var nameConstraintsTests = []nameConstraintsTest{
// #26: chain building can find a valid path even with multiple levels
// of alternative intermediates and alternative roots.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com"},
},
constraintsSpec{
{
ok: []string{"dns:example.com"},
},
constraintsSpec{},
{},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
constraintsSpec{
{
{},
{
ok: []string{"dns:foo.com"},
},
},
[]constraintsSpec{
constraintsSpec{},
constraintsSpec{
{
{},
{
ok: []string{"dns:foo.com"},
},
},
......@@ -572,27 +554,27 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #27: chain building doesn't get stuck when there is no valid path.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com"},
},
constraintsSpec{
{
ok: []string{"dns:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
constraintsSpec{
{
{},
{
ok: []string{"dns:foo.com"},
},
},
[]constraintsSpec{
constraintsSpec{
{
{
ok: []string{"dns:bar.com"},
},
constraintsSpec{
{
ok: []string{"dns:foo.com"},
},
},
......@@ -604,13 +586,11 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #28: unknown name types don't cause a problem without constraints.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -619,15 +599,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #29: unknown name types are allowed even in constrained chains.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com", "dns:.foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -636,15 +616,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #30: without SANs, a certificate with a CN is rejected in a constrained chain.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com", "dns:.foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -656,15 +636,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #31: IPv6 addresses work in constraints: roots can permit them as
// expected.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"ip:2000:abcd::/32"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -674,15 +654,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #32: IPv6 addresses work in constraints: root restrictions are
// effective.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"ip:2000:abcd::/32"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -692,15 +672,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #33: An IPv6 permitted subtree doesn't affect DNS names.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"ip:2000:abcd::/32"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -709,15 +689,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #34: IPv6 exclusions don't affect unrelated addresses.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"ip:2000:abcd::/32"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -726,15 +706,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #35: IPv6 exclusions are effective.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"ip:2000:abcd::/32"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -744,15 +724,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #36: IPv6 constraints do not permit IPv4 addresses.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"ip:2000:abcd::/32"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -762,15 +742,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #37: IPv4 constraints do not permit IPv6 addresses.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"ip:10.0.0.0/8"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -780,15 +760,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #38: an exclusion of an unknown type doesn't affect other names.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"unknown:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -798,15 +778,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #39: a permitted subtree of an unknown type doesn't affect other
// name types.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"unknown:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -815,15 +795,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #40: exact email constraints work
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:foo@example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -832,15 +812,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #41: exact email constraints are effective
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:foo@example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -850,15 +830,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #42: email canonicalisation works.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:foo@example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -868,15 +848,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #43: limiting email addresses to a host works.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -885,15 +865,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #44: a leading dot matches hosts one level deep
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -902,15 +882,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #45: a leading dot does not match the host itself
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -920,15 +900,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #46: a leading dot also matches two (or more) levels deep.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:.example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -937,15 +917,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #47: the local part of an email is case-sensitive
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:foo@example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -955,15 +935,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #48: the domain part of an email is not case-sensitive
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:foo@EXAMPLE.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -972,15 +952,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #49: the domain part of a DNS constraint is also not case-sensitive.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:EXAMPLE.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -989,15 +969,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #50: URI constraints only cover the host part of the URI
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1010,15 +990,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #51: URIs with IPs are rejected
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1028,15 +1008,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #52: URIs with IPs and ports are rejected
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1046,15 +1026,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #53: URIs with IPv6 addresses are also rejected
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1064,15 +1044,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #54: URIs with IPv6 addresses with ports are also rejected
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1082,15 +1062,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #55: URI constraints are effective
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1100,15 +1080,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #56: URI constraints are effective
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"uri:foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1118,15 +1098,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #57: URI constraints can allow subdomains
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:.foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1136,15 +1116,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #58: excluding an IPv4-mapped-IPv6 address doesn't affect the IPv4
// version of that address.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"ip:::ffff:1.2.3.4/128"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1153,15 +1133,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #59: a URI constraint isn't matched by a URN.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:example.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1172,16 +1152,16 @@ var nameConstraintsTests = []nameConstraintsTest{
// #60: excluding all IPv6 addresses doesn't exclude all IPv4 addresses
// too, even though IPv4 is mapped into the IPv6 range.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"ip:1.2.3.0/24"},
bad: []string{"ip:::0/0"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1191,13 +1171,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #61: omitting extended key usage in a CA certificate implies that
// any usage is ok.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1207,13 +1185,11 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #62: The “any” EKU also means that any usage is ok.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ekus: []string{"any"},
},
},
......@@ -1227,13 +1203,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #63: An intermediate with enumerated EKUs causes a failure if we
// test for an EKU not in that set. (ServerAuth is required by
// default.)
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ekus: []string{"email"},
},
},
......@@ -1247,13 +1221,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #64: an unknown EKU in the leaf doesn't break anything, even if it's not
// correctly nested.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ekus: []string{"email"},
},
},
......@@ -1268,15 +1240,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #65: trying to add extra permitted key usages in an intermediate
// (after a limitation in the root) is acceptable so long as the leaf
// certificate doesn't use them.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ekus: []string{"serverAuth"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ekus: []string{"serverAuth", "email"},
},
},
......@@ -1288,15 +1260,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #66: EKUs in roots are not ignored.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ekus: []string{"email"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ekus: []string{"serverAuth"},
},
},
......@@ -1310,13 +1282,13 @@ var nameConstraintsTests = []nameConstraintsTest{
// #67: in order to support COMODO chains, SGC key usages permit
// serverAuth and clientAuth.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{},
{},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ekus: []string{"netscapeSGC"},
},
},
......@@ -1329,13 +1301,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #68: in order to support COMODO chains, SGC key usages permit
// serverAuth and clientAuth.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ekus: []string{"msSGC"},
},
},
......@@ -1347,15 +1317,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #69: an empty DNS constraint should allow anything.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1364,15 +1334,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #70: an empty DNS constraint should also reject everything.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"dns:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1382,15 +1352,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #71: an empty email constraint should allow anything
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"email:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1399,15 +1369,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #72: an empty email constraint should also reject everything.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"email:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1417,15 +1387,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #73: an empty URI constraint should allow anything
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"uri:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1434,15 +1404,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #74: an empty URI constraint should also reject everything.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"uri:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1453,13 +1423,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #75: serverAuth in a leaf shouldn't permit clientAuth when requested in
// VerifyOptions.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1471,13 +1439,11 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #76: However, MSSGC in a leaf should match a request for serverAuth.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1493,13 +1459,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #77: an invalid DNS or mail SAN will not be detected if name constaint
// checking is not triggered.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1509,15 +1473,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #78: an invalid DNS SAN will be detected if any name constraint checking
// is triggered.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"uri:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1528,15 +1492,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #79: an invalid email SAN will be detected if any name constraint
// checking is triggered.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
bad: []string{"uri:"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1546,13 +1510,11 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #80: if several EKUs are requested, satisfying any of them is sufficient.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1564,13 +1526,11 @@ var nameConstraintsTests = []nameConstraintsTest{
// #81: EKUs that are not asserted in VerifyOpts are not required to be
// nested.
nameConstraintsTest{
roots: []constraintsSpec{
constraintsSpec{},
},
{
roots: make([]constraintsSpec, 1),
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{
{
{
ekus: []string{"serverAuth"},
},
},
......@@ -1584,15 +1544,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #82: a certificate without SANs and CN is accepted in a constrained chain.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com", "dns:.foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1602,15 +1562,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #83: a certificate without SANs and with a CN that does not parse as a
// hostname is accepted in a constrained chain.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com", "dns:.foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1620,15 +1580,15 @@ var nameConstraintsTests = []nameConstraintsTest{
},
// #84: a certificate with SANs and CN is accepted in a constrained chain.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com", "dns:.foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......@@ -1639,15 +1599,15 @@ var nameConstraintsTests = []nameConstraintsTest{
// #85: without SANs, a certificate with a valid CN is accepted in a
// constrained chain if x509ignoreCN is set.
nameConstraintsTest{
{
roots: []constraintsSpec{
constraintsSpec{
{
ok: []string{"dns:foo.com", "dns:.foo.com"},
},
},
intermediates: [][]constraintsSpec{
[]constraintsSpec{
constraintsSpec{},
{
{},
},
},
leaf: leafSpec{
......
......@@ -369,7 +369,7 @@ func domainToReverseLabels(domain string) (reverseLabels []string, ok bool) {
reverseLabels = append(reverseLabels, domain)
domain = ""
} else {
reverseLabels = append(reverseLabels, domain[i+1:len(domain)])
reverseLabels = append(reverseLabels, domain[i+1:])
domain = domain[:i]
}
}
......
......@@ -439,7 +439,7 @@ func TestDriverArgs(t *testing.T) {
0: {
args: []interface{}{Valuer_V("foo")},
want: []driver.NamedValue{
driver.NamedValue{
{
Ordinal: 1,
Value: "FOO",
},
......@@ -448,7 +448,7 @@ func TestDriverArgs(t *testing.T) {
1: {
args: []interface{}{nilValuerVPtr},
want: []driver.NamedValue{
driver.NamedValue{
{
Ordinal: 1,
Value: nil,
},
......@@ -457,7 +457,7 @@ func TestDriverArgs(t *testing.T) {
2: {
args: []interface{}{nilValuerPPtr},
want: []driver.NamedValue{
driver.NamedValue{
{
Ordinal: 1,
Value: "nil-to-str",
},
......@@ -466,7 +466,7 @@ func TestDriverArgs(t *testing.T) {
3: {
args: []interface{}{"plain-str"},
want: []driver.NamedValue{
driver.NamedValue{
{
Ordinal: 1,
Value: "plain-str",
},
......@@ -475,7 +475,7 @@ func TestDriverArgs(t *testing.T) {
4: {
args: []interface{}{nilStrPtr},
want: []driver.NamedValue{
driver.NamedValue{
{
Ordinal: 1,
Value: nil,
},
......
......@@ -154,7 +154,7 @@ var fileTests = []fileTest{
nil,
nil,
map[string][]Reloc{
"__text": []Reloc{
"__text": {
{
Addr: 0x1d,
Type: uint8(GENERIC_RELOC_VANILLA),
......@@ -189,7 +189,7 @@ var fileTests = []fileTest{
nil,
nil,
map[string][]Reloc{
"__text": []Reloc{
"__text": {
{
Addr: 0x19,
Type: uint8(X86_64_RELOC_BRANCH),
......@@ -207,7 +207,7 @@ var fileTests = []fileTest{
Value: 2,
},
},
"__compact_unwind": []Reloc{
"__compact_unwind": {
{
Addr: 0x0,
Type: uint8(X86_64_RELOC_UNSIGNED),
......
......@@ -539,52 +539,52 @@ func TestBufferedDecodingSameError(t *testing.T) {
// NBSWY3DPO5XXE3DE == helloworld
// Test with "ZZ" as extra input
{"helloworld", [][]string{
[]string{"NBSW", "Y3DP", "O5XX", "E3DE", "ZZ"},
[]string{"NBSWY3DPO5XXE3DE", "ZZ"},
[]string{"NBSWY3DPO5XXE3DEZZ"},
[]string{"NBS", "WY3", "DPO", "5XX", "E3D", "EZZ"},
[]string{"NBSWY3DPO5XXE3", "DEZZ"},
{"NBSW", "Y3DP", "O5XX", "E3DE", "ZZ"},
{"NBSWY3DPO5XXE3DE", "ZZ"},
{"NBSWY3DPO5XXE3DEZZ"},
{"NBS", "WY3", "DPO", "5XX", "E3D", "EZZ"},
{"NBSWY3DPO5XXE3", "DEZZ"},
}, io.ErrUnexpectedEOF},
// Test with "ZZY" as extra input
{"helloworld", [][]string{
[]string{"NBSW", "Y3DP", "O5XX", "E3DE", "ZZY"},
[]string{"NBSWY3DPO5XXE3DE", "ZZY"},
[]string{"NBSWY3DPO5XXE3DEZZY"},
[]string{"NBS", "WY3", "DPO", "5XX", "E3D", "EZZY"},
[]string{"NBSWY3DPO5XXE3", "DEZZY"},
{"NBSW", "Y3DP", "O5XX", "E3DE", "ZZY"},
{"NBSWY3DPO5XXE3DE", "ZZY"},
{"NBSWY3DPO5XXE3DEZZY"},
{"NBS", "WY3", "DPO", "5XX", "E3D", "EZZY"},
{"NBSWY3DPO5XXE3", "DEZZY"},
}, io.ErrUnexpectedEOF},
// Normal case, this is valid input
{"helloworld", [][]string{
[]string{"NBSW", "Y3DP", "O5XX", "E3DE"},
[]string{"NBSWY3DPO5XXE3DE"},
[]string{"NBS", "WY3", "DPO", "5XX", "E3D", "E"},
[]string{"NBSWY3DPO5XXE3", "DE"},
{"NBSW", "Y3DP", "O5XX", "E3DE"},
{"NBSWY3DPO5XXE3DE"},
{"NBS", "WY3", "DPO", "5XX", "E3D", "E"},
{"NBSWY3DPO5XXE3", "DE"},
}, nil},
// MZXW6YTB = fooba
{"fooba", [][]string{
[]string{"MZXW6YTBZZ"},
[]string{"MZXW6YTBZ", "Z"},
[]string{"MZXW6YTB", "ZZ"},
[]string{"MZXW6YT", "BZZ"},
[]string{"MZXW6Y", "TBZZ"},
[]string{"MZXW6Y", "TB", "ZZ"},
[]string{"MZXW6", "YTBZZ"},
[]string{"MZXW6", "YTB", "ZZ"},
[]string{"MZXW6", "YT", "BZZ"},
{"MZXW6YTBZZ"},
{"MZXW6YTBZ", "Z"},
{"MZXW6YTB", "ZZ"},
{"MZXW6YT", "BZZ"},
{"MZXW6Y", "TBZZ"},
{"MZXW6Y", "TB", "ZZ"},
{"MZXW6", "YTBZZ"},
{"MZXW6", "YTB", "ZZ"},
{"MZXW6", "YT", "BZZ"},
}, io.ErrUnexpectedEOF},
// Normal case, this is valid input
{"fooba", [][]string{
[]string{"MZXW6YTB"},
[]string{"MZXW6YT", "B"},
[]string{"MZXW6Y", "TB"},
[]string{"MZXW6", "YTB"},
[]string{"MZXW6", "YT", "B"},
[]string{"MZXW", "6YTB"},
[]string{"MZXW", "6Y", "TB"},
{"MZXW6YTB"},
{"MZXW6YT", "B"},
{"MZXW6Y", "TB"},
{"MZXW6", "YTB"},
{"MZXW6", "YT", "B"},
{"MZXW", "6YTB"},
{"MZXW", "6Y", "TB"},
}, nil},
}
......
......@@ -132,12 +132,12 @@ func ExamplePutVarint() {
func ExampleUvarint() {
inputs := [][]byte{
[]byte{0x01},
[]byte{0x02},
[]byte{0x7f},
[]byte{0x80, 0x01},
[]byte{0xff, 0x01},
[]byte{0x80, 0x02},
{0x01},
{0x02},
{0x7f},
{0x80, 0x01},
{0xff, 0x01},
{0x80, 0x02},
}
for _, b := range inputs {
x, n := binary.Uvarint(b)
......@@ -157,15 +157,15 @@ func ExampleUvarint() {
func ExampleVarint() {
inputs := [][]byte{
[]byte{0x81, 0x01},
[]byte{0x7f},
[]byte{0x03},
[]byte{0x01},
[]byte{0x00},
[]byte{0x02},
[]byte{0x04},
[]byte{0x7e},
[]byte{0x80, 0x01},
{0x81, 0x01},
{0x7f},
{0x03},
{0x01},
{0x00},
{0x02},
{0x04},
{0x7e},
{0x80, 0x01},
}
for _, b := range inputs {
x, n := binary.Varint(b)
......
......@@ -25,8 +25,8 @@ var archTest = []archiveTest{
{"printhello.o", 860},
},
[]FileHeader{
FileHeader{U64_TOCMAGIC},
FileHeader{U64_TOCMAGIC},
{U64_TOCMAGIC},
{U64_TOCMAGIC},
},
},
{
......
......@@ -4430,37 +4430,37 @@ func TestStructOfFieldName(t *testing.T) {
// invalid field name "1nvalid"
shouldPanic(func() {
StructOf([]StructField{
StructField{Name: "valid", Type: TypeOf("")},
StructField{Name: "1nvalid", Type: TypeOf("")},
{Name: "valid", Type: TypeOf("")},
{Name: "1nvalid", Type: TypeOf("")},
})
})
// invalid field name "+"
shouldPanic(func() {
StructOf([]StructField{
StructField{Name: "val1d", Type: TypeOf("")},
StructField{Name: "+", Type: TypeOf("")},
{Name: "val1d", Type: TypeOf("")},
{Name: "+", Type: TypeOf("")},
})
})
// no field name
shouldPanic(func() {
StructOf([]StructField{
StructField{Name: "", Type: TypeOf("")},
{Name: "", Type: TypeOf("")},
})
})
// verify creation of a struct with valid struct fields
validFields := []StructField{
StructField{
{
Name: "φ",
Type: TypeOf(""),
},
StructField{
{
Name: "ValidName",
Type: TypeOf(""),
},
StructField{
{
Name: "Val1dNam5",
Type: TypeOf(""),
},
......@@ -4477,21 +4477,21 @@ func TestStructOfFieldName(t *testing.T) {
func TestStructOf(t *testing.T) {
// check construction and use of type not in binary
fields := []StructField{
StructField{
{
Name: "S",
Tag: "s",
Type: TypeOf(""),
},
StructField{
{
Name: "X",
Tag: "x",
Type: TypeOf(byte(0)),
},
StructField{
{
Name: "Y",
Type: TypeOf(uint64(0)),
},
StructField{
{
Name: "Z",
Type: TypeOf([3]uint16{}),
},
......@@ -4573,20 +4573,20 @@ func TestStructOf(t *testing.T) {
// check duplicate names
shouldPanic(func() {
StructOf([]StructField{
StructField{Name: "string", Type: TypeOf("")},
StructField{Name: "string", Type: TypeOf("")},
{Name: "string", Type: TypeOf("")},
{Name: "string", Type: TypeOf("")},
})
})
shouldPanic(func() {
StructOf([]StructField{
StructField{Type: TypeOf("")},
StructField{Name: "string", Type: TypeOf("")},
{Type: TypeOf("")},
{Name: "string", Type: TypeOf("")},
})
})
shouldPanic(func() {
StructOf([]StructField{
StructField{Type: TypeOf("")},
StructField{Type: TypeOf("")},
{Type: TypeOf("")},
{Type: TypeOf("")},
})
})
// check that type already in binary is found
......@@ -4596,7 +4596,7 @@ func TestStructOf(t *testing.T) {
type structFieldType interface{}
checkSameType(t,
StructOf([]StructField{
StructField{
{
Name: "F",
Type: TypeOf((*structFieldType)(nil)).Elem(),
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment