aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/ssagen/ssa.go56
1 files changed, 11 insertions, 45 deletions
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go
index c794d6ffd9..df933ec1cf 100644
--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -7095,48 +7095,14 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
return t.IsStruct() || t.IsArray() || t.IsComplex() || t.IsInterface() || t.IsString() || t.IsSlice()
}
- // Populate the data.
- // The data is a stream of bytes, which contains the offsets and sizes of the
- // non-aggregate arguments or non-aggregate fields/elements of aggregate-typed
- // arguments, along with special "operators". Specifically,
- // - for each non-aggrgate arg/field/element, its offset from FP (1 byte) and
- // size (1 byte)
- // - special operators:
- // - 0xff - end of sequence
- // - 0xfe - print { (at the start of an aggregate-typed argument)
- // - 0xfd - print } (at the end of an aggregate-typed argument)
- // - 0xfc - print ... (more args/fields/elements)
- // - 0xfb - print _ (offset too large)
- // These constants need to be in sync with runtime.traceback.go:printArgs.
- const (
- _endSeq = 0xff
- _startAgg = 0xfe
- _endAgg = 0xfd
- _dotdotdot = 0xfc
- _offsetTooLarge = 0xfb
- _special = 0xf0 // above this are operators, below this are ordinary offsets
- )
-
- const (
- limit = 10 // print no more than 10 args/components
- maxDepth = 5 // no more than 5 layers of nesting
-
- // maxLen is a (conservative) upper bound of the byte stream length. For
- // each arg/component, it has no more than 2 bytes of data (size, offset),
- // and no more than one {, }, ... at each level (it cannot have both the
- // data and ... unless it is the last one, just be conservative). Plus 1
- // for _endSeq.
- maxLen = (maxDepth*3+2)*limit + 1
- )
-
wOff := 0
n := 0
writebyte := func(o uint8) { wOff = objw.Uint8(x, wOff, o) }
// Write one non-aggregate arg/field/element.
write1 := func(sz, offset int64) {
- if offset >= _special {
- writebyte(_offsetTooLarge)
+ if offset >= rtabi.TraceArgsSpecial {
+ writebyte(rtabi.TraceArgsOffsetTooLarge)
} else {
writebyte(uint8(offset))
writebyte(uint8(sz))
@@ -7148,19 +7114,19 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
// Returns whether to continue visiting.
var visitType func(baseOffset int64, t *types.Type, depth int) bool
visitType = func(baseOffset int64, t *types.Type, depth int) bool {
- if n >= limit {
- writebyte(_dotdotdot)
+ if n >= rtabi.TraceArgsLimit {
+ writebyte(rtabi.TraceArgsDotdotdot)
return false
}
if !isAggregate(t) {
write1(t.Size(), baseOffset)
return true
}
- writebyte(_startAgg)
+ writebyte(rtabi.TraceArgsStartAgg)
depth++
- if depth >= maxDepth {
- writebyte(_dotdotdot)
- writebyte(_endAgg)
+ if depth >= rtabi.TraceArgsMaxDepth {
+ writebyte(rtabi.TraceArgsDotdotdot)
+ writebyte(rtabi.TraceArgsEndAgg)
n++
return true
}
@@ -7197,7 +7163,7 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
}
}
}
- writebyte(_endAgg)
+ writebyte(rtabi.TraceArgsEndAgg)
return true
}
@@ -7212,8 +7178,8 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
break
}
}
- writebyte(_endSeq)
- if wOff > maxLen {
+ writebyte(rtabi.TraceArgsEndSeq)
+ if wOff > rtabi.TraceArgsMaxLen {
base.Fatalf("ArgInfo too large")
}