compiler: update integer type sizes

* Use 64-bit integers on 64-bit platforms, just like gc and gccgo:
  https://golang.org/doc/go1.1#int
* Do not use a separate length type. Instead, use uintptr everywhere a
  length is expected.
This commit is contained in:
Ayke van Laethem
2018-11-14 14:01:04 +01:00
parent 101d41dc58
commit ee7c276493
10 changed files with 68 additions and 80 deletions
+4 -4
View File
@@ -28,7 +28,7 @@ func _recover() interface{} {
}
// Check for bounds in *ssa.Index, *ssa.IndexAddr and *ssa.Lookup.
func lookupBoundsCheck(length lenType, index int) {
func lookupBoundsCheck(length uintptr, index int) {
if index < 0 || index >= int(length) {
runtimePanic("index out of range")
}
@@ -36,21 +36,21 @@ func lookupBoundsCheck(length lenType, index int) {
// Check for bounds in *ssa.Index, *ssa.IndexAddr and *ssa.Lookup.
// Supports 64-bit indexes.
func lookupBoundsCheckLong(length lenType, index int64) {
func lookupBoundsCheckLong(length uintptr, index int64) {
if index < 0 || index >= int64(length) {
runtimePanic("index out of range")
}
}
// Check for bounds in *ssa.Slice.
func sliceBoundsCheck(capacity lenType, low, high uint) {
func sliceBoundsCheck(capacity uintptr, low, high uint) {
if !(0 <= low && low <= high && high <= uint(capacity)) {
runtimePanic("slice out of range")
}
}
// Check for bounds in *ssa.Slice. Supports 64-bit indexes.
func sliceBoundsCheckLong(capacity lenType, low, high uint64) {
func sliceBoundsCheckLong(capacity uintptr, low, high uint64) {
if !(0 <= low && low <= high && high <= uint64(capacity)) {
runtimePanic("slice out of range")
}