github.com/tcnksm/go@v0.0.0-20141208075154-439b32936367/src/runtime/export_test.go (about) 1 // Copyright 2010 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Export guts for testing. 6 7 package runtime 8 9 import "unsafe" 10 11 var Fadd64 = fadd64 12 var Fsub64 = fsub64 13 var Fmul64 = fmul64 14 var Fdiv64 = fdiv64 15 var F64to32 = f64to32 16 var F32to64 = f32to64 17 var Fcmp64 = fcmp64 18 var Fintto64 = fintto64 19 var F64toint = f64toint 20 21 // in asm_*.s 22 func stackguard() (sp, limit uintptr) 23 24 var Entersyscall = entersyscall 25 var Exitsyscall = exitsyscall 26 var LockedOSThread = lockedOSThread 27 28 type LFNode struct { 29 Next uint64 30 Pushcnt uintptr 31 } 32 33 func lfstackpush_m() 34 func lfstackpop_m() 35 36 func LFStackPush(head *uint64, node *LFNode) { 37 lfstackpush(head, (*lfnode)(unsafe.Pointer(node))) 38 } 39 40 func LFStackPop(head *uint64) *LFNode { 41 return (*LFNode)(unsafe.Pointer(lfstackpop(head))) 42 } 43 44 type ParFor struct { 45 body *byte 46 done uint32 47 Nthr uint32 48 nthrmax uint32 49 thrseq uint32 50 Cnt uint32 51 Ctx *byte 52 wait bool 53 } 54 55 func newparfor_m() 56 func parforsetup_m() 57 func parfordo_m() 58 func parforiters_m() 59 60 func NewParFor(nthrmax uint32) *ParFor { 61 var desc *ParFor 62 systemstack(func() { 63 desc = (*ParFor)(unsafe.Pointer(parforalloc(nthrmax))) 64 }) 65 return desc 66 } 67 68 func ParForSetup(desc *ParFor, nthr, n uint32, ctx *byte, wait bool, body func(*ParFor, uint32)) { 69 systemstack(func() { 70 parforsetup((*parfor)(unsafe.Pointer(desc)), nthr, n, unsafe.Pointer(ctx), wait, 71 *(*func(*parfor, uint32))(unsafe.Pointer(&body))) 72 }) 73 } 74 75 func ParForDo(desc *ParFor) { 76 systemstack(func() { 77 parfordo((*parfor)(unsafe.Pointer(desc))) 78 }) 79 } 80 81 func ParForIters(desc *ParFor, tid uint32) (uint32, uint32) { 82 desc1 := (*parfor)(unsafe.Pointer(desc)) 83 pos := desc_thr_index(desc1, tid).pos 84 return uint32(pos), uint32(pos >> 32) 85 } 86 87 func GCMask(x interface{}) (ret []byte) { 88 e := (*eface)(unsafe.Pointer(&x)) 89 s := (*slice)(unsafe.Pointer(&ret)) 90 systemstack(func() { 91 var len uintptr 92 getgcmask(e.data, e._type, &s.array, &len) 93 s.len = uint(len) 94 s.cap = s.len 95 }) 96 return 97 } 98 99 func RunSchedLocalQueueTest() { 100 systemstack(testSchedLocalQueue) 101 } 102 func RunSchedLocalQueueStealTest() { 103 systemstack(testSchedLocalQueueSteal) 104 } 105 106 var HaveGoodHash = haveGoodHash 107 var StringHash = stringHash 108 var BytesHash = bytesHash 109 var Int32Hash = int32Hash 110 var Int64Hash = int64Hash 111 var EfaceHash = efaceHash 112 var IfaceHash = ifaceHash 113 var MemclrBytes = memclrBytes 114 115 var HashLoad = &hashLoad 116 117 // For testing. 118 func GogoBytes() int32 { 119 return _RuntimeGogoBytes 120 } 121 122 // entry point for testing 123 func GostringW(w []uint16) (s string) { 124 systemstack(func() { 125 s = gostringw(&w[0]) 126 }) 127 return 128 } 129 130 var Gostringnocopy = gostringnocopy 131 var Maxstring = &maxstring