]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: rename fastrand1 to fastrand
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 28 Jun 2016 16:22:46 +0000 (09:22 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 30 Aug 2016 23:59:21 +0000 (23:59 +0000)
Change-Id: I37706ff0a3486827c5b072c95ad890ea87ede847
Reviewed-on: https://go-review.googlesource.com/28210
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
27 files changed:
src/runtime/alg.go
src/runtime/asm_386.s
src/runtime/asm_amd64.s
src/runtime/asm_amd64p32.s
src/runtime/asm_arm.s
src/runtime/asm_arm64.s
src/runtime/asm_mips64x.s
src/runtime/asm_ppc64x.s
src/runtime/asm_s390x.s
src/runtime/hashmap.go
src/runtime/malloc.go
src/runtime/mgc.go
src/runtime/mprof.go
src/runtime/os_darwin_arm.go
src/runtime/os_darwin_arm64.go
src/runtime/os_freebsd_arm.go
src/runtime/os_linux_arm.go
src/runtime/os_linux_arm64.go
src/runtime/os_linux_mips64x.go
src/runtime/os_nacl_arm.go
src/runtime/os_netbsd_arm.go
src/runtime/os_openbsd_arm.go
src/runtime/os_plan9_arm.go
src/runtime/proc.go
src/runtime/select.go
src/runtime/stubs.go
src/runtime/symtab.go

index 147332e1fd93bbbdada9f7ef7277dbf905eba759..80f205c4949ae20152c9dc17d58c1119e2dd17ae 100644 (file)
@@ -109,7 +109,7 @@ func f32hash(p unsafe.Pointer, h uintptr) uintptr {
        case f == 0:
                return c1 * (c0 ^ h) // +0, -0
        case f != f:
-               return c1 * (c0 ^ h ^ uintptr(fastrand1())) // any kind of NaN
+               return c1 * (c0 ^ h ^ uintptr(fastrand())) // any kind of NaN
        default:
                return memhash(p, h, 4)
        }
@@ -121,7 +121,7 @@ func f64hash(p unsafe.Pointer, h uintptr) uintptr {
        case f == 0:
                return c1 * (c0 ^ h) // +0, -0
        case f != f:
-               return c1 * (c0 ^ h ^ uintptr(fastrand1())) // any kind of NaN
+               return c1 * (c0 ^ h ^ uintptr(fastrand())) // any kind of NaN
        default:
                return memhash(p, h, 8)
        }
index f039fbf42ead9698a6266c5a4f1379d7f4f4a086..12038220ac494c2f3cddda366985a2c62cee503a 100644 (file)
@@ -1573,7 +1573,7 @@ allsame:
        MOVL    BX, (AX)
        RET
 
-TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
+TEXT runtime·fastrand(SB), NOSPLIT, $0-4
        get_tls(CX)
        MOVL    g(CX), AX
        MOVL    g_m(AX), AX
index 3383bbe446c48551522bd136a07d1b9406370537..f44fc1166a42ba89353e4d2e07f31bea202870ff 100644 (file)
@@ -2052,7 +2052,7 @@ eqret:
        MOVB    $0, ret+48(FP)
        RET
 
-TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
+TEXT runtime·fastrand(SB), NOSPLIT, $0-4
        get_tls(CX)
        MOVQ    g(CX), AX
        MOVQ    g_m(AX), AX
index dec77e9542e93babf5087a5ec30ead04d1d76675..6aa230841e03361b21b6835ebe5fea7456b19ea9 100644 (file)
@@ -973,7 +973,7 @@ eqret:
        MOVB    AX, ret+24(FP)
        RET
 
-TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
+TEXT runtime·fastrand(SB), NOSPLIT, $0-4
        get_tls(CX)
        MOVL    g(CX), AX
        MOVL    g_m(AX), AX
index 59a0e75734ddc88986c0c033f7d5ea7c4e586792..29f39cf15d050f3fa309c914efb4aec95487f214 100644 (file)
@@ -952,7 +952,7 @@ _sib_notfound:
        MOVW    R0, ret+12(FP)
        RET
 
-TEXT runtime·fastrand1(SB),NOSPLIT,$-4-4
+TEXT runtime·fastrand(SB),NOSPLIT,$-4-4
        MOVW    g_m(g), R1
        MOVW    m_fastrand(R1), R0
        ADD.S   R0, R0
index 2fb4eeaadcf1b75487631b57717b298ec4885a03..066b534900bcd082aede7241e0ebf99efe2c54b9 100644 (file)
@@ -949,7 +949,7 @@ equal:
        MOVB    R0, ret+48(FP)
        RET
 
-TEXT runtime·fastrand1(SB),NOSPLIT,$-8-4
+TEXT runtime·fastrand(SB),NOSPLIT,$-8-4
        MOVD    g_m(g), R1
        MOVWU   m_fastrand(R1), R0
        ADD     R0, R0
index 098de410536ad5ae851193c3ad15845d54342329..15105b90c3810aad887bdca45c3aefcfea8540d2 100644 (file)
@@ -822,7 +822,7 @@ notfound:
        MOVV    R1, ret+24(FP)
        RET
 
-TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
+TEXT runtime·fastrand(SB), NOSPLIT, $0-4
        MOVV    g_m(g), R2
        MOVWU   m_fastrand(R2), R1
        ADDU    R1, R1
index 3bff8863758d46fa573271dd0ad8f26cf4871f1c..67b3d5069197dcfb0c6171dd3d59707e92179681 100644 (file)
@@ -1042,7 +1042,7 @@ samebytes:
        MOVD    R8, (R7)
        RET
 
-TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
+TEXT runtime·fastrand(SB), NOSPLIT, $0-4
        MOVD    g_m(g), R4
        MOVWZ   m_fastrand(R4), R3
        ADD     R3, R3
index 896ccde8015881a5316187adf44eef054a48d9ce..cf0ed1a917abb4bc01ffef2872ad460cf03dd9f1 100644 (file)
@@ -874,7 +874,7 @@ TEXT runtime·memeqbodyclc(SB),NOSPLIT|NOFRAME,$0-0
        CLC     $1, 0(R3), 0(R5)
        RET
 
-TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
+TEXT runtime·fastrand(SB), NOSPLIT, $0-4
        MOVD    g_m(g), R4
        MOVWZ   m_fastrand(R4), R3
        ADD     R3, R3
index f756e7b6035392430d162f1b14b0f20c0232ad54..9d8c2f8a6087bfca9f54dfd3079396d7cba3e7b1 100644 (file)
@@ -256,7 +256,7 @@ func makemap(t *maptype, hint int64, h *hmap, bucket unsafe.Pointer) *hmap {
        h.count = 0
        h.B = B
        h.flags = 0
-       h.hash0 = fastrand1()
+       h.hash0 = fastrand()
        h.buckets = buckets
        h.oldbuckets = nil
        h.nevacuate = 0
@@ -655,9 +655,9 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
        }
 
        // decide where to start
-       r := uintptr(fastrand1())
+       r := uintptr(fastrand())
        if h.B > 31-bucketCntBits {
-               r += uintptr(fastrand1()) << 31
+               r += uintptr(fastrand()) << 31
        }
        it.startBucket = r & (uintptr(1)<<h.B - 1)
        it.offset = uint8(r >> h.B & (bucketCnt - 1))
index 7d7f9e11d380a19cf4c64762ad65e97fdec25a08..4f0a2cee22374dda0d434c57390049c12ebd0580 100644 (file)
@@ -843,7 +843,7 @@ func nextSample() int32 {
        // x = -log_e(q) * period
        // x = log_2(q) * (-log_e(2)) * period    ; Using log_2 for efficiency
        const randomBitCount = 26
-       q := fastrand1()%(1<<randomBitCount) + 1
+       q := fastrand()%(1<<randomBitCount) + 1
        qlog := fastlog2(float64(q)) - randomBitCount
        if qlog > 0 {
                qlog = 0
@@ -861,7 +861,7 @@ func nextSampleNoFP() int32 {
                rate = 0x3fffffff
        }
        if rate != 0 {
-               return int32(int(fastrand1()) % (2 * rate))
+               return int32(int(fastrand()) % (2 * rate))
        }
        return 0
 }
index cd5ddadd49734707da1ded7d8a3505d1bfefbf08..f184d81b235dc47c59175dc2e5c3679c9ee8babc 100644 (file)
@@ -616,7 +616,7 @@ func (c *gcControllerState) enlistWorker() {
        }
        myID := gp.m.p.ptr().id
        for tries := 0; tries < 5; tries++ {
-               id := int32(fastrand1() % uint32(gomaxprocs-1))
+               id := int32(fastrand() % uint32(gomaxprocs-1))
                if id >= myID {
                        id++
                }
index c3e4e2cb87d976b41a98f6ac36be60e228cf2079..37b5e1be4ab25a8a0577fbd7e3634026aadad8db 100644 (file)
@@ -289,7 +289,7 @@ func blockevent(cycles int64, skip int) {
                cycles = 1
        }
        rate := int64(atomic.Load64(&blockprofilerate))
-       if rate <= 0 || (rate > cycles && int64(fastrand1())%rate > cycles) {
+       if rate <= 0 || (rate > cycles && int64(fastrand())%rate > cycles) {
                return
        }
        gp := getg()
index 1ccc9592da8647c0856aba3f622a893138ee8be6..ee1bd174f1be6d9c1518e910870b5e16b5775cbd 100644 (file)
@@ -17,8 +17,8 @@ func checkgoarm() {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // TODO: need more entropy to better seed fastrand1.
+       // TODO: need more entropy to better seed fastrand.
        return nanotime()
 }
index 4d35af9c6ad796503131c33d12f6340124135093..8de132d8e2fab9419705cc1faefd250acb69d21f 100644 (file)
@@ -6,8 +6,8 @@ package runtime
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // TODO: need more entropy to better seed fastrand1.
+       // TODO: need more entropy to better seed fastrand.
        return nanotime()
 }
index 1f2add279f214b00fed221fe66aefdcff99a62a1..0399499a4ef01df8db1af192e7911925e90cffc6 100644 (file)
@@ -17,8 +17,8 @@ func checkgoarm() {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // TODO: need more entropy to better seed fastrand1.
+       // TODO: need more entropy to better seed fastrand.
        return nanotime()
 }
index 8e2765a4133ec7c189bea28fb17ac734f7089ced..d7d734bc7ff4241e626098583cce67a10f718d5e 100644 (file)
@@ -53,8 +53,8 @@ func archauxv(tag, val uintptr) {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed fastrand().
        // nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // randomNumber provides better seeding of fastrand1.
+       // randomNumber provides better seeding of fastrand.
        return nanotime() + int64(randomNumber)
 }
index 43262aea1435132d064120fcb72698b21660d961..bdc341d962b383f38273806a8b8d81dec12dfbb9 100644 (file)
@@ -19,8 +19,8 @@ func archauxv(tag, val uintptr) {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed fastrand().
        // nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // randomNumber provides better seeding of fastrand1.
+       // randomNumber provides better seeding of fastrand.
        return nanotime() + int64(randomNumber)
 }
index 8039b2fac9b7a34de683d8dd41e9b20df7e8b51f..dcc9763678d0bb798a0b59bb10e0486f7f82c66c 100644 (file)
@@ -22,9 +22,9 @@ func archauxv(tag, val uintptr) {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed fastrand().
        // nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // randomNumber provides better seeding of fastrand1.
+       // randomNumber provides better seeding of fastrand.
        return nanotime() + int64(randomNumber)
 }
 
index f94c183e87684c59b9f5ba65ec340c668f6918af..8669ee75b46c9bff76a5b8b9f85596b4b9aee86e 100644 (file)
@@ -16,8 +16,8 @@ func checkgoarm() {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // TODO: need more entropy to better seed fastrand1.
+       // TODO: need more entropy to better seed fastrand.
        return nanotime()
 }
index 03032e8bea53bf492b221a63c4ed4fd9349b7f3b..95603da64394b02bc3d48c9ce4a88f74f56e50f3 100644 (file)
@@ -28,8 +28,8 @@ func checkgoarm() {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // TODO: need more entropy to better seed fastrand1.
+       // TODO: need more entropy to better seed fastrand.
        return nanotime()
 }
index b46fef0090d23d39325326e052b04c9ea066723a..be2e1e9959da60f2074ed78b12c24944f81c9a6b 100644 (file)
@@ -17,8 +17,8 @@ func checkgoarm() {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // TODO: need more entropy to better seed fastrand1.
+       // TODO: need more entropy to better seed fastrand.
        return nanotime()
 }
index 30cde8f74b047da5164a2fbf62d87c9a3f2628d8..fdce1e7a352d6122044e3dd0d06ca7c11a44f7e2 100644 (file)
@@ -10,8 +10,8 @@ func checkgoarm() {
 
 //go:nosplit
 func cputicks() int64 {
-       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().
+       // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
-       // TODO: need more entropy to better seed fastrand1.
+       // TODO: need more entropy to better seed fastrand.
        return nanotime()
 }
index 75e09b3ab7c10ff7d416d1453489c63df16354c6..67e8447d46adf5555512744800eb7af51a7f4a91 100644 (file)
@@ -1909,7 +1909,7 @@ top:
                atomic.Xadd(&sched.nmspinning, 1)
        }
        for i := 0; i < 4; i++ {
-               for enum := stealOrder.start(fastrand1()); !enum.done(); enum.next() {
+               for enum := stealOrder.start(fastrand()); !enum.done(); enum.next() {
                        if sched.gcwaiting != 0 {
                                goto top
                        }
@@ -4034,7 +4034,7 @@ const randomizeScheduler = raceenabled
 // If the run queue is full, runnext puts g on the global queue.
 // Executed only by the owner P.
 func runqput(_p_ *p, gp *g, next bool) {
-       if randomizeScheduler && next && fastrand1()%2 == 0 {
+       if randomizeScheduler && next && fastrand()%2 == 0 {
                next = false
        }
 
@@ -4087,7 +4087,7 @@ func runqputslow(_p_ *p, gp *g, h, t uint32) bool {
 
        if randomizeScheduler {
                for i := uint32(1); i <= n; i++ {
-                       j := fastrand1() % (i + 1)
+                       j := fastrand() % (i + 1)
                        batch[i], batch[j] = batch[j], batch[i]
                }
        }
index 433048fb794826b195d9654faa30354716dfcd08..1aaafff19866c9542b10d1c1a37f76e4cde4e89d 100644 (file)
@@ -270,7 +270,7 @@ func selectgoImpl(sel *hselect) (uintptr, uint16) {
        pollslice := slice{unsafe.Pointer(sel.pollorder), int(sel.ncase), int(sel.ncase)}
        pollorder := *(*[]uint16)(unsafe.Pointer(&pollslice))
        for i := 1; i < int(sel.ncase); i++ {
-               j := int(fastrand1()) % (i + 1)
+               j := int(fastrand()) % (i + 1)
                pollorder[i] = pollorder[j]
                pollorder[j] = uint16(i)
        }
index 0f75663b9a7e3ca0e903793a30919756a770a08b..f6bb2fba16daa17a254368a55adb2491257df3b9 100644 (file)
@@ -81,7 +81,7 @@ func reflect_memmove(to, from unsafe.Pointer, n uintptr) {
 var hashLoad = loadFactor
 
 // in asm_*.s
-func fastrand1() uint32
+func fastrand() uint32
 
 // in asm_*.s
 //go:noescape
index 4f6fae2f49803743aaace678762efee09cdd369d..7a37085fab8b9063393c8d78c05d6ac0777f884a 100644 (file)
@@ -437,7 +437,7 @@ func pcvalue(f *_func, off int32, targetpc uintptr, cache *pcvalueCache, strict
                        // a recursive stack's cycle is slightly
                        // larger than the cache.
                        if cache != nil {
-                               ci := fastrand1() % uint32(len(cache.entries))
+                               ci := fastrand() % uint32(len(cache.entries))
                                cache.entries[ci] = pcvalueCacheEnt{
                                        targetpc: targetpc,
                                        off:      off,