mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] all: merge master (4711bf3) into dev.typeparams
Conflicts: - src/cmd/compile/internal/walk/builtin.go On dev.typeparams, CL 330194 changed OCHECKNIL to not require manual SetTypecheck(1) anymore; while on master, CL 331070 got rid of the OCHECKNIL altogether by moving the check into the runtime support functions. - src/internal/buildcfg/exp.go On master, CL 331109 refactored the logic for parsing the GOEXPERIMENT string, so that it could be more easily reused by cmd/go; while on dev.typeparams, several CLs tweaked the regabi experiment defaults. Merge List: + 2021-06-304711bf30e5doc/go1.17: linkify "language changes" in the runtime section + 2021-06-30ed56ea73e8path/filepath: deflake TestEvalSymlinksAboveRoot on darwin + 2021-06-30c080d0323bcmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto + 2021-06-307d0e9e6e74image/gif: fix typo in the comment (io.ReadByte -> io.ByteReader) + 2021-06-300fa3265fe1os: change example to avoid deprecated function + 2021-06-30d19a53338fimage: add Uniform.RGBA64At and Rectangle.RGBA64At + 2021-06-30c45e800e0ccrypto/x509: don't fail on optional auth key id fields + 2021-06-29f9d50953b9net: fix failure of TestCVE202133195 + 2021-06-29e294b8a49edoc/go1.17: fix typo "MacOS" -> "macOS" + 2021-06-293463852b76math/big: fix typo of comment (`BytesScanner` to `ByteScanner`) + 2021-06-29fd4b587da3cmd/compile: suppress details error for invalid variadic argument type + 2021-06-29e2e05af6e1cmd/internal/obj/arm64: fix an encoding error of CMPW instruction + 2021-06-284bb0847b08cmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil) + 2021-06-281519271a93spec: change unsafe.Slice((*T)(nil), 0) to return []T(nil) + 2021-06-285385e2386bruntime/internal/atomic: drop Cas64 pointer indirection in comments + 2021-06-28956c81bfe6cmd/go: add GOEXPERIMENT to `go env` output + 2021-06-28a1d27269d6cmd/go: prep for 'go env' refactoring + 2021-06-28901510ed4ecmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0 + 2021-06-28361159c055cmd/cgo: fix 'see gmp.go' to 'see doc.go' + 2021-06-27c95464f0eainternal/buildcfg: refactor GOEXPERIMENT parsing code somewhat + 2021-06-25ed01ceaf48runtime/race: use race build tag on syso_test.go + 2021-06-25d1916e5e84go/types: in TestCheck/issues.src, import regexp/syntax instead of cmd/compile/internal/syntax + 2021-06-255160896c69go/types: in TestStdlib, import from source instead of export data + 2021-06-25d01bc571f7runtime: make ncgocall a global counter Change-Id: I1ce4a3b3ff7c824c67ad66dd27d9d5f1d25c0023
This commit is contained in:
commit
ad7e5b219e
50 changed files with 508 additions and 228 deletions
|
|
@ -114,19 +114,37 @@ func makeslice64(et *_type, len64, cap64 int64) unsafe.Pointer {
|
|||
return makeslice(et, len, cap)
|
||||
}
|
||||
|
||||
func unsafeslice(et *_type, len int) {
|
||||
func unsafeslice(et *_type, ptr unsafe.Pointer, len int) {
|
||||
if len == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if ptr == nil {
|
||||
panic(errorString("unsafe.Slice: ptr is nil and len is not zero"))
|
||||
}
|
||||
|
||||
mem, overflow := math.MulUintptr(et.size, uintptr(len))
|
||||
if overflow || mem > maxAlloc || len < 0 {
|
||||
panicunsafeslicelen()
|
||||
}
|
||||
}
|
||||
|
||||
func unsafeslice64(et *_type, len64 int64) {
|
||||
func unsafeslice64(et *_type, ptr unsafe.Pointer, len64 int64) {
|
||||
len := int(len64)
|
||||
if int64(len) != len64 {
|
||||
panicunsafeslicelen()
|
||||
}
|
||||
unsafeslice(et, len)
|
||||
unsafeslice(et, ptr, len)
|
||||
}
|
||||
|
||||
func unsafeslicecheckptr(et *_type, ptr unsafe.Pointer, len64 int64) {
|
||||
unsafeslice64(et, ptr, len64)
|
||||
|
||||
// Check that underlying array doesn't straddle multiple heap objects.
|
||||
// unsafeslice64 has already checked for overflow.
|
||||
if checkptrStraddles(ptr, uintptr(len64)*et.size) {
|
||||
throw("checkptr: unsafe.Slice result straddles multiple allocations")
|
||||
}
|
||||
}
|
||||
|
||||
func panicunsafeslicelen() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue