detached a7c4d8f

internal/fakecgo: correct the explanation of using closure calls (#85)

PR #73 circumvent go 1.20 race mode on darwin. However, the explanation
for using the closure calls are partly wrong, and also not so much clear
about how the trick works.

This commit reworks the comments, and adding a more detail explanation.

Updates #71
commit
a7c4d8fb43b1fe6b3cbde6e9495935f06f538af2
author
Cuong Manh Le · · 2023-01-07 01:10 UTC
committer
GitHub · · 2023-01-07 01:10 UTC
parent
9e27b96
signature
GPG Unverified4AEE18F83AFDEB23 The key is unknown
1 file · +10 -4
M internal/fakecgo/callbacks.go +10 -4
@@ -46,10 +46,16 @@ var (
4646 // In Go 1.20 the race detector was rewritten to pure Go
4747 // on darwin. This means that when CGO_ENABLED=0 is set
4848 // fakecgo is built with race detector code. This is not
49- // good since this code is pretending to be C. The
50- // go:norace comments are not enough since the ABI wrappers
51- // still have race code. These variables will circumvent
52- // that issue by calling the function directly.
49+ // good since this code is pretending to be C. The go:norace
50+ // pragma is not enough, since it only applies to the native
51+ // ABIInternal function. The ABIO wrapper (which is necessary,
52+ // since all references to text symbols from assembly will use it)
53+ // does not inherit the go:norace pragma, so it will still be
54+ // instrumented by the race detector.
55+ //
56+ // To circumvent this issue, using closure calls in the
57+ // assembly, which forces the compiler to use the ABIInternal
58+ // native implementation (which has go:norace) instead.
5359 threadentry_call = threadentry
5460 x_cgo_init_call = x_cgo_init
5561 x_cgo_setenv_call = x_cgo_setenv
@@ -46,10 +46,16 @@ var (
46 // In Go 1.20 the race detector was rewritten to pure Go46 // In Go 1.20 the race detector was rewritten to pure Go
47 // on darwin. This means that when CGO_ENABLED=0 is set47 // on darwin. This means that when CGO_ENABLED=0 is set
48 // fakecgo is built with race detector code. This is not48 // fakecgo is built with race detector code. This is not
49- // good since this code is pretending to be C. The49+ // good since this code is pretending to be C. The go:norace
50- // go:norace comments are not enough since the ABI wrappers50+ // pragma is not enough, since it only applies to the native
51- // still have race code. These variables will circumvent51+ // ABIInternal function. The ABIO wrapper (which is necessary,
52- // that issue by calling the function directly.52+ // since all references to text symbols from assembly will use it)
53+ // does not inherit the go:norace pragma, so it will still be
54+ // instrumented by the race detector.
55+ //
56+ // To circumvent this issue, using closure calls in the
57+ // assembly, which forces the compiler to use the ABIInternal
58+ // native implementation (which has go:norace) instead.
53 threadentry_call = threadentry59 threadentry_call = threadentry
54 x_cgo_init_call = x_cgo_init60 x_cgo_init_call = x_cgo_init
55 x_cgo_setenv_call = x_cgo_setenv61 x_cgo_setenv_call = x_cgo_setenv

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close