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

Delta Between Two Patch Sets: src/pkg/runtime/race/race.go

Issue 55100044: code review 55100044: runtime: use custom thunks for race calls instead of cgo (Closed)
Left Patch Set: diff -r d2e78612ed03 https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years, 1 month ago
Right Patch Set: diff -r 340da08f5f54 https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/race/README ('k') | src/pkg/runtime/race/race_darwin_amd64.syso » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 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 // +build race,linux,amd64 race,darwin,amd64 race,windows,amd64 5 // +build race,linux,amd64 race,darwin,amd64 race,windows,amd64
6 6
7 package race 7 package race
8 8
9 //import "C" 9 // This file merely ensures that we link in runtime/cgo in race build,
10 // this is turn ensures that runtime uses pthread_create to create threads.
11 // The prebuilt race runtime lives in race_GOOS_GOARCH.syso.
12 // Calls to the runtime are done directly from src/pkg/runtime/race.c.
10 13
11 import ( 14 // void __race_unused_func(void);
12 » _ "runtime/cgo"
13 )
14
15 /*
16 //export __tsan_symbolize
17 func __tsan_symbolize(ctx *C.int)
18
19 void __tsan_init(void **racectx);
20 import "C" 15 import "C"
21
22 import (
23 "runtime"
24 )
25
26 //export __tsan_symbolize
27 func __tsan_symbolize(pc uintptr, fun, file **C.char, line, off *C.int) C.int {
28 f := runtime.FuncForPC(pc)
29 if f == nil {
30 *fun = C.CString("??")
31 *file = C.CString("-")
32 *line = 0
33 *off = C.int(pc)
34 return 1
35 }
36 fi, l := f.FileLine(pc)
37 *fun = C.CString(f.Name())
38 *file = C.CString(fi)
39 *line = C.int(l)
40 *off = C.int(pc - f.Entry())
41 return 1
42 }
43 */
LEFTRIGHT

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