|
33 | 33 | // |
34 | 34 | // To make it possible for gcc-compiled C code to call a Go function p.GoF, |
35 | 35 | // cgo writes a gcc-compiled function named GoF (not p.GoF, since gcc doesn't |
36 | | -// know about packages). The gcc-compiled C function f calls GoF. |
| 36 | +// know about packages). The gcc-compiled C function f calls GoF. |
37 | 37 | // |
38 | 38 | // GoF initializes "frame", a structure containing all of its |
39 | 39 | // arguments and slots for p.GoF's results. It calls |
|
58 | 58 | // m.g0 stack, so that it can be restored later. |
59 | 59 | // |
60 | 60 | // runtime.cgocallbackg (below) is now running on a real goroutine |
61 | | -// stack (not an m.g0 stack). First it calls runtime.exitsyscall, which will |
| 61 | +// stack (not an m.g0 stack). First it calls runtime.exitsyscall, which will |
62 | 62 | // block until the $GOMAXPROCS limit allows running this goroutine. |
63 | 63 | // Once exitsyscall has returned, it is safe to do things like call the memory |
64 | | -// allocator or invoke the Go callback function. runtime.cgocallbackg |
| 64 | +// allocator or invoke the Go callback function. runtime.cgocallbackg |
65 | 65 | // first defers a function to unwind m.g0.sched.sp, so that if p.GoF |
66 | 66 | // panics, m.g0.sched.sp will be restored to its old value: the m.g0 stack |
67 | 67 | // and the m.curg stack will be unwound in lock step. |
@@ -393,7 +393,7 @@ func cgocallbackg1(fn, frame unsafe.Pointer, ctxt uintptr) { |
393 | 393 | // Now we need to set gp.cgoCtxt = s, but we could get |
394 | 394 | // a SIGPROF signal while manipulating the slice, and |
395 | 395 | // the SIGPROF handler could pick up gp.cgoCtxt while |
396 | | - // tracing up the stack. We need to ensure that the |
| 396 | + // tracing up the stack. We need to ensure that the |
397 | 397 | // handler always sees a valid slice, so set the |
398 | 398 | // values in an order such that it always does. |
399 | 399 | p := (*slice)(unsafe.Pointer(&gp.cgoCtxt)) |
@@ -594,9 +594,9 @@ func cgoCheckPointer(ptr any, arg any) { |
594 | 594 | const cgoCheckPointerFail = "cgo argument has Go pointer to unpinned Go pointer" |
595 | 595 | const cgoResultFail = "cgo result is unpinned Go pointer or points to unpinned Go pointer" |
596 | 596 |
|
597 | | -// cgoCheckArg is the real work of cgoCheckPointer. The argument p |
598 | | -// is either a pointer to the value (of type t), or the value itself, |
599 | | -// depending on indir. The top parameter is whether we are at the top |
| 597 | +// cgoCheckArg is the real work of cgoCheckPointer and cgoCheckResult. |
| 598 | +// The argument p is either a pointer to the value (of type t), or the value |
| 599 | +// itself, depending on indir. The top parameter is whether we are at the top |
600 | 600 | // level, where Go pointers are allowed. Go pointers to pinned objects are |
601 | 601 | // allowed as long as they don't reference other unpinned pointers. |
602 | 602 | func cgoCheckArg(t *_type, p unsafe.Pointer, indir, top bool, msg string) { |
|
0 commit comments