diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-02-05 14:33:27 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-02-15 09:14:10 -0800 |
commit | 0b3c2eed35d608d6541ecf004a9576b4eae0b4ef (patch) | |
tree | c92c05d53eb054d8085d069800f4e9b586fef5a3 /libgo/go/runtime/checkptr.go | |
parent | 17edb3310d8ce9d5f6c9e53f6c1f7d611c2a5a41 (diff) | |
download | gcc-0b3c2eed35d608d6541ecf004a9576b4eae0b4ef.zip gcc-0b3c2eed35d608d6541ecf004a9576b4eae0b4ef.tar.gz gcc-0b3c2eed35d608d6541ecf004a9576b4eae0b4ef.tar.bz2 |
libgo: update to Go1.14rc1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/218017
Diffstat (limited to 'libgo/go/runtime/checkptr.go')
-rw-r--r-- | libgo/go/runtime/checkptr.go | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/libgo/go/runtime/checkptr.go b/libgo/go/runtime/checkptr.go index f478ddd..974f0a0 100644 --- a/libgo/go/runtime/checkptr.go +++ b/libgo/go/runtime/checkptr.go @@ -8,45 +8,22 @@ package runtime import "unsafe" -type ptrAlignError struct { - ptr unsafe.Pointer - elem *_type - n uintptr -} - -func (e ptrAlignError) RuntimeError() {} - -func (e ptrAlignError) Error() string { - return "runtime error: unsafe pointer conversion" -} - func checkptrAlignment(p unsafe.Pointer, elem *_type, n uintptr) { // Check that (*[n]elem)(p) is appropriately aligned. // TODO(mdempsky): What about fieldAlign? if uintptr(p)&(uintptr(elem.align)-1) != 0 { - panic(ptrAlignError{p, elem, n}) + throw("checkptr: unsafe pointer conversion") } // Check that (*[n]elem)(p) doesn't straddle multiple heap objects. if size := n * elem.size; size > 1 && checkptrBase(p) != checkptrBase(add(p, size-1)) { - panic(ptrAlignError{p, elem, n}) + throw("checkptr: unsafe pointer conversion") } } -type ptrArithError struct { - ptr unsafe.Pointer - originals []unsafe.Pointer -} - -func (e ptrArithError) RuntimeError() {} - -func (e ptrArithError) Error() string { - return "runtime error: unsafe pointer arithmetic" -} - func checkptrArithmetic(p unsafe.Pointer, originals []unsafe.Pointer) { if 0 < uintptr(p) && uintptr(p) < minLegalPointer { - panic(ptrArithError{p, originals}) + throw("checkptr: unsafe pointer arithmetic") } // Check that if the computed pointer p points into a heap @@ -63,7 +40,7 @@ func checkptrArithmetic(p unsafe.Pointer, originals []unsafe.Pointer) { } } - panic(ptrArithError{p, originals}) + throw("checkptr: unsafe pointer arithmetic") } // checkptrBase returns the base address for the allocation containing |