Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Side by Side Diff: src/pkg/runtime/stubs.go

Issue 119360043: code review 119360043: runtime: convert hash functions to Go calling convention. (Closed)
Patch Set: diff -r c6b7f7454ffc https://khr%40golang.org@code.google.com/p/go/ Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/runtime/runtime.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Go Authors. All rights reserved. 1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package runtime 5 package runtime
6 6
7 import "unsafe" 7 import "unsafe"
8 8
9 // Declarations for runtime services implemented in C or assembly. 9 // Declarations for runtime services implemented in C or assembly.
10 // C implementations of these functions are in stubs.goc. 10 // C implementations of these functions are in stubs.goc.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 var nohashcode uintptr 113 var nohashcode uintptr
114 114
115 // Go version of runtime.throw. 115 // Go version of runtime.throw.
116 // in panic.c 116 // in panic.c
117 func gothrow(s string) 117 func gothrow(s string)
118 118
119 func golock(x *lock) 119 func golock(x *lock)
120 func gounlock(x *lock) 120 func gounlock(x *lock)
121 func semacquire(*uint32, bool) 121 func semacquire(*uint32, bool)
122 func semrelease(*uint32) 122 func semrelease(*uint32)
123
124 // Return the Go equivalent of the C Alg structure.
125 // TODO: at some point Go will hold the truth for the layout
126 // of runtime structures and C will be derived from it (if
127 // needed at all). At that point this function can go away.
128 type goalgtype struct {
129 // function for hashing objects of this type
130 // (ptr to object, size, seed) -> hash
131 hash func(unsafe.Pointer, uintptr, uintptr) uintptr
132 }
133
134 func goalg(a *alg) *goalgtype {
135 return (*goalgtype)(unsafe.Pointer(a))
136 }
137
138 // noescape hides a pointer from escape analysis. noescape is
139 // the identity function but escape analysis doesn't think the
140 // output depends on the input. noescape is inlined and currently
141 // compiles down to a single xor instruction.
142 // USE CAREFULLY!
143 func noescape(p unsafe.Pointer) unsafe.Pointer {
144 x := uintptr(p)
145 return unsafe.Pointer(x ^ 0)
146 }
OLDNEW
« no previous file with comments | « src/pkg/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b